Unit 2 Assignment 1: Homework (material from Chapter 2of your text book)
1.) What is pseudocode? An informal language used to develop a programs design
2.) Computer programs typically perform what 3 steps. Input, Processing, and Output
3.) What 2 things must you normally specify in a variable declaration.
Variable name and data type
4.) Write assignment statements that perform the following operations with the variables a, b, and c:
a. Adds 2 to a and stores the result in b b=a+2
b. Multiples b times 4 and stores the result in a a=bx4
c. Divides a by 3.14 and stores the result in b b=a/3.14
d. Subtracts 8 from b and stores the result in a a=b-8
5.) Write the pseudocode for a program that will determine the average miles per gallon a car gets. (Inputs should be miles driven and gallons of gas used)
Miles driven= Distance
Gallons of gas used=Gas
*****************************************************************
Unit 2 Labs
Problem:
Write a program that will calculate the cost of installing fiber optic cable at a cost of .87 per foot for a company. Your program should display the company name, number of feet installed, and the total cost for the installation.
1.) 2.1: Pseudocode
Type in your answers below where the question marks are shown based on the above problem
Variable Table
Purpose of Variable
Variable Name
Stores the cost of fiber fiberCost Stores the company name compName Stores number of feet to be installed feet Stores calculated cost of installed fiber
Totalcost
Pseudocode:
Display “Welcome to the Fiber Optic Calculator Program”
Set fiberCost = fibercost
Display “What is the Company Name?”
Input compName
Display “How many feet of fiber will be installed?”
Input feet
Set feet * fiberCost
Display “Company Name: “,("company name: " & compName)
Display“Feet of cable installed: (" total feet installed: " & feet)
Display “Total cost: $”, ("total cost is: $" & totalcost)
2.) 2.2: Flowchart.
Use