Computer Science
Related Questions
What do you mean by Abstract class?
In what way is a class helpful in creating a user defined data type?
Design a class 'Time' with the following specifications:
class Time
Data members/Instance variables
int hour, min, secMember Methods:
void gettime( ) : to accept a time in hour, minute and second. void showtime( ) : to display the time in terms of hour, minute and second.Write a main method to create an object of class 'Time' and call the member methods.
Design a class 'Rectangle' with the following specifications:
class Rectangle
Data members/Instance variables
int length, breadth, area, perimeterMember methods:
void input( ) : to accept length and breadth of a rectangle.
void calculate( ) : to calculate area and perimeter of rectangle.
void display( ) : to print area and perimeter of rectangle.Write a main method to create an object of class 'Rectangle' and call the member methods.