Answered step by step
Verified Expert Solution
Link Copied!

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 projects(such as "wedding dress")and the other contains
// repair jobs(such 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 HIGH_MONTH =99
InputFile newJobs
InputFile repairJobs
num oldMonth
num total =1
num grandTotal =1
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 = HIGH_MONTH
end
input repairMonth, repairDay, repairName, repairPhone,repairDesc,
repairPrice from repairJobs
if eof then
repairMonth = HIGH_MONTH
end
if newMonth = HIGH_MONTH OR repairMonth = HIGH_MONTH 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 =0
if newMonth < repairMonth then
newMonth = repairMonth
else
newMonth = oldMonth
end
end
newDate = newMonth *100+ newDay
repairDate = repairMonth *100+ repairMonth
// This arithmetic turns each date into a 3-digit or 4-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 = HIGH_MONTH
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 = HIGH_MONTH
end
end
if newMonth = HIGH_MONTH OR repairMonth = HIGH_MONTH 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions