Can someone help me with this code

Community Hospital needs a program to compute and print a billing statement for each patient.
Charges for each day are as follows:
a. room charges: private (P) room = $125.00; semi-private (S) room = $95.00; or ward (W) = $75.00
b. telephone charge = $1.75
c. television charge = $3.50
Write a program to get data from the keyboard, compute the patient’s bill, and print an appropriate statement. Typical input (nut yours do not have to be identical to this) is the following:
How many days was the room occupied? 5
What type of room? P
Telephone used during the stay? N
Television used during the stay? Y

Keep in mind that the user needs to know that the input can be any integer number of days for the length of stay, either (P, S, or W) for the room type, and either (Y or N) for both telephone and television options.

A statement (which yours MUST be identical to) for the data given follows:

Community Hospital Patient Billing Statement

Number of days in hospital: 5
Type of room: Private
Room charge: $ 625.00
Telephone charge: $ 0.00
Television charge: $ 17.50

TOTAL DUE = $642.50
CAN SOMEONE PLEASE HELP ME.
You have no code to help with.

Forum sticky wrote:
Don't post homework questions
Those questions are for you to work out, so that you will learn from the experience. It is OK to ask for hints, but not for entire solutions.
Don't copy and past this. Learn from this!!!!Make changes to it to make it better. I hope this helped.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
community Hospital needs a program to compute and print a billing statement for each patient.
Charges for each day are as follows:
a. room charges: private (P) room = $125.00; semi-private (S) room = $95.00; or ward (W) = $75.00
b. telephone charge = $1.75
c. television charge = $3.50

*/
#include <iostream>
using namespace std;
void _private(){
	int enter;
	double bprivate=125;
	system("cls");
cout<<"Your Option :Private"<<endl<<endl;
cout<<"Was telephon used?\n";
cout<<"1)Yes\n2)No\n";
cin>>enter;
if(enter==1){bprivate+=1.75;}
cout<<"Was television used?\n";
cout<<"1)yes\n2)no\n";
cin>>enter;
if(enter==1){bprivate+=3.50;}
cout<<"Amount : $"<<bprivate;
cout<<endl;
cout<<endl;
system("pause");
}
void _semi_private(){
	int enter;
	double bprivate=95;
	system("cls");
cout<<"Your Option :Semi-Private"<<endl<<endl;
cout<<"Was telephon used?\n";
cout<<"1)Yes\n2)No\n";
cin>>enter;
if(enter==1){bprivate+=1.75;}
cout<<"Was television used?\n";
cout<<"1)yes\n2)no\n";
cin>>enter;
if(enter==1){bprivate+=3.50;}
cout<<"Amount : $"<<bprivate;
cout<<endl;
cout<<endl;
system("pause");
}
void ward(){
int enter;
	double bprivate=75;
	system("cls");
cout<<"Your Option :Ward"<<endl<<endl;
cout<<"Was telephon used?\n";
cout<<"1)Yes\n2)No\n";
cin>>enter;
if(enter==1){bprivate+=1.75;}
cout<<"Was television used?\n";
cout<<"1)yes\n2)no\n";
cin>>enter;
if(enter==1){bprivate+=3.50;}
cout<<"Amount : $"<<bprivate;
cout<<endl;
cout<<endl;
system("pause");
}

void main(){
	int room;
	cout<<"Made by Behzad Khoker--- \n||||||||||||||||||||||||\n||||||||||||||||||||||||\n||||||||||||||||||||||||\n||||||||||||||||||||||||\n||||||||||||||||||||||||\n||||||||||||||||||||||||\n";
	system("pause");
	do{
	system("cls");
	cout<<"Enter your room :\n";
	cout<<"1)Private \n2)semi-private\n3)ward\n4)Exit"<<endl;
	cin>>room;
	if (room==1){ _private();}//private 
	else if (room==2){_semi_private(); }//semi private
	else if(room==3){ ward();}//Ward
	else{exit(0);}//exit
	cout<<endl;
	cout<<endl;
	cout<<endl;
	}while(1);
	system("pause");
}
Last edited on
I'm really tempted to report... but I don't think it's against the rules.

Grumble grumble.
Topic archived. No new replies allowed.