Answered step by step
Verified Expert Solution
Question
1 Approved Answer
module calculate restaurant sales,Lab 3 pseudocode and Modules Critical Review A Module is a group of statements that exists within a program for the purpose
module calculate restaurant sales,Lab 3 pseudocode and Modules
Critical Review A Module is a group of statements that exists within a program for the purpose of performing a specific task. Using modules allows as to separate tasks so that we may assign more than one person to work on a program ending on the programming environment, modules may be called procedures, subroutines subprograms, methods, and modules. There are two parts to a module. The module definition in the call statement. The module definition Contains the code necessary to perform the required task. To execute the module, you write a statement that calls it. The format for a module definition is as follows: Module name () Statement Statement Etc. End Module Calling a module is normally done from the Main 0 module. Here is an example: call name () Because the code inside of a module is protected, we may need to send or receive information for the module to complete its task. We do this through the use of arguments and parameters. A parameter is part of the module definition. This allows us to send information and to the module. To send the information we need to add an argument as part of the calling statement. In the example below, we declare a variable called user Num. This variable is then added as part of the call statement to send and receive information to each of the modules it is used in. Module main() Real Integer userNum Call inputUserData (userNum) Call print UserData(userNum) End Module In the module definition, we create a parameter to match the requirements of the call statement. Two pieces of information added Are the data type and the use of the 'ret' key word. Because the module definition is creating a module, we need to tell the computer what type of data we wish to pass. In this case, we are passing a real number. In Pseudocode, we need to be able to send information back to the main module. We do this through the use of their rel' keyword. This keyword stands for "pass by reference". Meaning, information that is changed inside the module is seen in the main module. //accepts -number as a reference so the changed value //will be retained Module inputUser Data (Real Ref userNum) userNum = 20 End Module dovo Unit 3 Pseudocode and Modules This lab requires Jah requires you to think about the steps that take place in a program by writing pseudocode Read the following program prior to completing the lab. estaurant must file a monthly sales report listing restaurant sales for the month and the ount of taxes on the sales and the gratuities earned by the wait staff. The expected amount of buities is 8% of the sales. The taxes on restaurant sales is 10%. The taxes on gratuities is gratuities is 8% of 179 Write a program that asks the user to enter the total sales for the month. The program should calculate and display the following: The monthly restaurant sales The amount of taxes on restaurant sales - Sale The amount of expected gratuities The amount of taxes on the expected gratuities NOTE: The results from this program is identical to the results you received in Unit 2 Pseudocode. However, this exercise will make use of modules to achieve the same result. Please follow all of the steps to receive full credit. Step 1: This program is most easily solved using just four variables. Declare the variables that you will need in the program, using the proper data type and documenting the purpose. (Please use the same variables as in your Unit 2 Pseudocode exercise Variable Name Declare Rea restaurant Sales Declare Real, toxas on restaurant sales Declare Real Expected pratitiosa Dechre Real takes on expected gratuities Step 2: In this step, we want to break our program up into modules. Given the major task involved in this program, declare a module name for each module needed. There is no need to include arguments in your module names at this time. Module Name Purpose Module input Restaurant Sales Module Laptosoonsbladors/es. (Seg79x) You should have created five modules (one input module, three calculation modules, one output module) to match the tasks in your previous pseudocode exercise. Step 3: Open the notepad app or similar in your computer. You may use an alternative such as Notepad++. Please do not use Microsoft Word Step 4: Copy and paste the following Pseudocode into your notepad app 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