Home » Create the algorithm that will solve the following problem definition

Create the algorithm that will solve the following problem definition

Create the algorithm that will solve the following problem definition:
!
A painting company has determined that for every 115 square feet of wall space, one gallon
of paint and eight hours of labor will be required. The company charges $18.00 per hour
for labor. The program will allow the user to enter the number of rooms to be painted and
the price of the paint per gallon. It should also ask for the length and height of wall in
each room (assumption: room dimensions are square).
!
The program will have methods that determine:
!
the square footage of the room (height of wall times length of wall = 1 wall)
assume the room is square
the number of gallons of paint required
the hours of labor required
the cost of the paint
the labor charges
the total cost of the paint job
!
It should then display the following information on the screen:
!
total square footage
number of gallons of paint required and the cost
the labor charges
total cost of the paint job
!
Create 3 sets of test data.
!
!
User defined methods
!
1) calculateSquareFootage
– calculate the square footage which is the length of walls times the height of walls =
1 wall. For example for a room that is 12 feet by 10 feet and ceiling height is 9 feet:

1st wall = length x height 12 x 9 = 108 square footage = 108 x 2 = 216
2nd wall = length height 10 x 9 = 90 square footage = 90 x 2 = 180

1st wall + 2nd wall = room 216 + 180 = 396
!
This method will return the square footage of the room as a double value.
!
algorithm:
( (lengthOfRoom * heightOfRoom) + (widthOfRoom *heightOfRoom)) *2
2) PaintNeeded
– the number of gallons of paint required
note:
pass in double that contains the square footage
returns an int which holds the number of gallons
round up
!
algorithm:
calculate paintNeeded = (squarefootage/115)
round up paintNeeded to nearest whole number that is greater than itself (use the
Math.ceil() method)
!
!
!

3) hoursRequired
– the number of hours needed for the job
– 8 hours for each 115 square feet to be painted
note:
pass in double that contains the square footage
returns an double which holds the number of hours needed to pain the room

algorithm:
calculate hoursRequired = (squarefootage / 115) * 8 hours
return hourseRequired
!

!
!
4) costOfPaint
– calculate the cost for the paint for the room
note:
pass an int value –> paintRequired
returns double which contain the cost of paint
$50 for each gallons
(squarefootage / 115) (# of gallons) (cost of gallon)
3.44 4 50 – 200 paint cost

5) LaborCharges
– calculate the cost for the labor to paint the room note:
pass in double that contains the hours needed to paint the room
returns double which contain the cost of labor
cost per hour is 18$
hours needed times cost per hour = 27.52 18 = 495.36

6) totalCost
– calculate the cost to paint the room
note:
pass in double cost to paintroom
pass in double cost of paint and double cost of labor
return double – contains the cost to paint the room
LaborCharges + costOfPaint = totalCost
495.36 + 200 = 695.36

Algorithm for main method:
!
prompt user to enter number of rooms
while number of rooms is not valid (must be greater than one)
display error message to user
prompt user to enter number of rooms
end while
prompt user for price per gallon of paint
while price of paint is not valid
display error message to user
prompt user for price per gallon of paint
end while
For Each room that needs to be painted
get squareFootage = call calculateSquareFootage() method
accumulate squareFootage to totalSquareFootage
End For Each
get paintNeeded = call paintRequired() method passing in squareFootage
get paintCost = call method costOfPaint() passing in paintNeeded
get laborHours = call method numberOfHours() passing in squareFootage
get laborCharges = call method laborCharges() passing in laborHours
calculate costToPaintRoom = paintCost + laborCharges
display totalSquareFootage, paintNeeded, paintCost,
laborHours and laborCharges
display totalCost







Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more