Question: -Modify the attached program to allow the user to search the customer arrays for a name, a cost, or a job size. This will require
-Modify the attached program to allow the user to search the customer arrays for a name, a cost, or a job size. This will require three separate search modules. They will have the signatures findCustomer(STRNG[]):INT, findSmallestJobCost(REAL[]):INT, and findLargestMowingArea(REAL[]):INT. The first of these modules will search an appropriate array for a user specified value and return the index of that value in the array. The next two modules will search theirs respectives arrays for either the least expensive job or the largest lawn and again return the index of that customer's job. You will also need two other modules. One to print all of the customers and their data in the following format formated output:
-Customer name has a lawn that is NNNN.N square feet. It will take HHH.HH hours to mow and will cost $DDD.DD
-The other will take the returned index location and print a single customer and all the associated data for that customer in the same format.
-This means that you will also need to get rid of the current print and only print the customer information using one of the two print modules.
-Create a program that asks the user to enter a customer name, house length, house width, property length, property width, and mowing rate (how many square feet they can mow per minute), how much they charge per hour. Then calculate the cost of mowing the property. Output the customer name, area to be mowed, and the cost to mow that property.
| Input | Process | Output |
| Customer Name Mowing rate Price per hour house length house width property length property width | Prompt for Name, house length and width, property length and width, mowing rate (area per minute), cost per hour Get Name, house length and width, property length and width, mowing rate, mowing price per hour calculate house area calculate property area calculate mowing area calculate time to mow calculate mowing cost output name, mowing area, and cost to mow | Customer name Area to mow Cost to mow |
start
DECLARE REAL houseLength = 0
DECLARE REAL houseWidth = 0
DECLARE REAL lotLength = 0
DECLARE REAL lotWidth = 0
DECLARE REAL houseArea = 0
DECLARE REAL lotArea = 0
DECLARE REAL[] mowingArea = 0
DECLARE REAL mowingSpeed = 0
DECLARE REAL[] mowingTime = 0
DECLARE REAL[] mowingCost = 0
DECLARE REAL mowingCostPerHour = 0
DECLARE STRING[] customerName =
DECLARE INT numberOfJobs = 0
PROMPT Please enter how much you charge per hour
GET mowingCostPerHour
PROMPT "Please enter how fast you can mow in square feet per minute"
GET mowingSpeed
PROMPT How many mowing jobs do you want to enter?
GET numberOfJobs
customerName = new STRING[numberOfJobs]
mowingCost = new REAL[numberOfJobs]
mowingTime = new REAL[numberOfJobs]
mowingArea = new REAL[numberOfJobs]
FOR INT index = 0, index < numberOfJobs, index++
PROMPT Please enter the customers name
GET customerName[index]
REPEAT
PROMPT "Please enter house Length and house Width"
GET houseLength houseWidth
SET houseArea equal to houseLength times houseWidth
PROMPT "Please enter lot Length and lot Width"
GET lotLength lotWidth
SET lotArea equal to lotLength * lotWidth
UNTIL lotArea > houseArea OR
SET mowingArea[index] = lotArea minus houseArea
SET mowingTime[index] = (mowingArea[index] / by mowingSpeed)/60
SET mowingCost[index] = mowingTime[index] * mowingCostPerHour
PRINT customerName[index] + I charge you + mowingCost[index] + to mow your lawn in + mowingTime[index] + hours.
ENDFOR
CALL
STOP
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
