Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lab 1 Flow Charts and Pseudo Code 1 0 pts / 2 extra pts Labs are never about getting done... They are about learning. I
Lab Flow Charts and Pseudo Code
pts extra pts
Labs are never about getting done... They are about learning.
I often will include a short minilecture at the start of the lab directions. This is designed to focus your attention on the learning goals for the lab and often provides you with specific technical details you will practice directly in the lab session.
Minilecture:
We use pseudo code and flow charts to capture the logic of a program prior to implementing it with code. In general practice, flow charts are too cumbersome for large programssystems and so they are mainly used for isolated subroutines, and highlevel architectural patterns, etc.
We use pseudo code all the time. The pseudo code outline we write initially becomes the documentation for the completed program. To code the program, we go through and write the program code that corresponds to the pseudo code outline. The outline then becomes the program comments that document the code.
Students rarely believe me initially when I mention that the important part of this process is the generation of the pseudo code outline. Generating the code that corresponds to the outline is trivial and simply a matter of practice with the language syntax. If the pseudo code outline is incorrect then the program code will not correctly solve the task. Instead of trying to write the program out of your head as it were, take the time to create a solid and logically clear pseudo code outline before you begin coding.
Common flowchart symbols:
Lines Arrows show the flow
Input symbols parallelograms
Processing symbols rectangles
Output symbols parallelograms
Terminal symbols lozenges flattened ovals
Decision symbols diamonds
Pseudo Code:
Pseudo code is informal and fairly close to natural language. Rather than complete sentences, we tend to use very brief statements which will ultimately translate more directly to program code. Indentation is used to show groups of related statements, pay attention to it
Look carefully at the example here and be sure to understand how both the pseudo code and the flowchart express the same logic ie the same program
Prompts: In every case, you have to prompt the user so they know what you need for them to input. Thus, before every input, we output the prompt msg so the user knows what we want to get from them.
Always include the prompt in your pseudo code and flowcharts when you do input.
Output should always be in the form of a complete sentence, not just a raw calculated value. ie The total calculated building costs is: $
Example:
start
output What is your favorite number?
input favNumber
doubleFun favNumber
ouput Double your fun is doubleFun
stop
Lab:
Insert your work for the completed lab here within this MS Word document and submit it as directed at the end of the document.
For each of the following tasks, provide both the flow chart and pseudo code. You may use the MS Word symbols to create the flow charts or any other tool that lets you create and embed them in this document. Ill likely work through the first task with you during the session. Just insert your response right here in this document. Before doing the flow chart or pseudo code, list the inputs and outputs required for each program. Please note that these are all simple programs with no branching so the flow charts will be a vertical connection of symbols like the example here.
a Task pts: a program where the user enters the price of a purchase and the program computes and outputs a sales tax. Dont forget the prompt!
b Task pts: A program for calculating the area in square feet. User will input the height and the width in feet.
c Task pts: A program that asks the user to enter home maintenance costs for each of the four seasons and returns the total yearly maintenance costs. Separate prompt and input for each input value!
d Task pts: A program that calculates the difference between two numbers. ie subtracts one from the other. Thus this might be a negative value.
e Task pts Extra Credit: A program where the user enters a credit card balance and the program calculates the interest at a rate of monthly. Assume the user does not make any payment. Display the interest due after one month and again after two months.
Submitting your work: carefully check your work.
You need to follow directions and develop professional work habits. Im very specific about how I want the work submitted especially with the naming and the format of files so they can be tracked efficiently. If you cant or wont follow directions, you work will not be graded and you receive no credit.
Rename your copy of this word file as LastnameFirstnameLabdocx using your name. Submit this file using the Canvas assignment mechanism. Subm
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