Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

DEBUG #2 Each file starts with some comments that describe the problem. Comments are lines that begin with two slashes (//). Following the comments, each

DEBUG #2 Each file starts with some comments that describe the problem. Comments are lines that begin with two slashes (//). Following the comments, each file contains pseudocode that has one or more bugs you must find and correct.

// This pseudocode should create a list that describes annual profit // statistics for a retail store. Input records contain a department // name (for example, Cosmetics) and profits for each quarter for // the last two years. The program should determine whether // the profit is higher, lower, or the same // for this full year compared to the last full year.

start Declarations string department num salesQuarter1ThisYear num salesQuarter2ThisYear num salesQuarter3ThisYear num salesQuarter4ThisYear num salesQuarter1LastYear num salesQuarter2LastYear num salesQuarter3ThisYear num salesQuarter4LastYear num totalThisYear num totalLastYear string status num QUIT = "ZZZZ" housekeeping() while department <> QUIT compareProfit() endwhile finishUp() stop

housekeeping() output "Enter department name or ", QUIT, " to quit " input dept return

compareProfit() getSalesData() sumSalesData() if totalThisYear = totalLastYear then status = "Higher" else if totalThisYear <= totalLastYear then status = "Lower" else status = "Same" endif endif output department, status output "Enter department name or ", QUIT, " to quit " input department return

getSalesData() output "Enter sales for first quarter this year " input salesQuarter1ThisYear output "Enter sales for second quarter this year " input salesQuarter1ThisYear output "Enter sales for third quarter this year " input salesQuarter1ThisYear output "Enter sales for fourth quarter this year " input salesQuarter4ThisYear output "Enter sales for first quarter last year " input salesQuarter1LastYear output "Enter sales for second quarter last year " input salesQuarter3LastYear output "Enter sales for third quarter last year " input salesQuarter3LastYear output "Enter sales for fourth quarter last year " input salesQuarter3LastYear return

sumSalesData() totalThisYear = salesQuarter1ThisYear + salesQuarter2ThisYear + salesQuarter2ThisYear + salesQuarter4ThisYear totalLastYear = salesQuarter2LastYear + salesQuarter2LastYear + salesQuarter3LastYear + salesQuarter4LastYear return

finishUp() output "End of report" return

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

More Books

Students also viewed these Databases questions

Question

1. Choose as precise or as concrete a word as possible.

Answered: 1 week ago

Question

explain the need for human resource strategies in organisations

Answered: 1 week ago

Question

describe the stages involved in human resource planning

Answered: 1 week ago