Question: Create a Java class that has the private double data of length, width, and price. Create the gets and sets methods for the variables. Create

Create a Java class that has the private double data of length, width, and price. Create the gets and sets methods for the variables. Create a No-Arg constructor and a constructor that accepts all three values. At the end of the class add a main method that accepts variables from the user as input to represent the length and width of a room in feet and the price of carpeting per square foot in dollars and cents. (order of input: L W $) Assign appropriate values to the variables. Compute and use the gets methods to display the data as shown in the example. The numbers should be a double data type Example Output: With carpet at $10.00 per sq ft, a room 9.0 ft long by 8.0 ft wide will cost $720.00 to carpet. A refresher on System.out.printf(...) is on page 163-172 of the book. A refresher on the "Scanner" object is on 85 - 91 in the book.

What I have so far:

import java.util.*; /* Header information * */

public class Carpet {

// put code here

}

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 Databases Questions!