Problem

Visit www.myprogramminglab.com to complete select exercises online and get instant feedbac...

Visit www.myprogramminglab.com to complete select exercises online and get instant feedback.

Exercise

Give the definition of two classes, Patient and Billing, whose objects are records for a clinic. Patient will be derived from the class Person given in Programming Project. A Patient record has the patient’s name (inherited from the class Person) and primary physician of type Doctor defined in Programming Project A Billing object will contain a Patient object, a Doctor object, and an amount due of type double. Be sure your classes have a reasonable complement of constructors, accessor, and mutator methods, and suitably defined equals and toString methods. First write a driver program to test all your methods, then write a test program that creates at least two patients, at least two doctors, and at least two Billing records, and then prints out the total income from the Billing records.

Project 1

Visit www.myprogramminglab.com to complete select exercises online and get instant feedback.

Exercise

Create a class called Vehicle that has the manufacturer’s name (type String), number of cylinders in the engine (type int), and owner (type Person given next). Then, create a class called Truck that is derived from Vehicle and has the following additional properties: the load capacity in tons (type double since it may contain a fractional part) and towing capacity in pounds (type int). Be sure your class has a reasonable complement of constructors, accessor and mutator methods, and suitably defined equals and toString methods. Write a program to test all your methods.

The definition of the class Person follows. Completing the definitions of the methods is part of this programming project.

public class Person {private String name;public Person()public Person(String theName){…}public Person(Person theObject){…}public String getName(){…}public void setName(String theName){…}public String toString(){…}public boolean equals(Object other){…}}

Project 2

Visit www.myprogramminglab.com to complete select exercises online and get instant feedback.

Exercise

Give the definition of a class named Doctor whose objects are records for a clinic’s doctors. This class will be a derived class of the class SalariedEmployee given in Display. A Doctor record has the doctor’s specialty (such as "Pediatrician", "Obstetrician", "General Practitioner", and so forth; so use the type String) and office visit fee (use type double). Be sure your class has a reasonable complement of constructors, accessor, and mutator methods, and suitably defined equals and toString methods. Write a program to test all your methods.

Display

The Derived Class SalariedEmployee

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 7