Advertisement
Spocoman

Movie Day

Sep 8th, 2024 (edited)
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 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.         int movieTime = Integer.parseInt(scanner.nextLine()),
  7.                 scenes = Integer.parseInt(scanner.nextLine()),
  8.                 sceneTime = Integer.parseInt(scanner.nextLine());
  9.  
  10.         double totalTime = 0.15 * movieTime + scenes * sceneTime;
  11.  
  12.         if (totalTime >= movieTime) {
  13.             System.out.println("Time is up! To complete the movie you need " + (int) Math.round(totalTime - movieTime) + " minutes.");
  14.         } else {
  15.             System.out.println("You managed to finish the movie on time! You have " + (int) Math.round(movieTime - totalTime) + " minutes left!");
  16.         }
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement