0% found this document useful (0 votes)
41 views4 pages

Using Namespace Void Char Float Void Void Int: //user Enter 1/2

The document contains code for a cinema purchasing system program. The program allows the user to select purchasing tickets or food/drinks, then selects items and quantities to calculate a total price. It checks if the user is a member to apply any discounts before collecting payment and calculating change. Functions are defined to handle movie and food/drink ordering, member discounts, and the main program flow.

Uploaded by

Mirah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views4 pages

Using Namespace Void Char Float Void Void Int: //user Enter 1/2

The document contains code for a cinema purchasing system program. The program allows the user to select purchasing tickets or food/drinks, then selects items and quantities to calculate a total price. It checks if the user is a member to apply any discounts before collecting payment and calculating change. Functions are defined to handle movie and food/drink ordering, member discounts, and the main program flow.

Uploaded by

Mirah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

include <iostream>

using namespace std;


void calculate_member(char member, float total_price);
void movie () ;
void food_and_drink();
int main()
{
cout<<"Wellcome to 3125 Cinema Purchasing System!!!!!"<<endl;
cout<<"Enter 1 - Purchasing Ticket"<<endl;
cout<<"Enter 2 - Food And Drink Order"<<endl;
cout<<"Please Enter the Number:";
//user enter 1/2
int system=0;

cin>>system;
if (system==1){
movie();
}
else if (system==2){
food_and_drink();

//calling funciton

//calling function

}
return 0;
}
void calculate_member(char member, float total_price)
{
float memberdiscount=0, netprice=0, payment=0, change=0;
if (member == 'Y')
{
cout<<"SUB Total:RM "<<total_price<<endl;
memberdiscount = total_price * 15 / 100; //member got 15% discount
cout<<"Member discount: RM "<<memberdiscount<<endl;
netprice = total_price - memberdiscount;
cout<<"Net Price: RM:"<<netprice<<endl;
cout<<"Payment: RM";
cin>>payment;

}
else
{

change = payment - netprice;


cout<<"Change :RM"<<change<<endl;

cout<<"SUB Total:RM "<<total_price<<endl;


netprice = total_price;
cout<<"Net Price: RM:"<<netprice<<endl;

cout<<"Payment: RM";
cin>>payment;
change = payment - netprice;
cout<<"Change :RM"<<change<<endl;
}

void movie ()
{
struct movie{
char name_movie[30];
float price_movie;
int quantity_movie;
}movie[4]={{"DeepWater Horizon", 13.90},
{"Don't Breathe""\t",
16.90},
{"Stroks""\t""\t",
15.90},
{"Munafik""\t""\t",
11.90}};
cout<<"List Movie"<<endl;
for (int i = 0; i<4; i++){
int x = i+1;

cout<<"Number:"<<x<<"\t";
cout<<movie[i].name_movie<<"\t";
cout<<movie[i].price_movie<<endl;
}
int selectnumber;
int movieDeep=0, movieBreath=0, movieStroks=0, movieMunafik=0;
float price=0 , total_price;
int quantity;
char addition;
do{
cout<<"Please enter the number:";
cin>>selectnumber;
cout<<"Please enter quantity of tickets:";
cin>>quantity;
switch(selectnumber){
case 1:
{
price = price + 13.90;
total_price = price * quantity ;
break;
}
case 2:
{

price = price + 16.90;


total_price = price * quantity ;
break;
};
case 3:
{
price = price + 15.90;
total_price = price * quantity ;
break;
};
case 4:
{
price = price + 11.90;
total_price = price * quantity ;
break;
};
};
cout<<"Total Price: RM"<<total_price<<endl;
cout<<"Movie addition?(Y/N):";
cin>>addition;
}while (addition == 'Y');
char member;
cout<<"Do you a member?(Y/N):";
cin>>member;
calculate_member(member,total_price);

void food_and_drink()
{
struct food_and_drink{
char name_food_drink[30];
float price_food_drink;
int quantity_food_drink;
}movie[3]={{"Pop Corn",
4.90},
{"Cocacola",
3.60},
{"Burger""\t", 6.90}};
cout<<"List Food And Drink"<<endl;
for (int i = 0; i<3; i++){
int x = i+1;

cout<<"Number:"<<x<<"\t";
cout<<movie[i].name_food_drink<<"\t";
cout<<movie[i].price_food_drink<<endl;
}
int selectnumber;
int food_PopCorn=0, drink_CocaCola=0, food_Burger=0;
float price=0, total_price=0;
int quantity;

char addition;
do{
cout<<"Please enter the number:";
cin>>selectnumber;
cout<<"Please enter quantity of food and drink:";
cin>>quantity;
switch(selectnumber){
case 1:
{
price = price + 4.90 ;
total_price = price * quantity ;
break;
}
case 2:
{
price = price + 3.60 ;
total_price = price * quantity ;
break;
};
case 3:
{
price = price + 6.90 ;
total_price = price * quantity ;
break;
};
}
cout<<"Total Price: RM"<<total_price<<endl;
cout<<"Food And Drink addition?(Y/N):";
cin>>addition;
}while (addition == 'Y');
char member;
cout<<"Do you a member?(Y/N):";
cin>>member;
calculate_member(member,total_price);
}

You might also like