top-rated free essay

PT1420 E1 Unit2 Lab2 Herrera Javier

By javierherrera Jun 28, 2015 777 Words
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
Stores the company name
Stores the number of feet to be installed
Stores the calculated cost of installed fiber

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")

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")

End Sub

End Module

Cite This Document

Related Documents

  • Unit2

    ... Unit One Individual Assignment Terrance Rowland Kaplan University GB601-03N: MBA Capstone Professor: Richard Rowlett November 11, 2013 Unit One Individual Assignment Decision Making Ethics in the Current Marketplace In examining the correlation between the manner in which we conduct business and the principles to...

    Read More
  • Lab2

    ...INSTRUCTIONS: · On your own and without assistance, complete this Lab 2 Answer Form electronically and submit it via the Assignments Folder by the date listed on your Course Schedule (under Syllabus). · To conduct your laboratory exercises, use the Laboratory Manual that is available in the WebTycho classroom (Reserved Reading or provided b...

    Read More
  • Lab2

    ...Experiment #1: Mass, Volume and Density Performed: 2/2/11 Turned in: 2/9/11 The purpose of this experiment is to verify the independence of X and Y motion for a projection. We watch the professor perform this experiment. The equipment used in this experiment was a projectile launcher (ME-6800), a drop shoot accessory (ME-9859), one photog...

    Read More
  • Lab2

    ...Metabolic pathways: An overview of cellular respiration and fermentation Chapter 6 Cellular respiration, photosynthesis occur in eukaryotic organelles (mitochondria, chloroplasts) CELLULAR RESPIRATION GLUCOSE 1 2 GLYCOLYSIS 1 PYRUVATE OXIDATION2 KREBS CYCLE 3 2 ELECTRON TRANSPORT 4 CHAIN 2 NET ATP PRODUCED = 36 Nelson, ...

    Read More
  • Unit2

    ...Explore the theme of danger in Blood River and Heart of darkness. ‘Abandoned’ ‘blind’ ‘darkness’ ‘challenges’ ‘overwhelmed’. These five words are the best words in both of these extracts do describe what is happening in both texts. The first noticeable thing in both extracts Blood River from page 216 to 218 and heart of da...

    Read More
  • lab2

    ...Lab 2: Motor Position Control Simulation Student Name: Colin Power Student No: C09601627 Course: DT023/3 Group: B Submission Date: 11th Mar 2014 Aim The aim of this lab is to simulate motor position control with an open loop system and a closed loop system for a harddrive using Matlab. And compare the experiment...

    Read More
  • PT1420 Assign. 10

    ...PT 1420 Unit 10 Assignment1 Short Answer Review Question Described the three steps that must be taken when a file is used by a program. Open the file – it creates a connection between the file and the program. Opening and output file usually creates the file on the disk and allow the program to write data to it. Opening an input file allow...

    Read More
  • Pt1420 week 2

    ...PT1420 Introduction to Programming Name: Homework 2 Ch. 2: Short Answer 1-3 (10 points) 1. What does a professional programmer usually do first to gain an understanding of a problem? The first thing a professional programmer will usually do to gain the understanding of a problem is to work directly with, and interview the custo...

    Read More

Discover the Best Free Essays on StudyMode

Conquer writer's block once and for all.

High Quality Essays

Our library contains thousands of carefully selected free research papers and essays.

Popular Topics

No matter the topic you're researching, chances are we have it covered.