MENU
Question -

Define a class Hand set in C++ with the following description : Private members :
Make—of type string
Model—of type string
Price—of type long int
Rating—of type char
Public members:
Function Read_Data to read an object of Handset type.
Function Display( ) to display the details of an object of type Handset type.
Function RetPrice() to return the value of Price of an object of Handset type. 



Answer -

class Handset
 {
 private: 
char Make[20] ; 
char Model[20] ; 
long int Price;
 char Rating;    [1]
 public :
 void Read_Data( )
 {
 gets(Make); 
gets(Model);
 cin>>Price;  [1]
 cin>>Rating;
 }
 void Display()
 {
 puts (Make);    [1]
 puts(Model) ; 
cout<
cout<
 }
 long int RetPrice( )
 {
 return(Price);
 }
 };    [1]

Comment(S)

Show all Coment

Leave a Comment

Free - Previous Years Question Papers
×