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;
- string day, fruits;
- cin >> fruits >> day >> quantity;
- 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
- {
- cout << "error" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement