- 3

Omg still about code coach

Hovercraft +10 XP You run a hovercraft factory. Your factory makes ten hovercrafts in a month. Given the number of customers you got that month, did you make a profit? It costs you 2,000,000 to build a hovercraft, and you are selling them for 3,000,000. You also pay 1,000,000 each month for insurance. Task: Determine whether or not you made a profit based on how many of the ten hovercrafts you were able to sell that month. Input Format: An integer that represents the sales that you made that month. Output Format: A string that says 'Profit', 'Loss', or 'Broke Even'. //i typed the below code for the above challange But only one test case kept on failing and that is num 7 what should i do? #include<iostream> using namespace std; int main() { int hover;int cost=21000000; cin>>hover; int c = hover*3000000; if(c>=cost){ cout<<"Profit";} else{ cout<<"Loss";} return 0; }

24th Mar 2020, 10:57 PM
Immortal Soul
Immortal Soul - avatar
20 ответов
+ 1
Your code has a dozen syntactic errors. Just make sure all the keywords are spelled correctly and there are no semicolons missing, then it should work.
25th Mar 2020, 7:26 AM
Shadow
Shadow - avatar
+ 1
Your if-statement had three different paths, but you removed the else-part from it without reason. Since there are three possible outputs, you need three different paths. Mirielle(20k XP Monthly till November [2020]) already showed you how in the first answer.
25th Mar 2020, 8:59 AM
Shadow
Shadow - avatar
+ 1
Hey! bro you need to first find out total how much it would cost you to build 10 Hovercraft in a month 10* 2,000,000 then it is saying that each month you pay 1,000,000 for your insurance it means 20,000,000 + 1,000,000 = 21,000,000 Now, you are selling them for 3,000,000 based on your sales you need to find out you have profit or loss if you have no profit and no loss then the answer should be "Broke Even" so, if no_of_coustomer * 3,000,000 > 21,000,000 : Then ouutput will be "Profit" elif no_of_coustomer * 3,000,000 < 21,000,000 : Then your output should be "Loss" else ( it mean no profit no loss) : Your output should be "Broke Even" I think🤔🤔😂 now you got the answer if you like 🤩🤩 my answer then comment 💬 me
26th Mar 2020, 3:40 PM
Mew2
Mew2 - avatar
+ 1
Great bro 👍 keep solving
26th Mar 2020, 3:46 PM
Mew2
Mew2 - avatar
0
Why did you remove one of the if-distinctions again?
25th Mar 2020, 8:12 AM
Shadow
Shadow - avatar
0
Which distiniction
25th Mar 2020, 8:51 AM
Immortal Soul
Immortal Soul - avatar
0
#include<iostream> using namespace std; int main() { int hover; int cost=21000000; cin>>hover; int c = hover*3000000; if(c>=cost){ cout<<"Profit";} else{ cout<<"Loss";} return 0; } This is thr code
25th Mar 2020, 6:26 PM
Immortal Soul
Immortal Soul - avatar
0
What is the use of assigning int cost to 10*2000000+1000000 while u can assign it to just int cost=21000000 + i get it now i have to use the else if statement and stop using the (c>=cost) but thank u u were a big help man
26th Mar 2020, 7:21 AM
Immortal Soul
Immortal Soul - avatar
0
But i still didn't get why u assigned cost to 10*2000000+1000000 while u could have assigned it to 21000000
26th Mar 2020, 7:23 AM
Immortal Soul
Immortal Soul - avatar
0
Dude ur answer is good and explains alot but i already solved it so
26th Mar 2020, 3:42 PM
Immortal Soul
Immortal Soul - avatar
0
Will do
26th Mar 2020, 3:47 PM
Immortal Soul
Immortal Soul - avatar
- 1
I updated the code to I updated the code t #inclide<iostream> Using namespace std; Int main() { Int hover; int cost =10*2000000+1000000; Cin>>hover; int c = hover*3000000; If(c>cost){cout<<"Profit"} else if (cost > c){ cout<<"Loss"; } else{ Cout<<"Broke Even"; } return 0; } But its not even close it faild the whole damn test cases
25th Mar 2020, 4:13 AM
Immortal Soul
Immortal Soul - avatar
- 1
Anybody else
25th Mar 2020, 4:26 AM
Immortal Soul
Immortal Soul - avatar
- 1
Naaa i updated it again it is not working
25th Mar 2020, 7:49 AM
Immortal Soul
Immortal Soul - avatar
- 1
#include<iostream> using namespace std; int main(){ int hover; int cost=10*2000000+1000000; cin>>hover; int c=hover*3000000; if(c>cost){ cout<<"Profit"; } else if(cost>c){ cout<<"Broke Even";} return 0; } This is the new update but its not working
25th Mar 2020, 7:53 AM
Immortal Soul
Immortal Soul - avatar
- 1
I made all the upper cases to lower cases t
25th Mar 2020, 7:54 AM
Immortal Soul
Immortal Soul - avatar