Question: Write a program that will help FloorsRUs manage online orders of their popular Bamboo Dream flooring. The company has only 100 boxes of flooring in

Write a program that will help FloorsRUs manage online orders of their popular Bamboo

Dream flooring. The company has only 100 boxes of flooring in stock. Each box contains 155

square feet of flooring.

To calculate how much flooring is needed, you multiple the width by the depth of a room.

Then you add on 5% extra for flooring that is wasted in installation. Then you calculate the

number of boxes, remembering that you must always order complete boxes.

The method that you write should take the dimensions of the room and the number of square

feet of flooring in the box and calculate how many boxes of flooring are needed. The method

signature should be:

public static int calculateFlooring(int width, int height, int squareFeetPerBox)

The user interaction of the program could look like this below:

We now have 100 boxes left.

What is the size of your room: enter the width and depth in feet

50 20

Your 7 boxes will be shipped to you.

We now have 93 boxes left.

What is the size of your room: enter the width and depth in feet

100 100

Your 68 boxes will be shipped to you.

We now have 25 boxes left.

What is the size of your room: enter the width and depth in feet

50 50

Your 17 boxes will be shipped to you.

We now have 8 boxes left.

What is the size of your room: enter the width and depth in feet

50 50

We only have 8 boxes left.

Do you want to purchase all of them? Yes or No

yes

Your 8 boxes will be shipped to you.

I'm sorry, but we're now sold out of Bamboo Dream flooring

import java.util.Scanner;

public class Project3

{

public static void main (String[] args)

{

int availableBoxes = 100;

int squareFeetPerBox = 155;

while (availableBoxes > 0)

{

System.out.println("We now have " + availableBoxes + " boxes left.");

System.out.println("What is the size of your room: enter the width and depth in feet seperated by a space.");

}

public static int calculateFlooring(int width, int height, int squareFeetPerBox)

{

int squareFeetOrder;

int boxesOrdered;

Scanner input = new Scanner(System.in);

width = input.nextInt();

height = input.nextInt();

squareFeetOrder = (width * height); //setup rounding

squareFeetPerBox = squareFeetPerBox - squareFeetOrder;

boxesOrdered = squareFeetPerBox/100;////

Math.round(boxesOrdered);

if (availableBoxes > 0)

{

System.out.println("We now have " + availableBoxes + " boxes left");

availableBoxes = availableBoxes - boxesOrdered;

}

else

{

System.out.println("I'm sorry, but we are now sold out of Bamboo Dream Flooring");

}

}

}

}

What am I doing wrong, it keeps giving me an error at the signature line the professor provided.

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!