Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class CarToGo {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double budget = Double.parseDouble(scanner.nextLine());
- String season = scanner.nextLine();
- String car = "Jeep", carClass = "Luxury class";
- if (budget > 500) {
- budget *= 0.90;
- } else if (budget > 100) {
- if (season.equals("Summer")) {
- car = "Cabrio";
- budget *= 0.45;
- } else {
- budget *= 0.80;
- }
- carClass = "Compact class";
- } else if (budget > 0) {
- if (season.equals("Summer")) {
- car = "Cabrio";
- budget *= 0.35;
- } else {
- budget *= 0.65;
- }
- carClass = "Economy class";
- }
- System.out.printf("%s\n%s - %.2f\n", carClass, car, budget);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement