Click here to Skip to main content
15,902,893 members

Comments by Choi Yoojung (Top 4 by date)

Choi Yoojung 28-Oct-21 12:55pm View    
Here is the full code:

void confirmBooking(Customer customer[], int size);

void displayConfirmBooking(vector<customer>customers){
cout << "Confirmed booking:\n";

for (int i=0; i < customers.size(); i++){
if (customers[i].isBooked()){
cout << customers[i].getName() << " is booked\n";
}
}
}

for (int i = 0; i < size; i++) {
if (customer[i].isBooked()) {

int main(){
const int SIZE = 2;
Customer customerList[SIZE];

Customer myObj;

vector<customer> customers;

for (int i=0; i<size; i++){
="" string="" name;
="" int="" age;
="" bool="" student="false;
" char="" answer;

="" cout="" <<="" "please="" enter="" name:="" ";
="" getline(cin,name);
="" age:="" cin="">> age;
cout << "Is student ID present? (y/n)";
cin >> answer;
answer = ::tolower(answer);
if (answer == 'y')
student = true;

Customer customer(name,age,student);
customerList[i] = customer;
cin.ignore(100,'\n');
cout << endl;
}

confirmBooking(customerList, SIZE);
customers.push_back(myObj);
displayConfirmBooking(customers);
return 0;
}

void confirmBooking(Customer customer[], int size){
const double TICKET_PRICE = 56.0;
const double MEAL_PRICE = 30.0;

for (int j=0; j<size; j++){
="" double="" tempticketprice,="" tempmealprice;

="" if="" (customer[j].ischild()){
="" tempticketprice="TICKET_PRICE" 2;
="" tempmealprice="MEAL_PRICE" }
="" else="" (customer[j].isstudent()){
="" *="" 0.9;
="" else{
="" 0.8;
="" }

="" cout="" <<="" customer[j].getname()="" "\n"="" <<
="" "ticket="" price:="" rm"="" "meal="" "total="" +="" endl;

="" char="" answer;
="" "confirm="" booking="" for="" "="" (y="" n)";
="" cin="">> answer;
answer = ::tolower(answer);

if (answer == 'y'){
customer[j].setBooked(true);
cout << "Booked\n\n";
}
else{
customer[j].setBooked(false);
cout << "Not booked\n\n";
}

}
}
Choi Yoojung 19-Oct-21 0:27am View    
oh I see, I will try to fix it thankyou for the solution !
Choi Yoojung 19-Oct-21 0:25am View    
i will try it out ! thanks!
Choi Yoojung 19-Oct-21 0:24am View    
ya but im not able to edit and reply that post not sure why, thats why i create the new one, really thankyou for the help appreciate it !