Write a program that estimates the cost of carpet for one or more rooms with rectangular floors. Begin by prompting for the price of carpet per square yard and the number of rooms needing this carpet. Use a loop to prompt for the floor dimensions of each room in feet. In this loop, call a value-returning method with the dimensions and carpet price as arguments. The method should return the carpet cost for each room to main, where it will be printed and accumulated. After all rooms have been processed, the program should display the total cost of the job.
Program63.java
Write a
Sample Output (image below)
Program64.java
Write a program that demonstrates method overloading by defining and calling methods that return the area of a triangle, a rectangle, or a square.
The program is written in Java. Check the program screenshot for the correct indentation. Please check the source code and output in the following steps.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images