How to move decimals and show specific number? C++ - c++

Hello I'm here as a last resort. For this assignment, I have been unable to figure out certain things like how to show a decimal as a whole number. For example, .29 should be 29.00. I also don't know how to show the number of items properly as in if there's 2 items(3 eggs and 2 cheeses),how do I only show 2 items instead of 5?
I have attached the guidelines for this assignment and what I have so far. Thank you for your help!
Part A
Your program should obtain the following information from the user upon startup:
• Name of the cashier.
• State that store is located in (Arizona, New York, etc)
• Date (separated into day, month and year)
Part B
The program should display a welcome message to the user in the following format:
Hello (cashier name) Welcome to Cashier App.
You are currently cashing for a store located in (state).
Today’s date is (date).
The program should allow the user to enter, for an unlimited number of products, the name of the product, the price and the quantity being purchased. The program must calculate the amount of tax to add to the price, depending on which of the following three states the program is being used in:

New York - 9.75%
New Jersey - 8.25%
Connecticut - 7.5%
Tennessee - 4.5%
All Others - 10%
After calculating the total amount owed for a single product, the program should display the name of the product and the total and then ask the user whether or not they would like to enter another product i.e.
Eggs - $10.74 

Would you like to enter another product?
After the user has entered all of their products, you should display a summary of the purchases that tells the user how many items were entered and the total amount due i.e.
You have entered 14 products. Your total amount owed is $845.89
#include <iostream>
using namespace std;
int main() {
string state, month, day, year, cashierName, productName;
char YorN;
float price, tax, productTotal, productQuantity, totalQuantity = 0, total = 0;
cout << "Enter name: ";
cin >> cashierName;
cout << "Are you in NY, NJ, CT, TN, or other?: ";
cin >> state;
cout << "Enter month: ";
cin >> month;
cout << "Enter day: ";
cin >> day;
cout << "Enter year: ";
cin >> year;
cout << "Hello " << cashierName << ". Welcome to Cashier App.\n";
cout << "You are currently cashing for a store located in " << state << ".\n";
cout << "Today's date is " << month << " " << day << ", " << year << ".\n";
if(state == "NY" || state == "ny") {
tax = .0975;
}
else if (state == "NJ" || state == "nj") {
tax = .0825;
}
else if (state == "CT" || state == "ct") {
tax = .075;
}
else if (state == "TN" || state == "tn") {
tax = .045;
}
else {
tax = .1;
}
cout << "Do you want to add a product to your cart? (Y/N) ";
cin >> YorN;
while(YorN == 'Y' || YorN == 'y') {
cout << "Enter product name: ";
cin >> productName;
cout << "Enter price: ";
cin >> price;
cout << "Enter quantity: ";
cin >> productQuantity;
productTotal = price * productQuantity * tax;
total = productTotal + total;
totalQuantity = productQuantity + totalQuantity;
int nProductTotal = int(productTotal * 100);
productTotal = ((float)nProductTotal)/100;
int nTotal = int(total * 100);
total = ((float)nTotal)/100;
cout << productName << " - $" << productTotal << endl;
cout << "Would you like to enter another another product? (Y/N) ";
cin >> YorN;
}
cout << "You have entered " << totalQuantity << " products. Your total amount owed is $" << total << ".\n";
return 0;
}

To show the number of different products you can count them with
...
int totalQuantity(0);
while(YorN == 'Y' || YorN == 'y') {
++totalQuantity;
...
// remove totalQuantity = productQuantity + totalQuantity;
...
}
cout << "You have entered " << totalQuantity << " products. Your total amount owed is $" << total << ".\n";
...
totalQuantity should be of type int and not float as you can't buy 2.2 different products. To round the values to two decimals you can use
productTotal = std::round(price * productQuantity * tax * 100)/100;
Please avoid c style casts like
(float)nTotal
The c++ way to do this is
static_cast<float>(nTotal);
I don't understand what you mean with .29 should be 29.00 but you can achieve this with
double a = 100 * .29;
or
int a = std::round(100 * .29);
or
cout << std::setprecision(2) << 0.29 * 100 << '\n';

Related

How to fix the calculation of tax yearly in a loop?

