Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Every line of pseudo code can be tricky. Do not remove the questions or text from the Template. Mark any additions to the pseudocode by
Every line of pseudo code can be tricky. Do not remove the questions or text from the Template. Mark any additions to the pseudocode by adding lines and showing them in red. Strikeout any deletions using the strikeout tool. Assume that the pseudocode below for each question is a separate working program in your organization and that it needs modifications as described in the comments lines that begin with two slashesat the beginning of the code. Your job is to alter the pseudocode to meet the new specifications as noted above. Please follow directions as specified in the homework assignment instructions file. NOTE: If a function has no changes to be made to itthen it will be in blue font.
This application reads sales data for a real estate broker. The user
enters a record for each of salespeople containing the salesperson's
name, the number of properties sold by that person during the month,
and the total value of those properties. The data records are sorted by value so the data for the top three salespeople can be displayed.
Modify the program to:
enter data for any number of salespeople up to
allow the user to choose whether to see
a the data for the top three salespeople
or fewer if are not entered by value
b the data for the top three salespeople
or fewer if are not entered by
number of properties sold
start
Declarations
num SIZE
string namesSIZE
num propertiesSIZE
num values
num count
num NUMTODISPLAY
num comps
num x
num y
num tempProp
num tempVal
string tempName
string QUIT ZZZZ
string choice
num numEntered
call getReady
call display
call finish
stop
getReady
count
output "Enter salesperson name
output tempName
while tempName QUIT OR count SIZE
namescount tempname
output "Enter number of properties sold
input propertiestempname
output "Enter total value of those properties
input valuestempname
count count
if count SIZE then
output "Enter salesperson name or QUIT, to quit
output tempName
endif
numEntered count
end
return
display
choice X
while choice P OR choice V
output Do you want to see the top three salespeople by Value
output or by number of Properties sold?
output choice
endwhile
if choice V
valueSort
else
propertySort
endif
count
if numEntered then
numToDisplay numEntered
else
numToDisplay
endif
while count numToDisplay
output namescount propertiescount valuescount
count count
end
return
finish
output "End of display"
return
valueSort
comps numEntered
while y comps
x
while x comps
if valuesx valuesx then
swap
endif
x x
endwhile
y y
end
return
propertiesSort
comps numEntered
while y comps
x
while x comps
if propertiesx propertiesx then
swap
endif
x x
endwhile
y y
end
return
void swap
tempName namesx
namesx namesx
namesx tempName
tempProp propertiesx
propertiesx propertiesx
propertiesx tempProp
tempVal valuesx
valuesx valuesx
valuesx temp
return
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started