My teacher asked me to Create two objects ( doctor , patient ) in billing class
ID: 3535608 • Letter: M
Question
My teacher asked me to Create two objects ( doctor , patient ) in billing class
can somebody help me :( to find the error !!
public class billing extends person
{
private Doctor Do ;
private patient P ;
public billing ()
{
super ();
this.Do = Do ;
this.P = P ;
}
public billing ( newpatient P , newDoctor Do )
{
Do = newDo ;
P = newP ;
}
public void setDo (newDo)
{
Do = newDo ;
}
public void setP (newP)
{
P = newP ;
}
public Doctor getDo ()
{
return Do ;
}
public patient getP ()
{
return P ;
}
public String toString()
{
String result = super.toString() + " The Billing " + Do+ " "+ P;;
return result;
}
}
Explanation / Answer
public class billing extends person
{
private Doctor Do ;
private patient P ;
public billing ()
{
super ();
this.Do = Do ; // here assignment is wrong.. Do is unknow variable
this.P = P ; // here assignment is wrong.. P is unknow variable
}
public billing ( patient newP , Doctor newDo )
{
Do = newDo ;
P = newP ;
}
public void setDo (Doctor newDo)
{
Do = newDo ;
}
public void setP (patient newP)
{
P = newP ;
}
public Doctor getDo()
{
return Do ;
}
public patient getP()
{
return P ;
}
public String toString()
{
String result = super.toString() + " The Billing " + Do+ " "+ P;;
return result;
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.