Valantina

MovieDay

Jun 18th, 2019
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class P02_MovieDay {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.  
  7.         int timeToFilm = Integer.parseInt(scan.nextLine());
  8.         int scenes = Integer.parseInt(scan.nextLine());
  9.         int timePerScene = Integer.parseInt(scan.nextLine());
  10.  
  11.         double scenePreparation = timeToFilm * 0.15;
  12.         int timeForScenes = scenes * timePerScene;
  13.  
  14.         double totalTimeForFilming = scenePreparation + timeForScenes;
  15.  
  16.         if (totalTimeForFilming < timeToFilm) {
  17.             System.out.println(String.format("You managed to finish the movie on time! You have %d minutes left!",
  18.                     Math.round(timeToFilm - totalTimeForFilming)));
  19.         } else {
  20.             System.out.println(String.format("Time is up! To complete the movie you need %d minutes.",
  21.                     Math.round(totalTimeForFilming - timeToFilm)));
  22.         }
  23.     }
  24. }
Add Comment
Please, Sign In to add comment