Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q1) Create a Java project called Lab6-Q1. Inside this project create a class named Q1 with a main function. Also create a class named Patient.

Q1)

Create a Java project called Lab6-Q1. Inside this project create a class named "Q1" with a

main function. Also create a class named "Patient". The "Patient" class should have the

following instance variables:

private String name;

private double weight;

private int age;

The "Patient" class should have the following accessor methods:

public String getName() - returns the patient's name

public double getWeight() - returns the patient's weight

public int getAge() - return the patient's age

and the following method

public boolean patientEquals(Patient otherPatient) - Returns a true bool if the two patients are

identical. False otherwise

Create 3 instances of a patient. Make 2 of the 3 patients identical, and 1 patient unique.

In the main function use the Accessor methods to print the patients attributes. Then use the

patientEquals() to compare if the patients are identical or different and print the results.

Ex)

Standard Output: Patient 1: Ryan Tannehill is 220.0lbs and is 26 years old

Standard Output: Patient 2: Ryan Tannehill is 220.0lbs and is 26 years old

Standard Output: Patient 3: Jarvis Landry is 200.0lbs and is 25 years old

Standard Output: Ryan Tannehill is the same as Ryan Tannehill

Standard Output: Ryan Tannehill is different from Jarvis Landry

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions

Question

Determine miller indices of plane A Z a/2 X a/2 a/2 Y

Answered: 1 week ago