Question: Write a program to calculate the cost to wrap a present Make a Box class It should have 3 properties length, width, and height Write

Write a program to calculate the cost to wrap a present
Make a Box class
It should have 3 properties length, width, and height
Write a constructor, __init__. It can have defaults of 1 for length, width, and height
Write a __str__ function to create a string, length x width x height, where each value is printed to two decimal places
Write a function to calculate and return the surface area, which is 2LW +2WH +2LH
Prompt the user for the length, width, and height of the present (box) in inches
Set those values in a Box object
It costs $0.02 per square inch to wrap a present
Print the dimensions of the Box (using __str__) and then the cost of the wrapping
Sample Run #1(bold, underlined text is what the user types):
Length? 8.5
Width? 10
Height? 2
Cost for 8.50 x 10.00 x 2.00 is $4.88
Note: This is an introductory level class with this problem beginning to cover classes. There is a sample output of what the program is supposed to look like when it is runned.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!