desislava_topuzakova

01. Series Calculator

May 22nd, 2021
1,166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.12 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class PrintAndSum_04 {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         //време за един епизод с реклами = епизод + реклами (20% oт епизод)
  7.         //доп. време от спец. епизоди = бр. сезони * 10
  8.         //общо време = сезони * бр. епизоди за сезон * време за един епизод с реклами + доп. време от спец. епизоди
  9.         String seriesName = scanner.nextLine();
  10.         int seasons = Integer.parseInt(scanner.nextLine());
  11.         int episodes = Integer.parseInt(scanner.nextLine());
  12.         double timeForEpisode = Double.parseDouble(scanner.nextLine());
  13.  
  14.         double totalTimeEpisode = timeForEpisode + 0.2 * timeForEpisode;
  15.         int additionalTime = seasons * 10;
  16.  
  17.         double totalTime = (seasons * episodes * totalTimeEpisode) + additionalTime;
  18.         System.out.printf("Total time needed to watch the %s series is %.0f minutes.", seriesName, Math.floor(totalTime));
  19.  
  20.     }
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment