Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main ()
- {
- double budget;
- int fishers;
- string season;
- cin >> budget >> season >> fishers;
- double basePrice = 4200.0;
- if (season == "Spring")
- {
- basePrice = 3000.0;
- }
- else if (season == "Winter")
- {
- basePrice = 2600.0;
- }
- double priceModifier = 0.9;
- if (fishers > 11)
- {
- priceModifier = 0.75;
- }
- else if (fishers > 6)
- {
- priceModifier = 0.85;
- }
- if (fishers % 2 == 0 && season != "Autumn")
- {
- priceModifier *= 0.95;
- }
- double finalPrice = basePrice * priceModifier;
- cout.setf(ios::fixed);
- cout.precision(2);
- if(budget >= finalPrice)
- {
- cout << "Yes! You have " << budget - finalPrice << " leva left." << endl;
- }
- else if (budget<finalPrice)
- {
- cout << "Not enough money! You need " << finalPrice - budget << " leva." << endl;
- }
- return 0 ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement