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