1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Novay_Z [31]
3 years ago
4

Declare a class named PatientData that contains two attributes named height_inches and weight_pounds. Sample output for the give

n program with inputs: 63 115 Patient data (before): 0 in, 0 lbs Patient data (after): 63 in, 115 lbs 1 Your solution goes here ' 2 1 test passed 4 patient PatientData () 5 print('Patient data (before):, end-' ') 6 print(patient.height_inches, 'in,, end=' ') 7 print(patient.weight_pounds, lbs') All tests passed 9 10 patient.height_inches = int(input()) 11 patient.weight_pounds = int(input()) 12 13 print('Patient data (after):', end-' ') 14 print (patient. height_inches, 'in,', end- ') 15 print(patient.weight_pounds, 'lbs') Run

Computers and Technology
1 answer:
Oksanka [162]3 years ago
4 0

Answer:

class PatientData():    #declaration of PatientData class

   height_inches=0  #attribute of class is declared and initialized to 0

   weight_pounds=0 #attribute of class is declared and initialized to 0

Explanation:

Here is the complete program:

#below is the class PatientData() that has two attributes height_inches and weight_pounds and both are initialized to 0

class PatientData():  

   height_inches=0

   weight_pounds=0  

patient = PatientData()  #patient object is created of class PatientData

#below are the print statements that will be displayed on output screen to show that patient data before

print('Patient data (before):', end=' ')

print(patient.height_inches, 'in,', end=' ')

print(patient.weight_pounds, 'lbs')

#below print  statement for taking the values height_inches and  weight_pounds as input from user

patient.height_inches = int(input())  

patient.weight_pounds = int(input())  

#below are the print statements that will be displayed on output screen to show that patient data after with the values of height_inches and weight_pounds input by the user

print('Patient data (after):', end=' ')

print(patient.height_inches, 'in,', end=' ')

print(patient.weight_pounds, 'lbs')      

Another way to write the solution is:

def __init__(self):

       self.height_inches = 0

       self.weight_pounds = 0

self keyword is the keyword which is used to easily access all the attributes i.e. height_inches and weight_pounds defined within a PatientData class.

__init__ is a constructor which is called when an instance is created from the PatientData, and access is required to initialize the attributes height_inches and weight_pounds of PatientData class.

The program along with its output is attached.

You might be interested in
Di bawah ini tampilan submenu pada tab menu insert pada microsoft word 2010,yaitu...
Luda [366]
Jawabannya:
A. tables
7 0
3 years ago
Changes in the ownership of a file do not change the amount of data that is considered to belong to a user.
professor190 [17]
False because if you edit the ownership of file it will give permissions only with the permissions you can edit file,rename,or delete file.
5 0
3 years ago
One critique of determining the effectiveness of the psychodynamic perspective is that its theories are too vague to test. t/f
Feliz [49]
TRUE

Psychodynamic theories are usually too vague to allow a clear scientific test. Modest support for central psychodynamic hypotheses has been provided by Empirical studies. Critics have in the past disputed very many aspects of psychoanalysis including whether it is indeed a science or not. However much this is so, psychoanalysis is a great idea in personality that should never be overlooked.






3 0
3 years ago
Read 2 more answers
Tower of Hanoi algorithm 4 disks
Sophie [7]
????is this a question
4 0
3 years ago
Read 2 more answers
What is the smallest colorable area on a display device
n200080 [17]
The smallest colorable area on a display would be a pixel 

8 0
3 years ago
Other questions:
  • 50+ POINTS AND BRAIN IF CORRECT Chris is working with other employees on a worksheet. The other employees have made comments, bu
    8·1 answer
  • Gina's teacher has sent her a Word document that contains the names of all the students who are participating in the
    11·2 answers
  • What type of result does the MATCH function, when used on its own, return?
    5·1 answer
  • The following types of websites are
    10·1 answer
  • If I wanted to include a picture of a dog in my document, I could use _____. SmartArt WordArt clip art AutoCorrect
    13·1 answer
  • What are the OSHA construction standards also called ?
    10·1 answer
  • Can change the tab colors of the worksheets in excel
    13·1 answer
  • Assume you are given a boolean variable named isNegative and a 2-dimensional array of ints that has been created and assigned to
    8·1 answer
  • Who has the wrong anwser
    14·2 answers
  • You are responsible for a rail convoy of goods consisting of several boxcars. You start the train and after a few minutes you re
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!