Void Regular (Float, Float) Void Premium (Float, Float) Int Main

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

#include <iostream.h> #include <conio.

h> void Regular (float,float); void Premium (float,float); int main () { int a; float b,c,d; char servCode; cout <<"\n Please enter your account number "; cin >> a; cout <<"\n R : Regular \n P : Premium \n Please enter the Service type that you are using :" ; cin >>servCode; if (servCode == 'R'){ cout << " \n Please enter the total minutes of service you used : " ; cin >> b;} else if (servCode == 'P') { cout << "\n Please enter the total minutes of service used during the day : "; cin >> c; cout << "\n Please enter the total minutes of service used during the night "; cin >> d;} if (servCode == 'R'){ Regular (b,0.2); } else if(servCode == 'P'){ Premium (c,d);} else{ cout << "\n You have made invalid option"; } cout << "\n Account number : " << a; if (servCode == 'R'){ cout << " \n Type of service : Regular ";} else if (servCode == 'P'){ cout << "\n Type of service : Premium " ;} if (servCode == 'R'){ cout << " \n Total minutes used of service : " << b;} else if (servCode == 'P'){ cout << "\n Total minutes used of service during the day : "<< c; cout << "\n Total minutes used of service during the night :" << d;} getche (); return 0; }

void Regular (float x, float y) { float total; total = 10 + (x*y); cout << "\n Total amount due : RM " << total; return; } void Premium(float p, float q) { float total; total = 25 +(p* 0.1) + (q*0.05); cout << "\n Total amount due : RM return; }

" << total;

You might also like