I need to write a program records membership fees for a Gym. The Gym charges a $1,200 per year, base fee but charges a percentage rate increase each year based on your membership rating:
Gold Members 1% fee
Silver Members 2% fee
Bronze Members 4% fee
It will display the following menu:
Welcome to Ronda’s Strikeforce Gym!!
x---------------------------------------------------x
Membership Fee Calculator
Gold
Silver
Bronze
Quit
Please enter your membership level (1-3 Enter 4 to Quit) >
The Validate input for the menu items listed, if 1 through 3 is entered, the program will use a loop to output the member's expected fees for the next 10 years. The output format is a table with the corresponding year and membership fee.
The program should continue to loop until the user is ready to quit. I am supposed to encapsulate the code in a do-while loop.
If a 4 is entered then the program should quit. Any other input should show an error message as output.
My output is not starting at the basevalue of 1200 but factors in the percentage. Upon another iteration of the program the last value calculated is used as a starting point.
This is what I have:
//Assignment 4-A.cpp: The program will calculate the membership fees over the next 10 years based on the membership level
#include <iostream>
#include <iomanip>
using namespace std;
int main() // Driver program
{
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
//To hold menu choice
const int GOLD = 1,
SILVER = 2,
BRONZE = 3,
QUIT = 4;
//To hold the percentage tax of the different gym choices
const double tax_gold = .01,
tax_silver = .02,
tax_bronze = .04;
//To hold the base charge per year
const double base_charge = 1200.00;
//variables
double fees = 0, cost = base_charge, cost_1 = 1200.00;
//To hold the users input
int user_input;
const int min_number = 1,
max_number = 10;
int i;
do
{
cout << "\t Welcome to Ronda's Strikeforce Gym!!" << endl; //Title
cout << "x";
for (int i = 0; i <= 50; i++) //Dashed line, row
{
cout << ("-");
}
cout << "x";
cout << endl;
cout << "\t Membership Fee Calculation" << endl; //Title
//Display of gym membership plan choice
cout << "1. Gold" << endl;
cout << "2. Silver" << endl;
cout << "3. Bronze" << endl;
cout << "4. Quit" << endl << "\n";
cout << "Please enter your membership level (1-3 Enter 4 to Quit) ";
cin >> user_input;
cout << endl;
// Validate user input(must input 1 through 4), loop if value is invalid
while (user_input < 1 || user_input > 4)
{
cout << "Invalid entry! ";
cout << "Please enter a selection from 1 through 4: ";
cin >> user_input;
cout << endl;
}
// If values 1 - 3 were entered perform calculations else if 4 was entered exit program with thank you message.
// Perform calculation for specified membership for 10 years and output
if (user_input == 4)
{
break;
}
if (user_input != QUIT)
{
//Start selection loop and calculation
switch (user_input)
{
case 1:
fees = base_charge * tax_gold;
cost = base_charge + fees;
break;
case 2:
fees = base_charge * tax_silver;
cost = base_charge + fees;
break;
case 3:
fees = base_charge * tax_bronze;
cost = base_charge + fees;
break;
}
//Display Yearly Cost
for (int years = 1; years <= 10; ++years)
{
cout << "Year " << years << "\t $" << (cost_1 += fees) << endl;
}
cout << "\n";
}
} while (user_input != QUIT);
{
cout << "Thank you for using Ronda's Fee Calculator! \n";
}
cout << endl;
cout << "Press any key to continue . . .";
return 0;
}
This is what shows on my computer:
enter image description here
and this is what it should look like:
enter image description here
Thank you
Your calculations should start with the base rate (cost = 1200). For each year, print the current rate then add rate * tax. (cost += cost * tax).
Here's your code with a few modifications:
//To hold menu choice
const int GOLD = 1, SILVER = 2, BRONZE = 3, QUIT = 4;
//To hold the percentage tax of the different gym choices
const std::array<double, 3> tax_rates{.01, .02, .04};
//To hold the base charge per year
const double base_charge = 1200.00;
while (true) {
cout << "\t Welcome to Ronda's Strikeforce Gym!!\nx"; //Title
for (int i = 0; i <= 50; i++) //Dashed line, row
{
cout << ("-");
}
cout << "x\n\t Membership Fee Calculation\n"; //Title
//Display of gym membership plan choice
cout << "1. Gold" << endl;
cout << "2. Silver" << endl;
cout << "3. Bronze" << endl;
cout << "4. Quit" << endl << "\n";
cout << "Please enter your membership level (1-3 Enter 4 to Quit) ";
int user_input;
cin >> user_input;
cout << endl;
// Validate user input(must input 1 through 4), loop if value is invalid
while (user_input < 1 || user_input > 4)
{
cout << "Invalid entry! ";
cout << "Please enter a selection from 1 through 4: ";
cin >> user_input;
cout << endl;
}
// If values 1 - 3 were entered perform calculations else if 4 was entered exit program with thank you message.
// Perform calculation for specified membership for 10 years and output
if (user_input == QUIT)
{
break;
}
//Display Yearly Cost
double cost = base_charge;
for (int years = 1; years <= 10; ++years)
{
cout << "Year " << years << "\t $" << cost << endl;
cost += cost * tax_rates[user_input-1];
}
cout << "\n";
}
cout << "Thank you for using Ronda's Fee Calculator!\n\nPress any key to continue . . .";
Side note: it is recommended that you don't use floating point values for currency. FP can introduce rounding errors. You can use integers in the base denomination of the currency. In US dollars that would be cents (pennies). Just something to note for future projects.

