Question
write in java code.
oop.
i dont have its written code.
i have its output in the thrid picture and how the inheritance works with the second picture.
just need it in full written code and uni class will be.
jus need you to write the whole code for me as its an extra question which i need for my preparation of my exam.
Inheritance Do the following steps inside project “Uni”: 1. Add “Patient” class that inherits from class Person. 2. Add Custo
run: Welcome to Diagnostic Center Details of Patients Displaying Data LIITTYMINT Blood Type Name Age Phone Number ID Room No
Interface: Comparable Interface: Cloneable Interface: Measurable Person Inner classes: - PhoneNo BloodT Address Exception cla

add as you but it must be correct and similar to the question
0 0
Add a comment Improve this question Transcribed image text
Answer #1

java.util.Random;

//person class

class Person{

int phoneNo;

String bloodT;

String address;

public String getPhoneNo(){

return this.phoneNo;

}

public String getBloodT(){

return this.bloodT;

}

public String getAddress(){

return this.address;

}

public void setPhoneNo(int phoneNo){

this.phoneNo=phoneNo;

}

public void setBloodT(String bloodT){

this.bloodT=bloodT;

}

public void setAddress(String address){

this.address=address;

}

}

//doctor class

class Doctor{

}

//patient class inherting from person using extends

public class Patient extends Person{

Customer c;

List<Service> l=new ArrayList<>();

Doctor d;

//default constructor for child class patient

Patient(){

}

===========================================================================

Parameterized constructor

=============================================================================

Patient(Customer c, Doctor d, List<Service>l){

this.c=c;

this.d=d;

this.l=l;

}

============================================================================

copy constructor1

================================================================

Patient(Patient p){

super(); //INITIALIZES PARENT CLASS CONATRUCTOR

this.c=p.c;

this.l=p.l;

this.d=p.d;

}

//TOSTRING

public String toString(){

}

//TORAND

public void rand(){

Random rand = new Random();

int rand_int = rand.nextInt(1000);

System.out.println("Random Integers: "+rand_int);

}

public void equals(){

String myStr1 = "Hello";

String myStr2 = "Hello";

System.out.println(myStr1.equals(myStr2));

}

  

public void dash(){

String str ="Hello-there";

str= str.replace("\u2014", "");

}

public static void main(String []args){

//you can test your methods here

}

}

class Customer extends Person{

}

class Item{

}

class Service{

}

Add a comment
Know the answer?
Add Answer to:
write in java code. oop. i dont have its written code. i have its output in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Q 4(b) 6 Marks] Write the code for a single Java class of your own choice that demonstrates the use of the following features in the Java language: Method overloadingg The use of super and this Ident...

    Q 4(b) 6 Marks] Write the code for a single Java class of your own choice that demonstrates the use of the following features in the Java language: Method overloadingg The use of super and this Identify clearly where in your code each of these points is being demonstrated Q 4(c) [6 Marks] Write an abstract Student class in Java which has a name, id_number, year and programme_code as member variables. Add a constructor to your class and a display()...

  • program Java oop The project description As a programmer; you have been asked to write a...

    program Java oop The project description As a programmer; you have been asked to write a program for a Hospital with the following The Hospital has several employees and each one of them has an ID, name, address, mobile number, email and salary. . The employees are divided into Administration staff: who have in addition to the previous information their position. Nurse: who have their rank and specialty stored in addition to the previous o o Doctor: who have the...

  • Part 1: Use principles of inheritance to write code calculating the area, surface area, and volume...

    Part 1: Use principles of inheritance to write code calculating the area, surface area, and volume of rectangular objects. First, write an abstract super class RectangularShape, then write a subclass Rectangle that inherits from the super class to compute areas of rectangles, including squares if there is only one data. Finally, write another subclass Cuboid that inherits from its super class Rectangle above to compute surface areas and volumes of cuboids, including 3 equal sided cube. Must apply code-reusability in...

  • Write the following program in Java. Create an abstract Vehicle class - Vehicle should have a...

    Write the following program in Java. Create an abstract Vehicle class - Vehicle should have a float Speed and string Name, an abstract method Drive, and include a constructor. Create a Tesla class - Tesla inherits from Vehicle. - Tesla has an int Capacity. - Include a constructor with the variables, and use super to set the parent class members. - Override Drive to increase the speed by 1 each time. - Add a toString to print the name, speed,...

  • java. do it on eclipse. the same way its instructed Second Inheritance OOP assignment Outcome: ...

    java. do it on eclipse. the same way its instructed Second Inheritance OOP assignment Outcome:  Student will demonstrate the ability to understand inheritance Program Specifications: Programming assignment: Classes and Inheritance You are to pick your own theme for a new Parent class. You can pick from one of the following:  Person  Automobile  Animal  If you choose Person, you will create a subclass of Person called Student.  If you choose Automobile, you will create a...

  • In Java Which of the following statements declares Salaried as a subclass of payType? Public class...

    In Java Which of the following statements declares Salaried as a subclass of payType? Public class Salaried implements PayType Public class Salaried derivedFrom(payType) Public class PayType derives Salaried Public class Salaried extends PayType If a method in a subclass has the same signature as a method in the superclass, the subclass method overrides the superclass method. False True When a subclass overloads a superclass method………. Only the subclass method may be called with a subclass object Only the superclass method...

  • This is for Java Programming Please use comments Customer and Employee data (15 pts) Problem Description:...

    This is for Java Programming Please use comments Customer and Employee data (15 pts) Problem Description: Write a program that uses inheritance features of object-oriented programming, including method overriding and polymorphism. Console Welcome to the Person Tester application Create customer or employee? (c/e): c Enter first name: Frank Enter last name: Jones Enter email address: frank44@ hot mail. com Customer number: M10293 You entered: Name: Frank Jones Email: frank44@hot mail . com Customer number: M10293 Continue? (y/n): y Create customer...

  • Can you please pick Automobile For this assignment. Java Programming Second Inheritance OOP assignment Outcome: Student...

    Can you please pick Automobile For this assignment. Java Programming Second Inheritance OOP assignment Outcome: Student will demonstrate the ability to use inheritance in Java programs. Program Specifications: Programming assignment: Classes and Inheritance You are to pick your own theme for a new Parent class. You can pick from one of the following: Person Automobile Animal Based on your choice: If you choose Person, you will create a subclass of Person called Student. If you choose Automobile, you will create...

  • Write code in Java programming language. The ShoppingCart class will be composed with an array of...

    Write code in Java programming language. The ShoppingCart class will be composed with an array of Item objects. You do not need to implement the Item class for this question, only use it. Item has a getPrice() method that returns a float and a one-argument constructor that takes a float that specifies the price. The ShoppingCart class should have: Constructors: A no-argument and a single argument that takes an array of Items. Fields: • Items: an array of Item objects...

  • Please create two tests classes for the code down below that use all of the methods...

    Please create two tests classes for the code down below that use all of the methods in the Transaction class, and all of the non-inherited methods in the derived class. Overridden methods must be tested again for the derived classes. The first test class should be a traditional test class named "Test1" while the second test class should be a JUnit test class named "Test2". All I need is to test the classes, thanks! Use a package that contains the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT