Here is the class type for persomType from chapter 12 So if

Here is the class type for persomType from chapter 12. So if u see chapter 12 it means u have to use this class. Please answer ques2 only

class PersonType{
public:
   void print() const;
   void setName(string first, string last);
   string getFirstName() const;
   string getLastName() const;
   PersonType(string first = \"\", string last = \"\");

private:
   string firstName;
   string lastName;


};

Solution

1a)

public class personType {
   String Fname;
   String Lname;
   personType(String Fname,String Lastname){
       setFname(Fname);
       setLname(Lname);
      
   }
   public String getFname(){
       return Fname;
   }
   public String getLname(){
       return Lname;
   }
   public void setFname(String Fname){
       this.Fname=Fname;
      
   }
   public void setLname(String Lname){
       this.Lname=Lname;
   }
   public void print(){
       System.out.println(\"Firstname is\"+Fname);
       System.out.println(\"Lastnama is\"+Lname);
   }

}

class doctorType extends personType
{
   String specality;
   doctorType(String Fname,String Lname,String specality){
       super(Fname,Lname);
       setspecality(specality);
   }
   public void setspecality(String specality){
       this.specality=specality;
   }
   public String getspecality(){
       return specality;
   }
   public void print(){
       System.out.println(\"Firstname is\"+Fname);
       System.out.println(\"Lastname is\"+Lname);
       System.out.println(\"specality is\"+specality);
   }
}

1 b)class patientType extends personType
{
   String id;
   int dob;
   int age;
   patientType(String Fname,String Lname,String id,int age,int dob){
       super(Fname,Lname);
       setid(id);
       setage(age);
       setdob(dob);
   }
   public void setid(String id){
       this.id=id;
   }
   public String getid(){
       return id;
   }
   public void setage(int age){
       this.age=age;
   }
   public int getage(){
       return age;
   }
   public void setdob(int dob){
       this.dob=dob;
      
   }
   public int getdob(){
       return dob;
   }
}

2nd))class billType{
   String Fname;
   String Lname;
   String id;
   int age;
   int dob;
   String dname;
   String dlname;
   String sp;
   int dfee;
   int medfee;
   int hospitalcharges;
   billType(String Fname,String Lname,String id,int age,int dob,String dname,String dlname,String sp,int dfee,int medfee){
       patientType pt=new patientType(Fname,Lname,id,age,dob);
       doctorType dt=new doctorType(dname,dlname,sp);
       this.dfee=dfee;
       this.medfee=medfee;
       hospitalcharges=dfee+medfee;
       int resul=gethospitalcharges();
       System.out.println(\"patient Fname is\"+Fname+\"Lname is\"+Lname+\"age is\"+age+\"dob is\"+dob
               +\"id is\"+id);
       System.out.println(\"docoter Fname is\"+dname+\"Lname is\"+dlname+\"speciality is\"+sp);
   }
   public int gethospitalcharges(){
       return hospitalcharges;
   }
}

public class testmain {
   public static void main(String[] args) {
       // TODO Auto-generated method stub
  
               billType bt=new billType(\"swar\",\"bang\",\"akdk\",24,1994,\"skakd\",\"kkdkd\",\"ddjd\");
           }
}

Here is the class type for persomType from chapter 12. So if u see chapter 12 it means u have to use this class. Please answer ques2 only class PersonType{ publ
Here is the class type for persomType from chapter 12. So if u see chapter 12 it means u have to use this class. Please answer ques2 only class PersonType{ publ
Here is the class type for persomType from chapter 12. So if u see chapter 12 it means u have to use this class. Please answer ques2 only class PersonType{ publ

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site