Using Variables, Constants, and Data Types in Pseudocode and Flowchart

profilewilelm1
week_2_lab_2.2.docx

PT1420: Using Variables, Constants, and Data Types in Pseudocode and Flowchart

This lab 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.

Write a program that will take in basic information from students, including their names and how many credits they have taken in Network Systems Administration program. The program will then calculate how many credits are needed to graduate. Display should include the student name and the number of credits left to graduate. This should be based on a 90-credit program, where some courses are half credits.

Step 1: This program is most easily solved using just a few variables. Identify potential problems with the following variables declared in the pseudocode. Assume that the college has the ability to offer half credits (Reference: Variable Names, pages 39–40 from your textbook, Starting Out with Programming Logic & Design).

Variable Name

Problem (Yes or No)

If Yes, what’s wrong?

Declare Real creditsTaken

Declare Int creditsLeft

Declare Real studentName

Constant Real Credits Needed = 90

Step 2: What is wrong with the following calculation? (Reference: Variable Assignment and Calculations, page 43).

Set creditsLeft = creditsTaken – creditsNeeded

Step 3: Write the exact output you would expect from the following line of code if the user of the program enters “Nolan Owens” (Reference: Displaying Items, pages 40–41 from your textbook, Starting Out with Programming Logic & Design).

Display “The student’s name is “, studentName

Step 4: Write the exact output you would expect from the following line of code if the user of the program enters a name of Nolan Owens and has taken 20 credits so far (Reference: Displaying Items, pages 40–41 from your textbook, Starting Out with Programming Logic & Design).

Display “The Network Systems Administration degree is awarded after 90 credits and “, studentName, “ has “, creditsLeft, “ left to take before graduation.”

Step 5: Complete the following pseudocode to solve the programming problem.

1. //Provide documentation on line 2 of what this program does

2. //

3. //Declare variables on lines 4, 5, 6, and 7

4.

5.

6.

7.

8. //Ask for user input of studentName and creditsTaken on line 9 - 12.

9.

10.

11.

12.

13. //Calculate remaining credits on line 14

14.

15. //Display student name and credits left on line 16 and 17

16.

17.

Now, think about the steps that take place in a program by designing a flowchart using either Raptor or Visio. Read the following program prior to completing the lab.

Write a program that will take in basic information from students, including their names and how many credits they have taken in the Network Systems Administration program. The program will then calculate how many credits are needed to graduate. Display should include the student name and the number of credits left to graduate. This should be based on a 90 credit program, where some courses are half credits.

Step 6: Launch Raptor or Visio and convert your pseudocode from Lab 2-1 into a flowchart. Depending on which application you are using, select either lab3-2raptor.rap or lab3-2visio.vsd from the Lab 3 folder on the accompanying Lab Demo Media and Startup Files CD to get started. Once you double click on them to open, do a Save As to save it to your workspace. Watch the demo video 3-2 for instructions on how to input, calculate, and output using both applications.

Step 7: The final step is to insert your finished flowchart into a Word document. Inside Raptor, select File and the Print to Clipboard from the menu. If you are using Visio, select Edit, then Select All, then Edit and Copy. In the Word document, select Edit and Paste.

Page 1