Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class TripToWorldCup {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double ticketGo = Double.parseDouble(scanner.nextLine());
- double ticketBack = Double.parseDouble(scanner.nextLine());
- double oneTicketPrice = Double.parseDouble(scanner.nextLine());
- int matchCount = Integer.parseInt(scanner.nextLine());
- int discount = Integer.parseInt(scanner.nextLine());
- double friendsPrice = 6 * (ticketGo + ticketBack);
- double flyTicketDiscount = friendsPrice - (friendsPrice * discount) / 100;
- double sumTicketMatch = (6 * matchCount * oneTicketPrice);
- double totalSum = flyTicketDiscount + sumTicketMatch;
- double sumFriends = totalSum / 6;
- System.out.printf("Total sum: %.2f lv.\n",totalSum);
- System.out.printf("Each friend has to pay %.2f lv.",sumFriends);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement