You have been asked to create a program in Python that will calculate the cost y
ID: 3856832 • Letter: Y
Question
You have been asked to create a program in Python that will calculate the cost you will need to charge to install a laminate floor. You have decided to write a class that will determine the rate you will charge and the total area, including waste, that you will need to install the flooring in a room. Your program will ask the user for the length and width of the room before it creates an object based on the class. Which line of code, in Python, creates the object in your program?
A.) MyRoom = new LaminateFloor(UserWidth, UserLength)
B.) MyRoom = LaminateFloor(UserWidth, UserLength)
C.) MyRoom as LaminateFloor(UserWidth, UserLength)
D.) MyRoom = LaminateFloor
Explanation / Answer
B.) MyRoom = LaminateFloor(UserWidth, UserLength)
The option B is correct. In Python, creating objects is like function call. You use the name of the class and pass the arguments to call the corresponding constructor
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.