C++ code for CS162 class isn't adding user inputs to the total

This code is designed to take an order, add that to the total_price variable, apply discounts based on the total price, then add a tip and echo all the information back to the user.
For some reason when I run the code, it isn't taking input from the user. I think it's related to the while statement but it outputs that my total_price is 0 after entering integers.
The tip calculation at the bottom isn't working correctly. It prompts the user to enter a tip value, but then skips to the end and says the final total is 0, without the user being able to enter any tip.
Thanks so much for the help!!
#include <iostream>
using namespace std;
int main()
{
int total_price{0}; // This variable will contain the price for all orders
int tip{0};
int discount_total{0};
int tip_total = tip + discount_total;
cout << "Welcome!\nThis program is designed to help take your order.\n";
cout << "Our discounts availible today are: \n10 percent off orders over $50, and 5 percent off orders between $25 and $50.\n";
// This is where the user is prompted to enter the price of their order
cout << "Please enter the price of your item: ";
cin >> total_price;
// No negative numbers will be accepted
if (total_price <= 0)
{
cout << "Invalid number, please re-enter the price of your item: ";
}
// User can continue ordering unless typing No
while (total_price > 0)
{
cout << "Is there anything else? If not type No: ";
cin >> total_price;
}
// Once the user types No, it brings them to the tip section
// Marks the end of the order
if ("No")
{
cout << "Thank you. Your total price is " << total_price << endl;
}
// Discount modifications
if (total_price >= 50)
{
discount_total = total_price * .05;
cout << "Your new total is " << discount_total << " with the 10 percent discount.\n";
}
else if (total_price >= 25 && total_price <= 50)
{
discount_total = total_price * .05;
cout << "Your new total is " << total_price << " with the 5 percent discount.\n";
}
else
{
total_price = discount_total;
cout << "Your total is the same, " << total_price << "\n";
}
// Tip calculation
cout << " Feel free to add a tip! Please enter here: ";
cin >> tip;
if (tip > 0)
{
cout << "Your final total is: " << tip_total << " dollars";
}
else if (tip < 0)
{
cout << "Your tip is invalid, please enter a valid tip: ";
}
return 0;
}

expected 'while' or expected '}' Answered before yes, but I can't fix it myself

