Advertisement
myrdok123

P01MovieProfit

Apr 20th, 2024
540
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.90 KB | None | 0 0
  1. package ExamPrep;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P01MovieProfit {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner scanner = new Scanner(System.in);
  9.  
  10.         //прочитаме входните данни
  11.         String movieName = scanner.nextLine();
  12.         int countDays = Integer.parseInt(scanner.nextLine());
  13.         int countTickets = Integer.parseInt(scanner.nextLine());
  14.         double ticketPrice = Double.parseDouble(scanner.nextLine());
  15.         int percent = Integer.parseInt(scanner.nextLine());
  16.  
  17.         double sumForDay = countTickets * ticketPrice;
  18.         double totalSumWithoutDiscount = sumForDay * countDays;
  19.         double discount = totalSumWithoutDiscount * percent / 100.0;
  20.  
  21.         double totalSum = totalSumWithoutDiscount - discount;
  22.  
  23.         System.out.printf("The profit from the movie %s is %.2f lv.", movieName, totalSum);
  24.  
  25.  
  26.  
  27.     }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement