Advertisement
Spocoman

Car To Go

Sep 15th, 2023
695
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     double budget;
  8.     cin >> budget;
  9.  
  10.     string season;
  11.     cin >> season;
  12.  
  13.     string modelCar = "Jeep";
  14.     string classCar = "Luxury";
  15.  
  16.     if (budget <= 100) {
  17.         if (season == "Summer") {
  18.             modelCar = "Cabrio";
  19.             budget *= 0.35;
  20.         }
  21.         else {
  22.             budget *= 0.65;
  23.         }
  24.         classCar = "Economy class";
  25.     }
  26.     else if (budget <= 500) {
  27.  
  28.         if (season == "Summer") {
  29.             modelCar = "Cabrio";
  30.             budget *= 0.45;
  31.         }
  32.         else {
  33.             budget *= 0.80;
  34.         }
  35.         classCar = "Compact class";
  36.     }
  37.     else {
  38.         classCar = "Luxury class";
  39.         budget *= 0.90;
  40.     }
  41.  
  42.     cout << (classCar) << endl;
  43.     cout << modelCar << " - " << fixed << setprecision(2) << budget << endl;
  44.  
  45.     return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement