Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

f

Mane
name
1:
2:
#include <iostream>
#include <cstring> to inibric:
3: using namespace std;
4:
5: int main() {
6:
7: char gender[10];
8: int waist;
9:
10: cout<<"Health Check for Men and Women Date: (26/11/2022)"<<endl;
11:
12: cout<<"Please insert your gender (M/F) = "; //read gender
13: cin>>gender;
14: cout<<endl;
15:
16: cout<<"Please enter your waist measurement in cm = "; //read waist
17: cin>>waist;
18: cout<<endl;
basedon & waist
gender
19:
20:
21:
//if read M x
display message
if (strcmp(gender,"M")==0) { a

22: f
contoh comments.
23: if (waist<37) {
24: cout<<"Low Risk"; ini
comment meetiade
25: }
26: else {
27:
28:
if (waist<40){
cout<<"Moderate risk"; maland. Ign simply
coments of kite tan
29: }
30: else {

faham
31: cout<<"High risk";
32: }
33: }
34: }
35:
36: //if read F
37: else if(strcmp(gender,"F")==0) {
38:
39: if (waist<31.5) {
40: cout<<"Low risk";
41: }
42: else if (waist<35){
43: cout<<"Moderate risk";
44: }
45: else {
46: cout<<"High risk";
47: }
48: }
49: //if error
50: else
51: cout<<"Invalid Code";
52:
53:
54: return 0;
55: }
data
invalid

outate
&
valid
for
screen
the rubric.
Follow comments. Should
1: #include <iostream> balki
2: #include <cstring>
pis
3:
4:
5:
using namespace std;

int main() {
Be a
meaningful
6:
7: //Declaration
8: int participant;
9: char pcode[2];
10: string pname;
11: float total, tax, netprice;
12:
13: //Title and date
14: cout<<"Bunga Raya Resort Package Picker Date:(29/11/2022)"<<endl<<endl;
15:
16: //Promp user
17: cout<<"Please Input the Package Code (F/C/M) : ";
18: cin>>pcode;
19:
20: cout<<endl;
21: cout<<"Please input number of participants : ";
22: cin>>participant;
23:
24: //Check user Input
25: if ( strcmp(pcode,"F")==0 ) {
26: pname="Family Day";
27:
28: if ( participant>=1 && participant<=100 ) {
29: total=50*participant;
30: }
31: else if ( participant>100 && participant<250 ) {
32: total=45*participant;
33: }
34: }
35: else if ( strcmp(pcode,"C")==0 ) {
36: pname="Conference";
37:
38: if ( participant>=1 && participant<=100 ) {
39: total=80*participant;
40: }
41: else if ( participant>100 && participant<=250 ) {
42: total=75*participant;
43: }
44: }
45: else if ( strcmp(pcode,"M")==0 ) {
46: pname="Meeting";
47:
48: if ( participant>=1 && participant<=25 ) {
49: total=35*participant;
50: }
51: else if ( participant>25 && participant<=150 ) {
52: total=25.5*participant;
53: }
54: }
55: else {
56: cout<<"Error Package Code!";
57: }
58:
59: //Calculate Net Price
60: tax=0.13*total;
61: netprice=total+tax;
62:
63: cout<<"\n\t\t\tBunga Raya Resort\t\t\t"<<endl;
64: cout<<"====================================================================="<<en
65: cout<<"PACKAGE CODE \t : "<<pcode<<endl;
66: cout<<"PACKAGE NAME \t : "<<pname<<endl;
67: cout<<"NUMBER OF PARTICIPANTS \t : "<<participant<<endl<<endl;
68: cout<<"TOTAL PRICE \t : RM"<<total<<endl;
69: cout<<"GOVERNMENT TAX \t : RM"<<tax<<endl;
70: cout<<"NET PRICE \t : RM"<<netprice<<endl;
71:
72:
73:
74: return 0;
75: }

screen
ontful?

You might also like