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 finalPrice=0,currentPrice=0;
- bool validation = ((budget>=1 && budget<=8000)
- && (fishers>=4 && fishers<=18)) ;
- bool validation2 = (season=="Spring" || season=="Summer" ||
- season=="Autumn" || season=="Winter");
- if ((season=="Autumn" || season=="Summer")&& validation==1){
- if (fishers>=4 && fishers<=6){
- currentPrice= 4200 *0.90;
- } else if (fishers>=7 && fishers<=11){
- currentPrice= 4200 *0.85;
- } else if (fishers>=12) {
- currentPrice= 4200 *0.75;
- }
- } else if (season=="Spring" && validation==1){
- if (fishers>=4 && fishers<=6){
- currentPrice= 3000 *0.90;
- } else if (fishers>=7 && fishers<=11){
- currentPrice= 3000 *0.85;
- } else if (fishers>=12) {
- currentPrice= 3000 *0.75;
- }
- } else if (season=="Winter" && validation==1){
- if (fishers>=4 && fishers<=6){
- currentPrice= 2600 *0.90;
- } else if (fishers>=7 && fishers<=11){
- currentPrice= 2600 *0.85;
- } else if (fishers>=12) {
- currentPrice= 2600 *0.75;
- }
- }
- if (fishers%2==0 && season!="Autumn"){
- finalPrice=currentPrice*0.95;
- }else {
- finalPrice=currentPrice;
- }
- cout.setf(ios::fixed);
- cout.precision(2);
- if (currentPrice>=0 && finalPrice>=0 && validation2==1){
- 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