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 slashes at 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 it then it will be in blue font.
Marianne takes in small sewing jobs. She has two files sorted by date.
The date is composed of two numbers month and year. One file holds
new sewing projectssuch as "wedding dress"and the other contains
repair jobssuch as "replace jacket zipper" Each file contains the
month, day, client name, phone number, job description, and price.
Currently, this program merges the files to produce a report that lists
all of Marian's jobs for the year in date order. Modify the program to
also display her total earnings at the end of each month as well as at
the end of the year.
start
Declarations
num newMonth
num newDay
string newName
string newPhone
string newDesc
num newPrice
num repairMonth
num repairDay
string repairName
string repairPhone
string repairDesc
num repairPrice
num newDate
num repairDate
string bothAtEof Y
num HIGHMONTH
InputFile newJobs
InputFile repairJobs
num oldMonth
num total
num grandTotal
getReady
while bothAtEof N
detailLoop
end
finish
end
getReady
open newJobs "NewJobs.dat"
open repairJobs "RepairJobs.doc"
input newMonth, newDay, newName, newPhone,newDesc, newPrice from newJobs
if eof then
newMonth HIGHMONTH
end
input repairMonth, repairDay, repairName, repairPhone,repairDesc,
repairPrice from repairJobs
if eof then
repairMonth HIGHMONTH
end
if newMonth HIGHMONTH OR repairMonth HIGHMONTH then
bothAtEof Y
end
if newMonth repairMonth then
newMonth repairMonth
else
newMonth oldMonth
endif
return
detailLoop
if newMonth oldMonth OR repairMonth oldMonth then
output newMonth, tot
grandTotal grandTotal total
total
if newMonth repairMonth then
newMonth repairMonth
else
newMonth oldMonth
end
end
newDate newMonth newDay
repairDate repairMonth repairMonth
This arithmetic turns each date into a digit or digit number
if newDate repairDate then
input repairMonth, repairDay, repairName, repairPhone, repairDesc, repairPrice
total total repairPrice
output repairMonth, repairDay, repairName, repairPhone,repairDesc,
repairPrice from repairJobs
if eof then
repairMonth HIGHMONTH
end
else
input newMonth, newDay, newName, newPhone, newDesc, newPrice
total total newPrice
output newMonth, newDay, newName, newPhone,newDesc, newPrice from newJobs
if eof then
newMonth HIGHMONTH
end
end
if newMonth HIGHMONTH OR repairMonth HIGHMONTH then
bothAtEof Y
end
return
finish
output oldMonth, total
grandTotal grandTotal total
output "Grand total grandTotal
close newJobs
close repairJobs
end
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