Top-Rated Free Essay

# PT1420 E1 Unit2 Lab2 Herrera Javier

Satisfactory Essays
777 Words
Grammar
Plagiarism
Writing
Score
PT1420 E1 Unit2 Lab2 Herrera Javier
Lab 2: Input, Processing, and Output
This lab accompanies Chapter 2 (pp.29-55) of Starting Out with Programming Logic & Design.

Name: Javier Herrera
Lab 2.1 – Pseudocode

This lab requires you to focus on variable assignment and calculations. Read the following program prior to completing the lab.

Write a program that will calculate the cost of installing fiber optic cable at a cost of .87 per ft for a company. Your program should display the company name and the total cost.

Step 1: Examine the following algorithm as a base for how the program should flow. (Reference: Designing a Program, page 31).

1. Display a welcome message for your program.
2. Get the company name.
3. Get the number of feet of fiber optic to be installed.
4. Multiply the total cost as the number of feet times .87.
5. Display the calculated information and company name.

Step 2: Think of good variable names for the following pieces of data that will need to be stored with in this program.

Purpose of Variable
Variable Name
Stores the cost of fiber fiberCost Stores the company name compName Stores the number of feet to be installed feetIns Stores the calculated cost of installed fiber calcCost Step 3: Complete the following pseudocode based on the algorithm and the variables you declared above.

Display “Welcome to the Fiber Optic Calculator Program”
Set fiberCost = 0.87
Display “What is the company name?”
Input compName
Display “How many feet of fiber will be installed?”
Input feetIns
Set calcCost=feetIns*fiberCost
Display “For the company ”,compName ,”the total cost will be \$”calcCost

Lab 2.2 – Flowchart

This lab requires you to think about the steps that take place in a program by designing a flowchart. While designing flowcharts can be done with paper and pencil, one mistake often requires a lot of erasing. Therefore, a flowcharting application such as Raptor or Visio should be used. This lab will give you a brief overview of Raptor. Read the following program prior to completing the lab.

Write a program that will calculate the cost of installing fiber optic cable at a cost of .87 per ft for a company. Your program should display the company name and the total cost.

Step 1: Launch Raptor or Visio and convert your pseudocode from Lab 2-1 into a flowchart. Depending on what application you are using, select one of the following skeletons to get started. Once you double click on them to open, do a Save As to save it to your workspace. Watch the help video 2.2 for instructions on how to input, calculate, and output using both applications.

Raptor skeleton Visio skeleton

Step 2: The final step is to insert your finished flowchart in the space below. 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 space below, select Edit and Paste. Lab 2.3 – Visual Basic

This lab will focus how to assign variables and process calculations in Visual Basic.

Step 1: Create a new Visual Basic Console Application and save it to your workspace location.

Step 2: The first part of this program will convert the pseudocode from page 44 to Visual Basic. Under Sub Main()add the following line of code.

Console.WriteLine("This part of the program will code Program 2-6 from page 44")

You can also use Console.Write() if you want the cursor to stay on the same line as your output.

Step 3: Following the steps on page 44, next declare dollars such as:

Dim dollars As Double = 2.75 Step 4: Using Console.WriteLine() code step 2 from Program 2-6 such as:

Console.WriteLine("I have " & dollars & " in my account.")

Notice the & are used in Visual Basic and , are used in pseudocode.

Step 5: Reset dollars to 99.95 by adding the following:

dollars = 99.95

Step 6: Convert step 4 from page 44 to display what is now in the account. You can follow the Visual Basic syntax from Step 4 of this lab.

Step 7: At the very bottom before End Sub add the following lines so that your program will Pause and you can see your output.

Console.WriteLine("Press any key to continue") Console.ReadLine()

Step 8: Save and run your program so that works without errors. Copy and paste your Visual Basic code below.

Module Module1

Sub Main() Console.WriteLine("This part of the program will code Program 2-6 from page 44") Dim dollars As Double = 2.75 Console.WriteLine("I have " & dollars & " in my account.") dollars = 99.95 Console.WriteLine("I have " & dollars & " in my account.") Console.WriteLine("Press any key to continue") Console.ReadLine()

End Sub

End Module

## You May Also Find These Documents Helpful

• Satisfactory Essays

• 164 Words
• 2 Pages
Satisfactory Essays
• Satisfactory Essays

A minimization problem with four decision variables, two greater-than-or-equal-to constraints, and one equality constraint will have…

• 4123 Words
• 17 Pages
Satisfactory Essays
• Powerful Essays

In this final lab, you will apply the knowledge acquired from Units 4-9 of this course to completing a project, which will require the following skills:…

• 1263 Words
• 7 Pages
Powerful Essays
• Good Essays

Before you start this lab, see your instructor for the information needed to complete the following table:…

• 1472 Words
• 7 Pages
Good Essays
• Good Essays

List the inputs, any processes/calculations, and the outputs. Use the same valid variable names you used in Step 1.…

• 757 Words
• 10 Pages
Good Essays
• Satisfactory Essays

The Network Systems Administration degree is awarded after 90 credits and Nolan Owen has 70 left to take before graduation.…

• 270 Words
• 2 Pages
Satisfactory Essays
• Satisfactory Essays

a. Should “problem” = program assignment of some sort, than the first step would be to design the basis of the program in pseudocode to gain a clear picture of what kind of commands will work where, then move into flowcharting to start putting together the logic.…

• 848 Words
• 4 Pages
Satisfactory Essays
• Powerful Essays

Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Chapter 15 Chapter 16 Chapter 17 Chapter 18 Chapter 19 Chapter 20 Chapter 21 Chapter 22 Chapter 23 Chapter 24 Chapter 25 Chapter 26 Chapter 27 An Introduction to Hardware, Software, and the Internet An Introduction to Software Development Objects and Classes Algorithms Java Syntax and Style Data Types, Variables, and Arithmetic Boolean Expressions and if-else Statements Iterative Statements: while, for, do–while Implementing Classes and Using Objects Strings Class Hierarchies and Interfaces Arrays…

• 3908 Words
• 16 Pages
Powerful Essays
• Good Essays

1 - Design the Program2 - Write the Code3 - Correct Syntax Errors4 - Test the Executable Code…

• 738 Words
• 3 Pages
Good Essays
• Satisfactory Essays

Match the activity or purpose on the left with the appropriate description on the right by typing in the corresponding letter under the Answer column.…

• 264 Words
• 2 Pages
Satisfactory Essays
• Satisfactory Essays

4.) Write assignment statements that perform the following operations with the variables a, b, and c:…

• 470 Words
• 3 Pages
Satisfactory Essays
• Good Essays

for creating program flowcharts, but that is only half of the story. Until this software…

• 5177 Words
• 21 Pages
Good Essays
• Satisfactory Essays

Why is a flowchart useful in developing and documenting software? Why is the interactive Visual Logic flowchart program more useful than a manually drawn flowchart?…

• 503 Words
• 3 Pages
Satisfactory Essays
• Powerful Essays

|1.2 Demonstrate an understanding of the |Code listings show a variety of objects | |…

• 2281 Words
• 10 Pages
Powerful Essays
• Powerful Essays

* Step three is the implementation step. Once the model has been verified, the implementation must then be converting into code. (Collins)…

• 1255 Words
• 6 Pages
Powerful Essays