Question: NEED help me with my code #include #include using namespace std; int main() { double per_day = 109, // cost per day of a ticket

NEED help me with my code

#include #include using namespace std;

int main() { double per_day = 109, // cost per day of a ticket discount = 0, // discount percentage to be applied total_cost=0, // total cost of the tickets sold unit_cost=0; // cost per day of a ticket after discount

int days; // number of days of tickets sold

cout << " HOMEWORK/CLASSWORK #4 Part 1 "; cout << "How many days of tickets were sold? "; cin >> days;

if (days <= 0) { cout << "Tickets sold must be greater than zero."; } else if (days <= 2) discount = 0;

else if (days == 3) discount = 0.10; else if (days == 4) discount = 0.10; else if (days <= 6) discount = 0.25; else if (days <= 9) discount = 0.33; else discount = 0.42;

unit_cost = per_day * (1 - discount); total_cost = unit_cost * days;

cout << fixed << setprecision(2); cout << "The total cost of the purchase is $" << total_cost << endl; cout << " Programmer: "; return 0; }

1. the total cost should not print after an error message.

2. The total cost for 1 and 2 days is not correct. ( the discount shouldn't be applied and no logical operators)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!