Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <iomanip>
- using namespace std;
- int main()
- {
- double quantity;
- double total_price_on_weekday;
- double total_price_on_weekend;
- string day, fruits;
- cin >> fruits >> day >> quantity;
- bool is_it_incorrect_day = "Monday" || "Tuesday" || "Wednesday" || "Thursday" || "Friday" || "Saturday" || "Sunday";
- bool is_it_incorrect_fruit = "banana" || "apple" || "orange" || "grapefruit" || "kiwi" || "pineapple" || "grapes";
- if (day == "Monday" || day == "Tuesday" || day == "Wednesday" || day == "Thursday" || day == "Friday")
- {
- if (fruits == "banana") cout << fixed << setprecision(2) << 2.5 * quantity << endl;
- else if (fruits == "apple") cout << fixed << setprecision(2) << 1.2 * quantity << endl;
- else if (fruits == "orange") cout << fixed << setprecision(2) << 0.85 * quantity << endl;
- else if (fruits == "grapefruit") cout << fixed << setprecision(2) << 1.45 * quantity << endl;
- else if (fruits == "kiwi") cout << fixed << setprecision(2) << 2.7 * quantity << endl;
- else if (fruits == "pineapple") cout << fixed << setprecision(2) << 5.5 * quantity << endl;
- else if (fruits == "grapes") cout << fixed << setprecision(2) << 3.85 * quantity << endl;
- else cout << "error" << endl;
- }
- else if (day == "Saturday" || day == "Sunday")
- {
- if (fruits == "banana") cout << fixed << setprecision(2) << 2.7 * quantity << endl;
- else if (fruits == "apple") cout << fixed << setprecision(2) << 1.25 * quantity << endl;
- else if (fruits == "orange") cout << fixed << setprecision(2) << 0.90 * quantity << endl;
- else if (fruits == "grapefruit") cout << fixed << setprecision(2) << 1.60 * quantity << endl;
- else if (fruits == "kiwi") cout << fixed << setprecision(2) << 3.0 * quantity << endl;
- else if (fruits == "pineapple") cout << fixed << setprecision(2) << 5.6 * quantity << endl;
- else if (fruits == "grapes") cout << fixed << setprecision(2) << 4.2 * quantity << endl;
- else cout << "error" << endl;
- }
- else if (is_it_incorrect_day || is_it_incorrect_fruit)
- {
- cout << "error" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement