C=current line
F=fixed line
Exercise #1:
=============
Errors in
Declarations:
F:num rate -- missing
Errors in detailLoop() function:
C:if car_Type = "Compact" then
F:if carType = "Compact" then
C:if rate<>0
F:if rate<>0 then
if days>=DAYS_FOR_DISCOUNT then
rate=rate-rate*DISCOUNT_RATE
endif
F:endif //missing
C:output carType,days
F:output "Rental fees for ",carType," car for ",days, " days is
",rate
C:output "Enter car type or ",QUIT, " to quit
C:" --not required
C:input car_Type -- not required as the input is handled via
getReady()
F:getReady()
Exercise #2
===========
Main section:
C://Declarations
F:Declarations
C:OutputFile allsales
F:OutputFile allSales
C: while bothAtEof > "N"
F: while bothAtEof = "N"
getReady() Function:
C:newSalesperson = NAME
F:newSalesperson = HIGH_NAME
C:oldSalesperson = NAME
F:oldSalesperson = HIGH_NAME
C:bothAtEof < "Y"
F:bothAtEof = "Y"
detailLoop()
Function:
C: usedSalesperson = HIGHNAME
F: usedSalesperson = HIGH_NAME
C: output newSalesperson, newAmount to alllSales
F: output newSalesperson, newAmount to allSales
finish() function:
C: close allsales
F: close allSales
Debugging Section Exercise #1 50 points Plus up to 10 points extra The following pseudocode contains...
Use program control statements in the following exercises: Question 1 . Write pseudocode for the following: • Input a time in seconds. • Convert this time to hours, minutes, and seconds and print the result as shown in the following example: 2 300 seconds converts to 0 hours, 38 minutes, 20 seconds. Question 2. The voting for a company chairperson is recorded by entering the numbers 1 to 5 at the keyboard, depending on which of the five candidates secured...
Estimate purchases in 1996. (Hint: Cost of goods equals purchases plus beginning inventory minus ending inventory.) Use the percent of sales method to estimate funds needed in 1996 using the 1995 percentages. CASE 1 2 TOPEKA ADHESIVES (1) FINANCIAL FORECASTING Karen and Elizabeth Whatley are twins. Their mother teaches Physics at a mid- western university and their father runs a successful engineering firm. Not sur- prisingly, they are quite gifted at math and science, and they've displayed these talents in...