Advertisement
MladenKarachanov

Untitled

Nov 9th, 2021
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. package ProgrammingBasicsExam;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class AgencyProfit {
  6. public static void main(String[] args) {
  7. Scanner scanner= new Scanner(System.in);
  8. String name=scanner.nextLine();
  9. int numTicket=Integer.parseInt(scanner.nextLine());
  10. int numChildrenTicket=Integer.parseInt(scanner.nextLine());
  11. double priceTicket=Double.parseDouble(scanner.nextLine());
  12. double pricePrice=Double.parseDouble(scanner.nextLine());
  13. double numOneChildren=priceTicket*0.30;
  14. double priceOld=priceTicket+pricePrice;
  15. double priceChildren=numOneChildren+pricePrice;
  16. double totalPrice=(numChildrenTicket*priceChildren)+(numTicket*priceOld);
  17. double profit=totalPrice-=totalPrice*0.80;
  18. System.out.printf("The profit of your agency from %s, tickets is %.2f lv.",profit);
  19.  
  20.  
  21.  
  22. }
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement