Related questions
1. Create the main method using pythone to test the classes.
#Create the class personType
from matplotlib.pyplot import phase_spectrum
class personType:
#create the class constructor
def __init__(self,fName,lName):
#Initialize the data members
self.fName = fName
self.lName = lName
#Method to access
def getFName(self):
return self.fName
def getLName(self):
return self.lName
#Method to manipulate the data members
def setFName(self,fName):
self.fName = fName
def setLName(self,lName):
self.lName = lName
#Create the class Doctor Type inherit from personType
class doctorType(personType):
#Create the constructor for the doctorType class
def __init__(self, fName, lName,speciality="unknown"):
super().__init__(fName, lName)
self.speciality = speciality
#Methods to access
def getSpeciality(self):
return self.speciality
#Methods to manipulate
def setSpeciality(self,spc):
self.speciality = spc
#create the class billType
class billType():
#Create the constructor for the billType class
def __init__(self,pId, pCharges):
#Initialize the data members
self.pId = pId
self.pCharges = pCharges
#Methods to access
def getpId(self):
return self.pId
def getpChares(self):
return self.pCharges
#Methods to manipulate
def setpId(self,id):
self.pId = id
def setpCharges(self,charges):
self.pCharges = charges
#Create the class Datetype
class dateType():
#create the constructor by initializing the parameters
def __init__(self,pDob,dAdmitted,dDischarged):
self.pDob = pDob
self.dAdmitted = dAdmitted
self.dDischaged = dDischarged
#Create the class patientType inherited from personType
class patientType(personType):
#Create the constructor for the patientType class
def __init__(self, fName, lName,pId,pAge,pDob,phyfName,phylName,dAdmitted,dDischarged):
super().__init__(fName, lName)
self.pId = pId
self.pAge = pAge
#Store the date Info in the dateType class
self.dateInfo = dateType(pDob,dAdmitted,dDischarged)
#use the doctorType class to store the physician Name
self.doctorInfo = doctorType(phyfName,phylName)
#Methods for the manipulation and access
def getpId(self):
return self.pId
def getpAge(self):
return self.pAge
def getPhyfName(self):
return self.doctorInfo.getFName()
def getPhylName(self):
return self.doctorInfo.getLName()
def getdAdmitted(self):
return self.dateInfo.dAdmitted
def getdDischarged(self):
return self.dateInfo.dDischaged
def getdDob(self):
return self.dateInfo.pDob
def setpId(self,id):
self.pId = id
def setpAge(self,age):
self.pAge = age
def setpDob(self,Dob):
self.dateInfo.pDob = Dob
def setphyFName(self,fName):
self.doctorInfo.setFName(fName)
def setphyLName(self,lName):
self.doctorInfo.setLName(lName)
def setdAttended(self,date):
self.dateInfo.dAdmitted = date
def setdDischarged(self,date):
self.dateInfo.dDischaged = date
Step by stepSolved in 2 steps
- Convert the pseudocode into Python. 1. Pet ClassDesign a class named Pet, which should have the following fields:■しかく name: The name field holds the name of a pet.■しかく type: The type field holds the type of animal that a pet is. Example values are "Dog", "Cat", and "Bird".■しかく age: The age field holds the pet’s age.2. The Pet class should also have the following methods:■しかく setName: The setName method stores a value in the name field.■しかく setType: The setType method stores a value in the type field.■しかく setAge: The setAge method stores a value in the age field.■しかく getName: The getName method returns the value of the name field.■しかく getType: The getType method returns the value of the type field.■しかく getAge: The getAge method returns the value of the age field.3. Once you have designed the class, design a program that creates an object of the class and prompts the user to enter the name, type, and age of his or her pet. This data should be stored in the object. Use the...arrow_forwardPick the incorrect statement: O A class can implement more than one interface O A class can extend more than one classes O An interface can extend more than one interfaces O An interface cannot extend a classarrow_forwardDesign a class named Author with the following members: A field for the author’s name (a String) A field for the author’s year of birth (an int) One or more constructors and appropriate accessor and mutator methods A toString method that displays the author’s info as: Author: Mary Shelley (1797) Save the file as Author.java. Next, create an abstract class named Book with the following members: A field for the book title (a String) A field for the book author (a reference to an Author object) A field for the book price (a double) A constructor that requires the title and author Get methods for the title, author, and price An abstract method named setPrice A toString method that displays the book’s title, author’s info, and price as: Frankenstein Author: Mary Shelley (1797) Price: 23ドル.95 Save the file as Book.java. Create Fiction and NonFiction child classes of Book. Each must include a setPrice method that sets the price for all Fiction books to 23ドル.95 and for all NonFiction books...arrow_forward
- 14.23 LAB: Dean's list Students make the Dean's list if their GPA is 3.5 or higher. Complete the Course class by implementing the get_deans_list() instance method, which returns a list of students with a GPA of 3.5 or higher. The file main.py contains: . The main function for testing the program. Class Course represents a course, which contains a list of student objects as a course roster. (Type your code in here.) • Class Student represents a classroom student, which has three attributes: first name, last name, and GPA. (Hint: get_gpa() returns a student's GPA.) Note: For testing purposes, different student values will be used. Ex. For the following students: Henry Nguyen 3.5 Brenda Stern 2.0 Lynda Robison 3.2 Sonya King 3.9 the output is: Dean's list: Henry Nguyen (GPA: 3.5) Sonya King (GPA: 3.9)arrow_forwardclass Widget: """A class representing a simple Widget === Instance Attributes (the attributes of this class and their types) === name: the name of this Widget (str) cost: the cost of this Widget (int); cost >= 0 === Sample Usage (to help you understand how this class would be used) === >>> my_widget = Widget('Puzzle', 15) >>> my_widget.name 'Puzzle' >>> my_widget.cost 15 >>> my_widget.is_cheap() False >>> your_widget = Widget("Rubik's Cube", 6) >>> your_widget.name "Rubik's Cube" >>> your_widget.cost 6 >>> your_widget.is_cheap() True """ # Add your methods here if __name__ == '__main__': import doctest # Uncomment the line below if you prefer to test your examples with doctest # doctest.testmod()arrow_forward3. Design a user-defined class called Course. Each course object will hold data about a course. The data includes courseID, courseName, credits and instructorName. Define the instance variables required of the appropriate type. Provide only get methods along with toString() and equals() methods. Design another user-defined class called Student. Each student object will hold data on name, GPA and courseList. Make sure to define courseList as an ArrayList holding references to Course objects Implement a constructor that will take values to initialize name, and gpa while courseList is initialized to an ArrayList() object. Provide the following get methods: getStudent ID ( ), getName(), getGPA (), get Gender(), and get CourseList() Note: the getCouresList() method will return a copy of the coureList arraylist with copies of course objects. Provide the following set methods: setName(), setGPA (), setGender() Another method: addCourse () that will take a Course object and add it to the...arrow_forward
- Design a class named StopWatch. The class contains:■しかく■しかく Private data fields startTime and endTime with getter methods.■しかく■しかく A no-arg constructor that initializes startTime with the current time.■しかく■しかく A method named start() that resets the startTime to the current time.■しかく■しかく A method named stop() that sets the endTime to the current time.■しかく■しかく A method named getElapsedTime() that returns the elapsed time for thestopwatch in milliseconds.Draw the UML diagram for the class then implement the class. Write a test programthat measures the execution time of sorting 100,000 numbers using selection sort.arrow_forwardCreate a Class called Transaction with: instance variables: stock - your stock class type - char -> b or s (buy/sell) quantity - can be fractional price - buy/sell price when - LocalDate constructors: constructor with parameters for stock, type and quantity. - sets the price from the stock price instance variable - sets when from LocalDate getters and setters for each instance variablearrow_forward
- Text book imageComputer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONText book imageComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceText book imageNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Text book imageConcepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningText book imagePrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationText book imageSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY