galinyotsev123

ProgBasicsExam28and29July2018-E01tripToWorldCup

Dec 28th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class E01tripToWorldCup {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. double flightPrice = Double.parseDouble(scanner.nextLine());
  8. double returnPrice = Double.parseDouble(scanner.nextLine());
  9. double matchTicket = Double.parseDouble(scanner.nextLine());
  10. double matchQuantity = Double.parseDouble(scanner.nextLine());
  11. double discount = Double.parseDouble(scanner.nextLine());
  12.  
  13. double totalFlightTickets = (flightPrice + returnPrice);
  14. double totalFlightTicketsAfterDiscount = totalFlightTickets - (totalFlightTickets * (discount / 100));
  15. double eachBill = totalFlightTicketsAfterDiscount + (matchQuantity * matchTicket);
  16. double TOTAL = eachBill * 6;
  17.  
  18. System.out.printf("Total sum: %.2f lv.%n", TOTAL);
  19. System.out.printf("Each friend has to pay %.2f lv.", eachBill);
  20.  
  21.  
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment