Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 19 21 2012 Proceedings Part 3 Lnai 7198

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284922, 978-3642284922

More Books

Students also viewed these Databases questions