I have already checked all the other questions but I just can't fix it.. I am a nuub at coding.
I don't know why it says it needs a while or where to put it, and it gives the wrong answer for the LOCS function also is there anything i can do about the default pointer warning. this is just a start i will be extending this later so it would be a big help and i have tried while and closing brackets everywhere lol
Btw if anyone can tell me how I can use the input as decision as you can see I am using 1 and 2, but If I could use permanent and casual that would be great.
// Calculate an employee's weekly salary
// Use a do while loop, and an if else statement to have user input data and display the correct values
#include <iostream>
using namespace std;
void main()
{
//Declaring the constant variables
const double BONUS_RATE = 5.0;
//Declaring the variables
int hours;
int sales;
int Status;
string permanent, casual, Name, status, result, employee;
double rate, sale_bonus, netPay, gross;
//set decimal point to 2 positions
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
//Display name
cout << "Calculate an employee's weekly salary\n\n";
//Do while loop to get hourly rate
do {
cout << "Enter employee name: ";
cin >> Name;
cout << "Please enter 1 if employee is permanent or 2 if casual: ";
cin >> Status;
Status = 0;
while (Status < 1 || Status > 2);
if (Status = 1)
{
cout << "Permanent employees have a fixed salary of $1000 per week" << endl;
sales = 0;
(sales < 1 || sales > 10);
cout << "If any please enter how many sales employee made this week:";
cin >> sales;
sale_bonus = sales * BONUS_RATE;
netPay = 1000 + sale_bonus;
cout << endl;
cout
<< "Hours Worked: \t" << hours << endl
<< "Gross Pay: \t" << gross << endl
<< "Net Pay \t" << netPay << endl;
}
else if (Status = 2) {
cout << "Casual employee's hourly rate is $15";
rate = 15.00;
cout << endl;
//while loop for hours
hours = 0;
while (hours < 1 || hours > 60)
{
cout << "Please enter how many hours you have worked this week:" << endl;
cout << "Minimum hours is 1" << endl;
cout << "Maximum hours are 60" << endl;
cout << "Enter hours worked: ";
cin >> hours;
}
//while loop for bonus
sales = 0;
while (sales < 1 || sales > 10)
{
cout << "Please enter how many sales you made this week:";
cin >> sales;
}
//Calculate pay
gross = hours * rate;
sale_bonus = sales * BONUS_RATE;
netPay = gross + sale_bonus;
//Display the results
cout << endl
<< "Hourly Rate: \t" << rate << endl
<< "Hours Worked: \t" << hours << endl
<< "Gross Pay: \t" << gross << endl
<< "Net Pay \t" << netPay << endl;
}
}
}
#include <iostream>
using namespace std;
void main()
{
//Declaring the constant variables
const double BONUS_RATE = 5.0;
//Declaring the variables
int hours;
int sales;
int Status;
string permanent, casual, Name, status, result, employee;
double rate, sale_bonus, netPay, gross;
//set decimal point to 2 positions
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
//Display name
cout << "Calculate an employee's weekly salary\n\n";
//Do while loop to get hourly rate
do {
cout << "Enter employee name: ";
cin >> Name;
cout << "Please enter 1 if employee is permanent or 2 if casual: ";
cin >> Status;
} while (Status < 1 || Status > 2); // add while after do block with }
if (Status == 1)// use '==' equality check not '=' .
{
cout << "Permanent employees have a fixed salary of $1000 per week" << endl;
sales = 0;
(sales < 1 || sales > 10);
cout << "If any please enter how many sales employee made this week:";
cin >> sales;
sale_bonus = sales * BONUS_RATE;
netPay = 1000 + sale_bonus;
cout << endl;
cout
<< "Hours Worked: \t" << hours << endl
<< "Gross Pay: \t" << gross << endl
<< "Net Pay \t" << netPay << endl;
}
else if (Status == 2) { // use '==' equality check not '=' .
cout << "Casual employee's hourly rate is $15";
rate = 15.00;
cout << endl;
//while loop for hours
hours = 0;
while (hours < 1 || hours > 60)
{
cout << "Please enter how many hours you have worked this week:" << endl;
cout << "Minimum hours is 1" << endl;
cout << "Maximum hours are 60" << endl;
cout << "Enter hours worked: ";
cin >> hours;
}
//while loop for bonus
sales = 0;
while (sales < 1 || sales > 10)
{
cout << "Please enter how many sales you made this week:";
cin >> sales;
}
//Calculate pay
gross = hours * rate;
sale_bonus = sales * BONUS_RATE;
netPay = gross + sale_bonus;
//Display the results
cout << endl
<< "Hourly Rate: \t" << rate << endl
<< "Hours Worked: \t" << hours << endl
<< "Gross Pay: \t" << gross << endl
<< "Net Pay \t" << netPay << endl;
}
}
I have made the suitable changes :
Use == to check equality instead of = operator!
Syntax of do while : do { //code... } while(condition).
The while must follow the do after closing the block!
Your Mistake
the main mistake is you have not close the do while loop, ask in comment for more clarification!
PS. I recommend you first copy my code and then run, and then analyse the issue!
Use this code this will work
#include
using namespace std;
void main()
{
//Declaring the constant variables
const double BONUS_RATE = 5.0;
//Declaring the variables
int hours;
int sales;
int Status;
string permanent, casual, Name, status, result, employee;
double rate, sale_bonus, netPay, gross;
//set decimal point to 2 positions
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
//Display name
cout << "Calculate an employee's weekly salary\n\n";
//Do while loop to get hourly rate
while(1){
cout << "Enter employee name: ";
cin >> Name;
cout << "Please enter 1 if employee is permanent or 2 if casual: ";
cin >> Status;
Status = 0;
while (Status < 1 || Status > 2);
if (Status = 1)
{
cout << "Permanent employees have a fixed salary of $1000 per week" << endl;
sales = 0;
(sales < 1 || sales > 10);
cout << "If any please enter how many sales employee made this week:";
cin >> sales;
sale_bonus = sales * BONUS_RATE;
netPay = 1000 + sale_bonus;
cout << endl;
cout
<< "Hours Worked: \t" << hours << endl
<< "Gross Pay: \t" << gross << endl
<< "Net Pay \t" << netPay << endl;
}
else if (Status = 2) {
cout << "Casual employee's hourly rate is $15";
rate = 15.00;
cout << endl;
//while loop for hours
hours = 0;
while (hours < 1 || hours > 60)
{
cout << "Please enter how many hours you have worked this week:" << endl;
cout << "Minimum hours is 1" << endl;
cout << "Maximum hours are 60" << endl;
cout << "Enter hours worked: ";
cin >> hours;
}
//while loop for bonus
sales = 0;
while (sales < 1 || sales > 10)
{
cout << "Please enter how many sales you made this week:";
cin >> sales;
}
//Calculate pay
gross = hours * rate;
sale_bonus = sales * BONUS_RATE;
netPay = gross + sale_bonus;
//Display the results
cout << endl
<< "Hourly Rate: \t" << rate << endl
<< "Hours Worked: \t" << hours << endl
<< "Gross Pay: \t" << gross << endl
<< "Net Pay \t" << netPay << endl;
}
}
}

input validation and overflow in c++

I'm writing a code that takes a user's input and calculates a discount based on how many units the user buys. Here is my problem; I want to use input validation to make sure the number entered is between 0 and 65535 (the max range for an unsigned int) but the way I have this program set up, if the user enters a number outside of this range I'm experiencing overflow/underflow and an incorrect number is stored in the variable before it ever even hits the if/else clauses. I'm new to C++ so please be kind. What can I do to check if this number is in the correct range when the user enters it. Also, is there a way to verify that the user has not entered a character other than a number?
Here is my code:
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
// display the instructions and inform the user of the discounts available
cout << " This software package sells for $99. Discounts are given according to the following list: \n";
cout << "----------------------------------" << endl;
cout << " Quantity\t\t Discount" << endl;
cout << "----------------------------------" << endl;
cout << " 10 - 19\t\t 20%" << endl;
cout << " 20 - 49\t\t 30%" << endl;
cout << " 50 - 99\t\t 40%" << endl;
cout << " 100 or more\t\t 50%" << endl;
cout << "----------------------------------" << endl;
cout << "\n\n";
const double price = 99.00;
unsigned short quantity; // variable to hold the user's quantity.
// shouldn't need more than 2 bytes for this (unsigned short)
cout << "How many units are sold?: ";
cin >> quantity;
double discount; // variable to hold the amount discounted
double total; // to hold the total sales price
cout << fixed << showpoint << setprecision(2); // set the display of numeric values
// calculate the discounted prices
if (quantity >= 1 && quantity <= 9) {
total = quantity * price; // calculate the total without a discount
cout << "There is no discount for this order \n";
cout << quantity << " units were sold at $" << price << " a piece for a total of " << total << endl;
cout << "\n";
}
else if (quantity >= 10 && quantity <= 19) {
discount = (quantity * price) * .20; // calculate the discount
total = (quantity * price) - discount; // calculate the total
cout << "There is a 20% discount \n";
cout << quantity << " units were sold at $" << price << " with a discount of 20% applied to the order. \n";
cout << "The total cost of the sale is $" << total << endl;
cout << "\n";
}
else if (quantity >= 20 && quantity <= 49) {
discount = (quantity * price) * .30; // calculate the discount
total = (quantity * price) - discount; // calculate the total
cout << "There is a 30% discount \n";
cout << quantity << " units were sold at $" << price << " with a discount of 30% applied to the order. \n";
cout << "The total cost of the sale is $" << total << endl;
cout << "\n";
}
else if (quantity >= 50 && quantity <= 99) {
discount = (quantity * price) * .40; // calculate the discount
total = (quantity * price) - discount; // calculate the total
cout << "There is a 40% discount \n";
cout << quantity << " units were sold at $" << price << " with a discount of 40% applied to the order. \n";
cout << "The total cost of the sale is $" << total << endl;
cout << "\n";
}
else if(quantity > 99 && quantity <= 65535) {
// the maximum number allowed in a short int is 65535. I is unrealistic that someone would order more
// units than that so this else if clause checks to make sure the number of ordered items is below this number
discount = (quantity * price) * .50; // calculate the discount
total = (quantity * price) - discount; // calculate the total
cout << "There is a 50% discount \n";
cout << quantity << " units were sold at $" << price << " with a discount of 50% applied to the order. \n";
cout << "The total cost of the sale is $" << total << endl;
cout << "\n";
}
else {
// the trailing else clause is used to catch any value for quantity that is 0 or below or any quantity
// bigger than what a short int can hold.
cout << "You entered an invalid quantity.\n";
cout << "Please enter a value greater than 0 or less than 65,535. \n\n";
}
system("pause");
return 0;
}
The final else clause is only executed when a value of 0 is entered. Here is an example of the output with a value outside the range
This software package sells for $99. Discounts are given according to the following list:
----------------------------------
Quantity Discount
----------------------------------
10 - 19 20%
20 - 49 30%
50 - 99 40%
100 or more 50%
----------------------------------
How many units are sold?: 65600
There is a 50% discount
52428 units were sold at $99.00 with a discount of 50% applied to the order.
The total cost of the sale is $2595186.00
Press any key to continue . . .
So in all honesty, I don't think this is a bad question.
It just deals with error checking whatever comes out of cin >> quantity.
Like described here: User Input of Integers - Error Handling, a way to handle this is to wrap the cin >> quantity with some error handling code like below.
if (cin >> quantity) {
// read succeeded
} else if (cin.bad()) {
// IO error
} else if (cin.eof()) {
// EOF reached (perhaps combined with a format problem)
} else {
// format problem
}
This will not take care of the integer overflows however, so a full solution would be to make quantity an int and use
cout << "How many units are sold?: ";
if (cin >> quantity) {
// read succeeded
// check for range
if (quantity < 0 || quantity > 65535) {
cout << "Number needs to be between 0 and 65535" << endl;
return -1;
}
} else if (cin.bad()) {
// IO error
cout << "Couldn't do a read from stdin :(" << endl;
return -1;
} else if (cin.eof()) {
// EOF reached (perhaps combined with a format problem)
cout << "Stdin gave EOF :(" << endl;
return -1;
} else {
// format problem
cout << "Encountered incorrect format" << endl;
return -1;
}

