
Call 1800-123-2003
WAP for a cyber cafe,to input name of person visiting it and time he utilizes the internet services.Amount charges are as follows:- time charges per hour <=1 hr rs 10 upto 4 hr rs 15 upto 10 hr rs 20 >10 hr rs 30 1.)assume that cyber cafe allows entry of name till a name is entered as "000".count no of customers. 2.)total amount collected by the cafe at the end of a day when customer entry is stopped. |
This question has two parts,first part it is possible in C++Second part we need a database for storing the total amount and name entry of all the name in the cafe:#include <iostream> using namespace std; int calculateSec (int, int, int); int calculateTime (int, int); int main() { int totalseconds1 = 0; int totalseconds2 = 0; int hr1 = min1 = sec1 = 0; int hr2 = min2 = sec2 = 0; double dif; int amt; cout<<"Enter the first time: hr, min, sec:"<<endl; cin>>hr1>>min1>>sec1>>endl; cout<<"Enter the second time: hr, min, sec:"<<endl; cin>>hr2>>min2>>sec2>>endl; totalseconds1= calculateSec (int hour, int min1, int sec1) totalseconds2= calculateSec (int hr2, int min2, int sec2) time=calculateTime (int totalseconds1, int totalseconds2) diff=time/3600; if(diff<=1) amt=10; else if(diff<=4) amt=15; else if (diff<=10) amt=20; else amt=30; cout<<"Amount=:"<<amt; return 0; } { void calculateSec (hour,min,sec) hour = hr1 * 3600 min = min1 * 60 totalseconds1=hour+min } { void calculateTime( totalseconds1, totalseconds2) time=totalseconds2-totalseconds1; } |