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 customer.
2. What is pseudocode?
Pseudocode is an informal language that has no syntax rules, and is not meant to be compiled or executed.
3. Computer programs typically perform what three steps?
1) Input is received.
2) Some process is performed on the input.
3) Output is produced.
Chapter 2: Algorithm Workbench 1-2
(5 points each)
1. Design an algorithm that prompts the user to enter his or her height and stores the user’s input in a variable named height.
Display “Height”
Input Height
Display “here is the height that you entered:” , height
2. Design an algorithm that prompts the user to enter his or her favorite color and stores the user’s input in a variable named color.
Display “Favorite color”
Input favorite color
Display “Here is your favorite color you entered:” , color
Chapter 2: Programming Exercises 1, 4
(35 points each)
1. Personal Information
Design a program that displays the following information:
Your name
Your address, with city, state, and ZIP
Your telephone number
Your college major
Pseudocode:
Flowchart:
Visual Basic Code:
Display “Matt DeCandia”
Display “1315 kossuth ave”
Display “Everett,WA 98203”
Display “425-299-6474
Display “Intro to Programing”
4. Total Purchase
A customer in a store is purchasing five items. Design a program that asks for the price of each item, and then displays the subtotal of the sale, the amount of sales tax, and the total. Assume the sales tax is 6 percent.
Purpose:
Input:
Process:
Output:
Pseudocode:
Flowchart:
Visual Basic Code:
Module TotalPurchase()
Declare Double amount, total = 0