MENU
Question -

Define a class Seminarwith the following specification:
private members
Seminarld              long
Topic                        string of 20 characters
VenueLocation     string of 20 characters
Fee                           float

CalcFee() function tocalculate Fee depending on VenueLocation

VenueLocation

Fee

Outdoor

5000

Indoor Non-AC

6500

Indoor AC

7500

Public members
Register() function to accept values for SeminarlD, Topic, VenueLocation andcall CalcFee() to calculate Fee
ViewSeminar() function to display all the data members on the screen 

 



Answer -

class Seminar
 {
 private:
 long Seminarld; 
char Topic [20] ; 
char VenueLocation[20]; 
float Fee;
 void CalcFeeO    [1]
 {
 if    (strcmp    (VenueLocation, ''Outdoor'')==0)
 Fee=5000;
 else {if (strcmp (VenueLocation, ''Indoor Non-AC" ) = = 0)
 Fee=6500;
 else {if (strcmp (VenueLocation, ''Indoor AC'')==0)
 Fee = 7500;    [1]
 }
 public:
 void Register ()
 {
 cin>>seminarld; 
gets (Topic) ; 
gets (VenueLocation); 
cin>>Fee;
 CalcFee () ;
 } [1]
 Void ViewSeminar ()
 {
 cout<
puts (Topic); 
puts (VenueLocation); 
cout<
 }
 }; [1]

Comment(S)

Show all Coment

Leave a Comment

Free - Previous Years Question Papers
×