0
Hovercraft solutions
I write acode to calculate the selles and the five test not correct what is the wrong with me https://code.sololearn.com/ctT6Gt11Z17B/?ref=app
4 Antworten
+ 1
Wrong case for Code Coach question alone does not mean there is something is wrong with you. It only means that there is something wrong with the code.
Please, post your code, so that we can help you.
+ 1
Now let's see if there are more numbers for which to generate "Broke Even":
• 42 000 000 ÷ 3 000 000 = 42 ÷ 3 = 14. For 11 <= n < 14 it should generate "Loss".
• 63 000 000 ÷ 3 000 000 = 63 ÷ 3 = 21.
• 84 000 000 ÷ 3 000 000 = 84 ÷ 3 = 28. It is less than 31, so there are no more "Loss" and "Broke Even" cases, there are only "Profit" cases.
What do we have:
• For {0 <= n < 7; 11 <= n < 14} the output is "Loss".
• For {n = 7; n = 14; n = 21} the output is "Broke Even".
• Otherwise the output is "Profit".
0
My code is the link that i poste on my description of my question
0
Let's analyse the task:
• If your factory builds 10 hovercraft by 2 000 000 each and you additionally pay 1 000 000 every month, then total cost per month is 10 × 2 000 000 + 1 000 000 = 20 000 000 + 1 000 000 = 21 000 000.
• If there are 0 <= x <= 10 customers, then you should work for 1 month. If there are 10 < x <= 20 customers, then you should work for 2 months (it will cost 2 × 21 000 000 = 42 000 000).
Now we know how to calculate it. Let's go with cases that will produce "Broke Even" output in your code to see if they are right:
• n = 6: 6 × 3 000 000 - 21 000 000 = 18 000 000 - 21 000 000 = -3 000 000. It should generate "Loss".
• n = 7: 7 × 3 000 000 - 21 000 000 = 21 000 000 - 21 000 000 = 0.
• n = 8: 8 × 3 000 000 - 21 000 000 = 24 000 000 - 21 000 000 = 3 000 000. It should generate "Profit". The same for n = 9.
Also: 21 000 000 ÷ 3 000 000 = 21 ÷ 3 = 7.
[...]