error expected expression on do while loop c++

I am not done with my code yet but so far I have a error, all the way in the bottom where I am trying to do my do while statement the first line
cout << "Please enter one of the following: \n"; says expected expression so it is not letting me run the code, help please?
#include <iostream>
using namespace std;
int main() {
int numTickets, options, count = 0;
double total, discount, costTicket = 10, discountPrice = .05;
char member;
cout << ":)\t Welcome to the Regal Entertainment Group Theater\t :)\n"
<< ":)\t ****The greatest movie theater in the world.****\t :)\n\n";
cout << "Please enter one of the following: \n";
cout << "1 - I want tickets to watch the movie!\n"
<< "2 - I'm out.\n";
cin >> options;
cout << "How many tickets will you need to watch your movie tonight? ";
cin >> numTickets;
cout << "Are you a member of our marvelous Regal Crown Club (Y/N)? ";
cin >> member;
if(numTickets <= 0)
cout << "Please enter a number greater than 0.";
else if(numTickets < 4)
costTicket = 10;
else if(numTickets >= 5)
costTicket = 8;
if(member == 'Y' || member == 'y')
{
discount = costTicket * numTickets * discountPrice;
total = numTickets * costTicket - discount;
cout << "Your total for the movie tickets is going to be: ";
cout << "$" << total << endl;
cout << "You saved $" << discount << endl;
cout << "You can pick up your free small popcorn at the stand.\n";
cout << "Thanks for coming to watch your movie at Regal Entertainment Group!\n";
}
else
{
total = numTickets * costTicket;
cout << "Your total for the movie tickets is going to be: ";
cout << "$" << total << endl;
cout << "Thanks for coming to watch your movie at Regal Entertainment Group!\n";
}
system("cls");
do
{
cout << "Please enter one of the following: \n";
cout << "1 - I want tickets to watch the movie!\n";
cout << "2 - I'm out.\n";
cin >> options;
}while(options != 2);
return 0;
}