For some reason the program is not reading the if and else statements. Please help
The assignment:
Assignment:
The city zoo charges the fees shown in the table below.
General Admission Price
Adult $18.00
Child (age 5 to 13) (Under 5 years of age: free) $7.50
Extra Events
Train ride (per person) $6.00
Bird show (per person) $5.00
Zoo members are entitled to free admission for all family members, as well as up to two guests. Members and all their guests receive a 50% price break on the train ride and bird show.
You have been contracted to write a C++ program to calculate the correct fees (using the information above), based on an appropriate dialog with the customer. Your assignment is to develop in C++ a non-graphical (non-GUI) version of a fee calculator, which should ask exactly the same questions, in the same sequence, and produce exactly the same results as the example dialogs below. Note that the examples below are just that – only examples. Your program should be designed to calculate the correct fee for any set of valid inputs. The text in red italic is an example of what could be input from the user. Everything else is output by your program.
This is what I have so far:
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;
int main ()
{
char reply;
double numAdults;
double numChildren;
char fMembership;
double trainTickets;
double birdTickets;
double totalPrice;
double adultTotal;
double childTotal;
double adultGuests;
double childGuests;
const double adultPrice = 18.00;
const double childPrice = 7.50;
const double trainPrice = 6.00;
const double birdPrice = 5.00;
cout << "Welcome to Bill White's Fee Calculator " << endl;
cout << "How many adults (age 14 or over) are in your party? ";
cin >> numAdults;
cout << "How many children (age 5 to 13) are in your party? ";
cin >> numChildren;
cout << "Do you have a family membership? (y/n): ";
cin >> fMembership;
if (fMembership == 'y' || 'Y'){
cout << "How many adults in your party are guests? ";
cin >> adultGuests;
cout << "How many children (age 5 to 13) in your party are guests? ";
cin >> childGuests;
if (adultGuests > 2){
adultTotal = (adultGuests - 2) * adultPrice;
childTotal = childGuests * childPrice;}
else {
adultTotal = 0;
childTotal = 0;}
cout << "How many train tickets would you like? ";
cin >> trainTickets;
cout << "How many bird show tickets would you like? ";
cin >> birdTickets;
totalPrice = adultTotal + childTotal + (trainTickets * (.5 * trainPrice)) + (birdTickets * (.5 * birdPrice));
}
else (fMembership == 'n' || 'N'); {
cout << "How many train tickets would you like? ";
cin >> trainTickets;
cout << "How many bird show tickets would you like? ";
cin >> birdTickets;
totalPrice = (numAdults * adultPrice) + (numChildren * childPrice) + (trainTickets * trainPrice) + (birdTickets * birdPrice);
}
cout << "Your total fee is $" << totalPrice << endl;
cout << "Thank you for using Bill White's Fee Calculator" << endl;
cout << "Press q (or any other key) followed by 'Enter' to quit: ";
cin >> reply;
return 0;
}
These are some examples the teacher gave us:
Example #1
Welcome to John Doe’s Fee Calculator
How many adults (age 14 or over) are in your party? 3
How many children (age 5 to 13) are in your party? 1
Do you have a family membership? (y/n): n
How many train tickets would you like? 4
How many bird show tickets would you like? 2
Your total fee is $95.50
Thank you for using John Doe’s Fee Calculator
Example #2
Welcome to John Doe’s Fee Calculator
How many adults (age 14 or over) are in your party? 3
How many children (age 5 to 13) are in your party? 5
Do you have a family membership? (y/n): y
How many adults in your party are guests? 1
How many children (age 5 to 13) in your party are guests? 3
How many train tickets would you like? 0
How many bird show tickets would you like? 2
Your total fee is $20.00
Thank you for using John Doe’s Fee Calculator
Example #3
Welcome to John Doe’s Fee Calculator
How many adults (age 14 or over) are in your party? 1
How many children (age 5 to 13) are in your party? 2
Do you have a family membership? (y/n): y
How many adults in your party are guests? 0
How many children (age 5 to 13) in your party are guests? 0
How many train tickets would you like? 0
How many bird show tickets would you like? 2
Your total fee is $5.00
Thank you for using John Doe’s Fee Calculator
Example #4
Welcome to John Doe’s Fee Calculator
How many adults (age 14 or over) are in your party? 10
How many children (age 5 to 13) are in your party? 8
Do you have a family membership? (y/n): y
How many adults in your party are guests? 5
How many children (age 5 to 13) in your party are guests? 3
How many train tickets would you like? 5
How many bird show tickets would you like? 5
Your total fee is $104.00
Thank you for using John Doe’s Fee Calculator
Design Considerations
Your program is only expected to calculate the charge for a single group of people each time you use it. We have not studied loops yet, so you are not expected to use one.
Of course, the name “John Doe” in the welcome line and “Thank you” line should be replaced with your name.