Advertisement
yovkovbpfps

Simple Operations Trip To World Cup

Apr 21st, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class TripToWorldCup {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. double ticketGo = Double.parseDouble(scanner.nextLine());
  8. double ticketBack = Double.parseDouble(scanner.nextLine());
  9. double oneTicketPrice = Double.parseDouble(scanner.nextLine());
  10. int matchCount = Integer.parseInt(scanner.nextLine());
  11. int discount = Integer.parseInt(scanner.nextLine());
  12.  
  13. double friendsPrice = 6 * (ticketGo + ticketBack);
  14. double flyTicketDiscount = friendsPrice - (friendsPrice * discount) / 100;
  15. double sumTicketMatch = (6 * matchCount * oneTicketPrice);
  16.  
  17. double totalSum = flyTicketDiscount + sumTicketMatch;
  18. double sumFriends = totalSum / 6;
  19.  
  20. System.out.printf("Total sum: %.2f lv.\n",totalSum);
  21. System.out.printf("Each friend has to pay %.2f lv.",sumFriends);
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement