 Help solve the problem | Sololearn: Learn to code for FREE!

+3

# Help solve the problem

How to solve the problem? Here is the task: 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'. Sample Input: 5 Sample Output: Loss Entering 10 displays an error. Please indicate the error in the code. sales = int(input()) balance = int(sales*1000000-1000000) if balance > 0: print('Profit') elif balance == 0: print('Broke Even') else: print('Loss')

+1

Sorry if I wrong said about problem

+1

Vlad The code is wrong. If I sold 2 hovercrafts in the month: Earn: 6M: Selling 2 hovercrafts (2*3M=6M) Loss: 28M: Creating 10 hovercrafts (10*2M=20M) Insurance of 8 hovercrafts (8*M=8M) 6M - 28M = -22M (loss) In your code it would be: sales = 2 balance = sales * M - M = 2M - M = +M (profit)

+1

Ah, I thought insurance didn’t apply to ships. Thanks you

+1

Hare is solution of your problem order= int(input()) sales=order*3000000 cost=20000000 balance = int(sales-21000000) if balance > 0: print('Profit') elif balance == 0: print('Broke Even') else: print('Loss')

+1

yo Vlad this is the code I wrote with explanations you can run it and see, it works but just go through why it works, dont want to just solve it for you without helping #just assigning a variable to 21 million, this is the amount spent on making 10 hovercrafts in a month #this is usefull in later calculations per_month_payments = 21000000 #getting input of how many hovercrafts were sold hovercrafts_sold_month = int(input("How many hovercrafts were sold? ")) print(hovercrafts_sold_month) #getting the amount of money I- the company made cash_made_from_HCs = hovercrafts_sold_month * 3000000 #cashiness is used in calculating if I- we the company made a profit a loss or if it was Broke e- Even cashiness = cash_made_from_HCs - per_month_payments if hovercrafts_sold_month <= 10: if cashiness > 0: print("Profit") elif cashiness == 0: print("Broke Even") elif cashiness < 0: print("Loss") else: print("how would I- The company sell more hovercrafts then I made??? Sorry didn't mean I made, I meant WE made")

+1

#FROM PYTHON sale=int(input()) Cp=2*10+1 Sp=3*sale if Cp>Sp: print("Loss") if Cp<Sp: print("Profit") if Cp==Sp: print("Broke Even")

+1

#python kater = int(input()) #кількість проданих катерів min = 21000000 """min - це загальна кількість вират: на виготовлення (10*2млн) і страховку (1млн)""" katers = kater*3000000 """прибуток з продажу""" profit = katers - min #обчислення загального прибутку if profit == 0: print ("Broke Even") #якщо витрати=прибутку elif profit > 0: print ("Profit") #якщо прибуток>витрат else: print ("Loss") #якщо прибуток<вират

+1

n = int(input()) if n > 7: print("Profit") elif n < 7 : print("Loss") else : print("Broke Even")

0

Seems to be a logic error.

0

i translated incorrectly. In test with in input 7 programm output profit. But this is a wrong answer. Is it a mistake in the task or mine in code? Code work good.

0

I did mine using C++ but its not working #include <iostream> using namespace std; int main() { int sales; double S_P=3000000, Insurance=1000000,C_P=2000000,Amount_received; const int Num=10; double principal_amount=(C_P*Num)+Insurance; cout<<"Enter the number of customers: "; cin>>sales; Amount_received=(sales*S_P); if(Amount_received<principal_amount) { cout<<"Loss"; } if(Amount_received>principal_amount) { cout<<"Profit"; } if(Amount_received==principal_amount) { cout<<"Broken Even"; } return 0; }

0

Я не знаю как у меня это сработало, но это работает :/ C++ #include <iostream> using namespace std; int main() { int N = 0; cin >> N; if (N < 7){ cout << "Loss"; } else if (N >= 8){ cout << "Profit"; } else if (N <= 7){ cout << "Broke Even"; } return 0; }

0

Very Simple Way To Solve! import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int sales = sc.nextInt(); if (sales<5 && sales>=0) { System.out.println("Loss"); }else if (sales==7){ System.out.println("Broke Even"); }else if (sales>7 && sales<=10){ System.out.println("Profit"); } } }