Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import java.util.Scanner; public class Tester { public static void main(String[] args) { float wallLength, wallHeight, wallWidth, doorWidth, doorHeight, window1Width, window1Height, window2Width, window2Height, bookshelfLength, bookShelfHeight, bookshelfDeepness,

import java.util.Scanner;

public class Tester {

public static void main(String[] args) {

float wallLength, wallHeight, wallWidth, doorWidth, doorHeight, window1Width, window1Height, window2Width, window2Height, bookshelfLength, bookShelfHeight, bookshelfDeepness, paintCost, carpentCost,areaPainting, areaCarpenting;

Scanner sc = new Scanner(System.in);

System.out.println("Enter the Length, Width and Height of wall continuously");

wallLength = sc.nextFloat(); wallWidth = sc.nextFloat(); wallHeight = sc.nextFloat();

System.out.println("Enter the Width and Height of door continuously");

doorWidth = sc.nextFloat(); doorHeight = sc.nextFloat();

System.out.println("Enter the Width and Height of door Window 1");

window1Width = sc.nextFloat(); window1Height = sc.nextFloat();

System.out.println("Enter the Width and Height of door Window 2");

window2Width = sc.nextFloat(); window2Height = sc.nextFloat();

System.out.println("Enter the Length and Height and Deepness of Bookshelf");

bookshelfLength = sc.nextFloat(); bookShelfHeight = sc.nextFloat(); bookshelfDeepness = sc.nextFloat();

System.out.println("Enter the cost per square foot for painting and carpeting");

paintCost = sc.nextFloat(); carpentCost = sc.nextFloat();

areaPainting = wallLength*wallWidth + 2*wallHeight*wallLength + 2*wallHeight*wallWidth - doorWidth*doorHeight - window1Width*window1Height - window2Width*window2Height- bookShelfHeight*bookshelfLength;

areaCarpenting = wallLength*wallWidth - bookshelfLength*bookshelfDeepness; System.out.println("Total painting cost = "+ areaPainting*paintCost + "$"); System.out.println("Total carpenting cost = "+ areaCarpenting*carpentCost + "$");

} }

The program above calculates the floor space for carpets and wall space for paint. In this assignment you will add to that program.

There is a budget assigned to the covering of the floor. There are four options for floor cover (Ceramic Tile = 1; Hardwood = 2, Carpet = 3; and linoleum tile = 4) each with a cost per square foot. In addition the customer has a preference for which covering they would like. The program will ask for input and read in the budget in dollars and cents, the cost per square foot for each of the different floor options and also ask for which one the customer prefers where 0 means the customer does not care and 1-4 if they have a specific preference for one of the four floor coverings

The program will then, based upon the square footage calculation, check if the users preference can be afforded (Hint use Switch statement), if not or the user selects 0 not caring, the program will start with the most expensive and check each flooring type until it finds the most expensive flooring that can be afforded. The program will output the type of flooring selected or a message that given the budget no flooring is affordable.

For all three renovation projects use the room and door, window and bookcase dimensions from Project 1 and use Tile= $4.00 /sq ft; Wood = $3.00/ sq ft; Carpet = $2.00/ sq ft and linoleum = $1.00/sq ft).

Use the following as the budget and preference:

Budget/preference

Renovation 1

Renovation 2

Renovation 3

User preference

0

1

3

Budget

255.00

250.00

400.00

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

More Books

Students also viewed these Databases questions