Advertisement
Spocoman

Car To Go

Sep 2nd, 2024 (edited)
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.96 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.         double budget = Double.parseDouble(scanner.nextLine());
  7.         String season = scanner.nextLine(),
  8.                 car = "Jeep", carClass = "Luxury class";
  9.  
  10.         if (budget > 500) {
  11.             budget *= 0.90;
  12.         } else if (budget > 100) {
  13.             if (season.equals("Summer")) {
  14.                 car = "Cabrio";
  15.                 budget *= 0.45;
  16.             } else {
  17.                 budget *= 0.80;
  18.             }
  19.             carClass = "Compact class";
  20.         } else if (budget > 0) {
  21.             if (season.equals("Summer")) {
  22.                 car = "Cabrio";
  23.                 budget *= 0.35;
  24.             } else {
  25.                 budget *= 0.65;
  26.             }
  27.             carClass = "Economy class";
  28.         }
  29.  
  30.         System.out.printf("%s\n%s - %.2f\n", carClass, car, budget);
  31.     }
  32. }
  33.  
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement