Chapter – 4. CLASSES AND OBJECTS

Ans:

class HOUSING
{
int REG_NO; char NAME[31];
char TYPE; float COS T;
public: void Read_Data( )
{
cout<<"\nEnter the House Registration Number: ";
cin>>REG_NO; cout<<"\nEnter the House Name: ";
gets(NAME); cout<<"\nEnter the House Type: ";
cin>>TYPE; cout<<"\nEnter the House Cost: ";
cin>>COST;
}
void Display()
{
cout<<"\nThe Registration Number of the House: "<<REG_NO;
cout<<"\nThe name of the House: "<<NAME;
cout<<"\nThe Type of the House: "<<TYPE;
cout<<"\nThe Cost of the House: "<<COST;
}
void Draw_Nos();
};
void HOUSING::Draw_Nos( )
{
//Dear Students, a test for you. Complete this member function.
}

2004:

2.b. Declare a class myfolder with the following specifications:

Private members of the class:

Filenames an array of strig of size[10][25]
(to represent all the names of files inside myfolder)
Availspace long
(to represent total number of bytes available in myfolder)
Usedspace long long
(to represent total number of bytes used in myfolder)

Public members of the class: Newfileentry() : A function to accept values of Filenames,
Availspace and Usedspace from user.
Retavailspace(): A function that returns the value of total
kilobytes available (1 kilobyte=1024 bytes)
Showfiles(): A function that displays the names of all the files in
myfolder