Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <math.h>
- using namespace std;
- int main()
- {
- string town, typePackage, discount;
- cin >> town >> typePackage >> discount;
- int days;
- cin >> days;
- bool isValid = true;
- double pricePerDay = 0;
- if (days < 1) {
- cout << "Days must be positive number!" << endl;
- } else {
- if (days > 7) {
- days = days - 1;
- }
- //Банско/Боровец
- if (town == "Bansko" || town == "Borovets") {
- if (typePackage == "noEquipment") {
- pricePerDay = 80;
- if (discount == "yes") {
- pricePerDay = 76;
- }
- }
- else if (typePackage == "withEquipment") {
- pricePerDay = 100;
- if (discount == "yes") {
- pricePerDay = 90;
- }
- }
- else {
- cout << "Invalid input!" << endl;
- isValid = false;
- }
- }
- else if (town == "Varna" || town == "Burgas") {
- if (typePackage == "noBreakfast") {
- pricePerDay = 100;
- if (discount == "yes") {
- pricePerDay = 93;
- }
- }
- else if (typePackage == "withBreakfast") {
- pricePerDay = 130;
- if (discount == "yes") {
- pricePerDay = 114.40;
- }
- }
- else {
- cout << "Invalid input!" << endl;
- isValid = false;
- }
- }
- else {
- cout << "Invalid input!" << endl;
- isValid = false;
- }
- if (isValid == true) {
- double totalPrice = days * pricePerDay;
- cout.setf(ios::fixed);
- cout.precision(2);
- cout << "The price is " << totalPrice << "lv! Have a nice time!" << endl;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment