Professional Documents
Culture Documents
Q1)
class Body
{
private String name;
private double mass;
public Body(String n, double m)
{
//initialize the data members of the current object using the parameters.
}
public void display()
{
//Details of a body are displayed in the following format.
//Name: Body Name
//Mass: ... Kg
}
public double getMass()
{
//Mass of the current body is returned.
}
}
Q2:
Q3:
Q5:
Q6: