Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Find the Bugs (5 bugs) // A Patient class is used by a doctor\'s office. // The

ID: 3769502 • Letter: F

Question

Find the Bugs (5 bugs)

// A Patient class is used by a doctor's office.

// The Patient class has two overloaded constructors:

// 1) a default constructor,

// 2) one that requires an ID number, first and last name.

// A demonstration program declares two Patient objects

// and displays each patient's data fields.

start

Declarations

Patient patient1()

Patient patient2("234", "Lee", "Lydia")

patient1.display()

patient2.display()

stop

class Patient

Declarations

private string idNum

private string lastName

private string firstName

public Patient()

  idNum = "0000"

  lastName = "XXXX"

  firstName = "XXXX"

return

public Patient(string id, string last, string first)

  idNum = idNum

last = last

  firstName = first

return

public void display()

output "Patient #", id, lastName, firstName

return

end

Explanation / Answer

startDeclarationsPatient patient1Patient patient2("234", "Lee", "Lydia")patient1.display()patient2.display()stopDEBUG 11-02// This file defines the Building class

Programming Logic and Design, 8eSolutions 11-36// and the Hotel class that inherits from it.// A demonstration program declares and uses a Hotel object.class BuildingDeclarationsprivate string streetAddressprivate num squareFeetpublic string getAddress()return streetAddresspublic num getSquareFeet()// getSquareFeet() is a num methodreturn squareFeetpublic void setSquareFeet(num feet)// setSquareFeet() requires a parametersquareFeet = feetreturnpublic void setStreetAddress(string address)streetAddress = address// assign parameter to fieldreturnendClassclass Hotel inheritsFrom BuildingDeclarationsprivate num numberOfRoomspublic Hotel(string address, num sqFt, num rooms)setStreetAddress(address)// must use set method to set addresssetSquareFeet(sqFt)// must use set method to set square feetnumberOfRooms = roomsreturnpublic num getNumberOfRoomsreturn numberOfRoomsendClassstartDeclarationsHotel hotel("100 Main Street", 8000, 20)output hotel.getAddress(), hotel.getSquareFeet(),hotel.getNumberOfRooms()// must use object with each method call

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote