You are on page 1of 2

PRINCIPLES OF PROGRAMMING

First Year
Sheet 1
============
1. Design a flowchart for a program that will read SALES from each record, print each sales
amount, and print the number of records read.
2. Design a pseudocode for a program that will read SALES from each record, print each sales
amount, and print a total of those amounts.
3. Design a flowchart and pseudocode for a program that will read NAME and sales AMOUNT
from each record. The program is to print the name from each record that has a sales amount
greater than $2000 and also print the total of all sales greater than $2000.
4. Design a flowchart for a program that will read NAME and COST from each record. The
program is to print the name and cost from each record and a message (printed once) that
indicates whether any cost exceeded $5000.
5. Design a pseudocode for a program that will read an item NAME and COST from each record.
The program is to print the name of each item costing more than $500. If no items cost more
than $500 the program is to print "NO ITEM EXCEEDED $500."
6. Design flowchart and pseudocode for a program that will read an item NAME and COST from
each record, print the name of each item costing more than $1000, and print the average cost
of items costing more than $1000.
7. Design a flowchart for a program that will read SALES from each record and will print the
average of the first 200 records read. The program is to read no more than 200 records. It is
to calculate and print the average even if fewer than 200 records are available.
8. Design flowchart and pseudocode for a program that will read and print NAME and GRADE
from each record up to 400 records. (The file may not contain 400 records, but the program
should read no more than 400.) The program is to print the average of all grades from zero
up to and including 100.
9. Identify the errors in the following flowchart:

10. Identify the errors in the following flowchart:


11. Design flowchart and pseudocode for a program that will read and print a name and a grade from
each record and will print the average of all positive grades. The program is to print NONE
POSITIVE if there are no positive grades.
12 Design flowchart and pseudocode for a program that will read names and sales from the first 200
records. The program is to print a list of names of those with sales over $5000, the number of
records with sales less than $5000, and an error message if fewer than 200 records are read.
13. Design flowchart and pseudocode for a program that will read a name and an amount from each
record and print the average of the first 100 negative amounts read. The program is to print
INSUFFICIENT DATA if the file contains fewer than 100 negative records. (The program is to read
no more records than is necessary to calculate the average.)
14. Design flowchart and pseudocode for a program that will read item name and cost from each record.
The program will print the item name and cost from each record as well as the average cost of all
items. If any records contain zero as the cost amount, the message "FREE ITEM" is to be printed
and that record is not to be included in the average. If a record with a negative cost is encountered,
the program is to print "DATA ERROR" and stop.

You might also like