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

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

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