Sei sulla pagina 1di 6

ANALYSIS

INPUT: char code,unicode;


string Weekday,Weekend;
float payment, Gtotal;
int student, total=0;
char answer='Y';

PROCESS

total=total + student;
Gtotal= Gtotal + calcPayment(code, unicode, student);

if(code== 'D' && unicode=='U')


{
payment=student*250;
}
else if(code== 'D' && unicode=='O')
{
payment=student*275;
}
else if(code== 'E' && unicode=='U')
{
payment=student*300;
}
else if(code=='E' && unicode=='O')
{
payment=student*325;

OUTPUT: Day
University
Number Of Person
Payment
Total number of registered people
Grandtotal
Display welcome
using namespace std;
#include<iostream>

void dispWelcome();
void inputData(char &code,char &unicode,int &student);
float calcPayment(char code,char unicode,int student);
void displayReceipt(char code,char unicode,int student,float payment);

int main()
{
char code,unicode;
string Weekday,Weekend;
float payment, Gtotal;
int student, total=0;
char answer='Y';

while(toupper(answer)!='N')
{
dispWelcome();
inputData(code,unicode,student);
payment=calcPayment(code,unicode,student);
displayReceipt(code,unicode,student,payment);

total=total + student;
Gtotal= Gtotal + calcPayment(code, unicode, student);

cout << " Do you want to continue ( y-yes, n-no ) ? : ";


cin>>answer;
}

cout<<endl;
cout<<"\nTotal number of registered people is "<<total<<endl;
cout<<"\nGrand total payment RM "<<Gtotal;
return 0;
}
void dispWelcome()
{
cout<<"\n Welcome to SPSS Workshop Payment System";
cout<<"\n______________________________________________";
}
void inputData(char &code,char &unicode,int &student)
{
cout<<"\n Enter The Day Code (D=Weekday or E=Weekend): ";
cin>>code;
cout<<"\n Enter The University Code (U=UiTM or O=Other Universities): ";
cin>>unicode;

cout<<"\n Enter The Number Of Participant";


cin>>student;
}
float calcPayment(char code,char unicode,int student)
{
float payment;
char D,O,E,U,Weekend,Weekday;

if(code== 'D' && unicode=='U')


{
payment=student*250;
}
else if(code== 'D' && unicode=='O')
{
payment=student*275;
}
else if(code== 'E' && unicode=='U')
{
payment=student*300;
}
else if(code=='E' && unicode=='O')
{
payment=student*325;
}
return payment;
}
void displayReceipt(char code,char unicode,int student,float payment)
{
string day, university;

if(code=='D')
day="Weekday";

else
day="Weekend";

if(unicode=='U')
university="UiTM";
else
university="Other university";

cout<<"\n Day : "<<day;


cout<<"\n University : "<<university;
cout<<"\n Number Of Person : "<<student;
cout<<"\n Payment : "<<payment;
}
Output screenshots:
Other sample :

Potrebbero piacerti anche