Advertisement
desislava_topuzakova

01. Series Calcualtor

Jun 10th, 2023
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Task1 {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6. //1. входни данни
  7. String serialName = scanner.nextLine(); //име на сериал
  8. int countSeasons = Integer.parseInt(scanner.nextLine()); //брой сезони
  9. int countEpisodes = Integer.parseInt(scanner.nextLine()); //брой епизоди в сезон
  10. double timePerEpisode = Double.parseDouble(scanner.nextLine()); //времетраене на епизод
  11. double timeForAds = 0.2 * timePerEpisode; //времетраена на реклами
  12.  
  13. //времетраене на епизод с рекламите
  14. double totalTimeForEpisode = timePerEpisode + timeForAds;
  15. //допълнително време за специални епизоди
  16. double additionalTime = countSeasons * 10;
  17.  
  18. double totalTime = (countSeasons * countEpisodes * totalTimeForEpisode) + additionalTime;
  19.  
  20.  
  21. System.out.printf("Total time needed to watch the %s series is %.0f minutes.", serialName, Math.floor(totalTime));
  22.  
  23.  
  24.  
  25. }
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement