it 210 week 1q

it 210 week 1q

﻿Associate Program Material
Appendix B

Input and Output Process Example

The following example explains how to write a program that calculates the cost of painting a room. If the user provides the price of a gallon of paint; the number of square feet one gallon covers; and the length, height, and width of the room, you can calculate the total cost of painting the room.

To calculate the total cost, determine the room area, and divide the area to be painted by the number of square feet one gallon covers. Then, multiply the number of gallons needed by the price per gallon to find the total cost. Finally, provide the total cost to the user.

The following chart illustrates the data input and output process:

Input – this is the information need to determine the output; this is the information that is usually entered by the user
Name - this is the logical name (variable) of the input data; this is not the value itself, but a short phase to describe the data that will be contained in the variable
Type – this is the data type of the variable
Real – basically any number that requires a decimal (positive or negative); 1.23, - 4.98, 123.9889
Integer – a positive or negative whole number; 89, -987, 858623
Text – alphanumeric values; John Doe, 123 Main Street
Range – this defines the valid values for a variable, mainly used with real or integer variables
Process – this is where processing is performed on the input to produce the output – as go further into the class you will learn that the processes in the IPO chart become the modules in the program designs (pseudocode)
Output – results of the work done in the process
Input
Process
Output
Name: Price
Type: Real
Range: > 0

Name: Square feet per gallon
Type: Integer
Range: > 0

Name: Width
Type: Real
Range: > 0

Name: Length
Type: Real
Range: > 0

Name: Height
Type: Real
Range: > 0

Get user input
Name: Price
Type: Real
Range: > 0

Name: Square feet per...