Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- const double ROSE_PRICE = 5;
- const double DAHLIA_PRICE = 3.8;
- const double TULIP_PRICE = 2.8;
- const double NARCISSYS_PRICE = 3;
- const double GLADIOLUS_PRICE = 2.5;
- string flower;
- cin >> flower;
- int quantity;
- cin >> quantity;
- double budget;
- cin >> budget;
- double sum;
- if (flower == "Roses") {
- sum = ROSE_PRICE * quantity;
- if (quantity > 80) {
- sum *= 0.9;
- }
- }
- else if (flower == "Dahlias") {
- sum = DAHLIA_PRICE * quantity;
- if (quantity > 90) {
- sum *= 0.85;
- }
- }
- else if (flower == "Tulips") {
- sum = TULIP_PRICE * quantity;
- if (quantity > 80) {
- sum *= 0.85;
- }
- }
- else if (flower == "Narcissus") {
- sum = NARCISSYS_PRICE * quantity;
- if (quantity < 120) {
- sum *= 1.15;
- }
- }
- else if (flower == "Gladiolus") {
- sum = GLADIOLUS_PRICE * quantity;
- if (quantity < 80) {
- sum *= 1.2;
- }
- }
- cout.setf(ios::fixed);
- cout.precision(2);
- if (sum > budget) {
- cout << "Not enough money, you need " << sum - budget << " leva more." << endl;
- }
- else {
- cout << "Hey, you have a great garden with " << quantity << " " << flower << " and " << budget - sum << " leva left.";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement