Advertisement
veronikaaa86

01. Series Calculator

Jun 18th, 2022
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. package examPrep;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P01SeriesCalculator {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. String showName = scanner.nextLine();
  10. int seasonsCount = Integer.parseInt(scanner.nextLine());
  11. int episodesCount = Integer.parseInt(scanner.nextLine());
  12. double timeEpisode = Double.parseDouble(scanner.nextLine());
  13.  
  14. double adTime = timeEpisode * 0.20;
  15. double episodeTimePlusAd = timeEpisode + adTime;
  16. double specialTimeEpisodes = seasonsCount * 10;
  17.  
  18. double totalTime = episodeTimePlusAd * episodesCount * seasonsCount + specialTimeEpisodes;
  19.  
  20. System.out.printf("Total time needed to watch the %s series is %.0f minutes.", showName, Math.floor(totalTime));
  21. }
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement