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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started