Advertisement
Spocoman

Agency Profit

Aug 31st, 2024
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         String agency = scanner.nextLine();
  7.         int tickets = Integer.parseInt(scanner.nextLine()),
  8.                 kidTickets = Integer.parseInt(scanner.nextLine());
  9.         double ticketPrice = Double.parseDouble(scanner.nextLine()),
  10.                 service = Double.parseDouble(scanner.nextLine());
  11.  
  12.         double totalAdultTicketrice = (ticketPrice + service) * tickets,
  13.                 totalKidTicketrice = (0.3 * ticketPrice + service) * kidTickets,
  14.                 profit = (totalAdultTicketrice + totalKidTicketrice) / 5;
  15.  
  16.         System.out.printf("The profit of your agency from %s tickets is %.2f lv.", agency, profit);
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement