Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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

ID: 3872136 • Letter: W

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 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.

Explanation / Answer

Hi

I have fixed the signature issues.

Project3.java

import java.util.Scanner;

public class Project3 {

static int availableBoxes = 100;

public static void main (String[] args)

{

int squareFeetPerBox = 155;

Scanner scan = new Scanner(System.in);

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

int width = scan.nextInt();

int height = scan.nextInt();

while (availableBoxes > 0)

{

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

availableBoxes = calculateFlooring(width, height, squareFeetPerBox);

}

}

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

{

int squareFeetOrder;

int boxesOrdered;

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

squareFeetPerBox = squareFeetPerBox - squareFeetOrder;

boxesOrdered = squareFeetPerBox/100;////

Math.round(boxesOrdered);

availableBoxes = availableBoxes - boxesOrdered;

return availableBoxes;

}

}

Output:

What is the size of your room: enter the width and depth in feet seperated by a space.
3
4
We now have 100 boxes left.
We now have 99 boxes left.
We now have 98 boxes left.
We now have 97 boxes left.
We now have 96 boxes left.
We now have 95 boxes left.
We now have 94 boxes left.
We now have 93 boxes left.
We now have 92 boxes left.
We now have 91 boxes left.
We now have 90 boxes left.
We now have 89 boxes left.
We now have 88 boxes left.
We now have 87 boxes left.
We now have 86 boxes left.
We now have 85 boxes left.
We now have 84 boxes left.
We now have 83 boxes left.
We now have 82 boxes left.
We now have 81 boxes left.
We now have 80 boxes left.
We now have 79 boxes left.
We now have 78 boxes left.
We now have 77 boxes left.
We now have 76 boxes left.
We now have 75 boxes left.
We now have 74 boxes left.
We now have 73 boxes left.
We now have 72 boxes left.
We now have 71 boxes left.
We now have 70 boxes left.
We now have 69 boxes left.
We now have 68 boxes left.
We now have 67 boxes left.
We now have 66 boxes left.
We now have 65 boxes left.
We now have 64 boxes left.
We now have 63 boxes left.
We now have 62 boxes left.
We now have 61 boxes left.
We now have 60 boxes left.
We now have 59 boxes left.
We now have 58 boxes left.
We now have 57 boxes left.
We now have 56 boxes left.
We now have 55 boxes left.
We now have 54 boxes left.
We now have 53 boxes left.
We now have 52 boxes left.
We now have 51 boxes left.
We now have 50 boxes left.
We now have 49 boxes left.
We now have 48 boxes left.
We now have 47 boxes left.
We now have 46 boxes left.
We now have 45 boxes left.
We now have 44 boxes left.
We now have 43 boxes left.
We now have 42 boxes left.
We now have 41 boxes left.
We now have 40 boxes left.
We now have 39 boxes left.
We now have 38 boxes left.
We now have 37 boxes left.
We now have 36 boxes left.
We now have 35 boxes left.
We now have 34 boxes left.
We now have 33 boxes left.
We now have 32 boxes left.
We now have 31 boxes left.
We now have 30 boxes left.
We now have 29 boxes left.
We now have 28 boxes left.
We now have 27 boxes left.
We now have 26 boxes left.
We now have 25 boxes left.
We now have 24 boxes left.
We now have 23 boxes left.
We now have 22 boxes left.
We now have 21 boxes left.
We now have 20 boxes left.
We now have 19 boxes left.
We now have 18 boxes left.
We now have 17 boxes left.
We now have 16 boxes left.
We now have 15 boxes left.
We now have 14 boxes left.
We now have 13 boxes left.
We now have 12 boxes left.
We now have 11 boxes left.
We now have 10 boxes left.
We now have 9 boxes left.
We now have 8 boxes left.
We now have 7 boxes left.
We now have 6 boxes left.
We now have 5 boxes left.
We now have 4 boxes left.
We now have 3 boxes left.
We now have 2 boxes left.
We now have 1 boxes left.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote