Advertisement
MladenKarachanov

MovieDay

Sep 18th, 2023
843
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class MovieDay {
  4.  
  5.     public static void main(String[] args) {
  6.  
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.        
  10.         int shootingTime = Integer.parseInt(scanner.nextLine());
  11.         int sceneCount = Integer.parseInt(scanner.nextLine());
  12.         int sceneDuration = Integer.parseInt(scanner.nextLine());
  13.  
  14.        
  15.         double preparation = shootingTime * 0.15;
  16.  
  17.      
  18.         double totalTime = (sceneCount * sceneDuration) + preparation;
  19.  
  20.        
  21.         if (shootingTime >= totalTime) {
  22.             System.out.printf("You managed to finish the movie on time! You have %d minutes left!", Math.round(shootingTime - totalTime));
  23.         } else {
  24.             System.out.printf("Time is up! To complete the movie you need %d minutes.", Math.round(totalTime - shootingTime));
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement