// 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 salesQuarter3ThisYear 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()DEBUG04-02.txt output "Enter department name or ", QUIT, " to quit " input dept return compareProfit() getSalesData() sumSalesData() if totalThisYear = totalLastYear then status = "Higher" else if totalThisYear
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
Pseudocode:
Pseudocode is a method of describing algorithms using a combination of natural language and programming language-like constructs. It's a high-level description of a computer program or algorithm, which is written in plain English or another natural language to describe how the program works. Pseudocode is a way to plan and organize code before writing it in a specific programming language, allowing for a better understanding of how the program should function and making it easier to translate into code. It can be useful for collaboration between team members who may have different levels of programming experience or for communication with non-technical stakeholders.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps