-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAgencyProfit.java
More file actions
29 lines (18 loc) · 910 Bytes
/
Copy pathAgencyProfit.java
File metadata and controls
29 lines (18 loc) · 910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package PBExams;
import java.util.Scanner;
public class AgencyProfit {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String airlines = scanner.nextLine();
int adultTickets = Integer.parseInt(scanner.nextLine());
int kidsTickets = Integer.parseInt(scanner.nextLine());
double priceAdult = Double.parseDouble(scanner.nextLine());
double airportTaxes = Double.parseDouble(scanner.nextLine());
double kidTicket = priceAdult - priceAdult * 0.70;
int totalTickets = adultTickets + kidsTickets;
double totalAirport = totalTickets * airportTaxes;
double totalPrice = adultTickets * priceAdult + kidsTickets * kidTicket + totalAirport;
double profit = totalPrice * 0.20;
System.out.printf("The profit of your agency from %s tickets is %.2f lv.",airlines,profit);
}
}