Details of this Paper

Create the algorithm that will solve the following problem definition

Description

solution


Question

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

 

Paper#68812 | Written in 18-Jul-2015

Price : $32
SiteLock