create two subclasses called outpatient and inpatient which inherit from the patient base class
class Patient
{
String First_Name;
String Last_Name;
String DOB;
String Age;
Patient(String f_Name, String l_Name, String d, String ag)
{
First_Name = f_Name;
Last_Name = l_Name;
DOB=d;
Age=ag;
}
void Display()
{
System.out.println("First Name : " + First_Name);
System.out.println("Last Name : " + Last_Name);
System.out.println("Date of Birth : " + DOB);
System.out.println("Age : " + Age);
}
}
class OutPatient extends Patient
{
int id;
String Phone_Number;
String Doctor_name;
OutPatient(int i, String f_Name, String l_Name, String d,String ag,
String ph, String dr )
{
super(f_Name,l_Name,d,ag);
id = i;
Phone_Number=ph;
Doctor_name = dr;
}
void Display()
{
super.Display();
System.out.println("ID : " + id);
System.out.println("Phone Number : " + Phone_Number);
System.out.println("Doctor Name : " + Doctor_Name);
}
}
class InPatient extends Patient
{
String visitReason;
String Admission_diagnosis;
String Discharge_diagnosis;
String Treatment;
int Number_of_Days;
InPatient(String f_Name, String l_Name,String d, String ag, String
reason, String a_dig, String d_dig, String treat,int days)
{
super(f_Name,l_Name,d,ag);
visitReason=reason;
Admission_diagnosis=a_dig;
Discharge_dignosis=d_dig;
Treatment=treat;
Number_of_Days=days;
}
void Display()
{
super.Display();
System.out.println("visitReason : " + visitReason);
System.out.println("Admission diagnosis : " +
Admission_diagnosis);
System.out.println("Discharge
diagnosis : " + Discharge_diagnosis);
System.out.println("Treatment : " + Treatment);
System.out.println("Number of Days:
" + Number_of_Days);
}
}
class InheritanceDemo
{
public static void main(String args[])
{
Patient p_Obj = new
Patient("Rayan","Miller","12/11/1989","30");
OutPatient o_Obj = new
OutPatient("1001","Ray","John","7/8/1985","34","0404-786987","Dr.
Ron Skate");
InPatient i_Obj = new
InPatient("Daniel","Martin","28/9/1989","30","Appendix","12/9/2019","20/9/2019","Minor
Surgery","8");
System.out.println("Patient :");
p_Obj.Display();
System.out.println("");
System.out.println("OutPatient :");
o_Obj.Display();
System.out.println("");
System.out.println("InPatient :");
i_Obj.Display();
}
}
create two subclasses called outpatient and inpatient which inherit from the patient base class
{C++} Create a base class called Person with a public member
function called sayHi which outputs “Hi, I am a person.” Create a
derived class called Student which inherits from the Person class
(public inheritance) and overwrites the sayHi function and outputs
“Hi, I am a student.” Create another derived class called
EngineeringStudent which inherits from the Student class (public
inheritance) and overwrites the sayHi function and outputs “Hi, I
am an engineering student.” In the main program, create a...
Language: C++
Create a class named 'Salesman' that shall inherit from a class
called 'Person' and will add various functionality. We will store
the following private variables specific to Warehouse:
. a std::vector of float values which indicate the monetary values of each sale made by this salesman . a std::string which stores that salesman's position title . a float which stores their commission percentage, i.e., the percentage of sales they receive as a paycheck . a float which stores...
Need help to create general
class
Classes Data Element - Ticket Create an abstract class called Ticket with: two abstract methods called calculateTicketPrice which returns a double and getld0 which returns an int instance variables (one of them is an object of the enumerated type Format) which are common to all the subclasses of Ticket toString method, getters and setters and at least 2 constructors, one of the constructors must be the default (no-arg) constructor. . Data Element - subclasses...
Create an abstract class called GeometricFigure. Each figure includes a height, a width. a figure type, and an area. Include an abstract method to determine the area of the figure. Create two subclasses called Square and Triangle. Create an application that demonstrates creating objects of both subclasses, and store them in an array.
TASK 1: Create class diagram for abstract class Shape. TASK 2: Create class diagrams for abstract subclasses TwoDimensionalShape and ThreeDimensionalShape which extend abstract superclassShape. TwoDimensionalShape contains method getArea, and ThreeDimensionalShape contains methods getArea and getVolume. TASK 3: Create class diagrams for concrete classes Circle, Square, Triangle, Sphere, Cube and Tetrahedron.
In Python a class can inherit from more than one class (Java does not allow this). The resulting class will have all the methods and attributes from the parent classes. Do the following: • Create a class called Person. In the class, define variables for storing date of birth, place of birth, and male/female attributes. In the class, define the constructor method, as well as methods for returning current values of the class attributes. • Create a class called Employee....
Create a base class and two derived classes. Also, create and call a member function named communicate() that behaves differently when called by each class. Create a single C++ project (and CPP source file) named animal_communication as follows: Into this source, type the source code for Program 15-16, "Program Output," in Section 15.6, "Polymorphism and Virtual Member Functions," in Ch. 15, "Inheritance, Polymorphism, and Virtual Functions," of Starting Out With C++ From Control Structures Through Objects. Run and debug the...
Create a class Circle with one instance variable of type double called radius. Then define an appropriate constructor that takes an initial value for the radius, get and set methods for the radius, and methods getArea and getPerimeter. Create a class RightTriangle with three instance variables of type double called base, height, and hypotenuse. Then define an appropriate constructor that takes initial values for the base and height and calculates the hypotenuse, a single set method which takes new values...
This is Java 0) Create a project called Lab2-Areas 1) Create a java class called Areas (do not include the main method in this class) 2) Create a method for the following: - areaCircle - areaSquare - areaTriangle - areaRectangle - areaTrapezoid 3) Create another class called CalculateAreas 4) Have the main method in this class. Instantiate/Construct the Area object 5) Initialize variables for the appropriate sides (base, height, etc.) 6) Initialize variables for the 5 areas from the Area...