Exam 3
- Date: Nov 6
- Open Notes, Computer is allowed
- NO CELL PHONES
Part 1 - Trace the program - 20 points
Program to Trace
Part 2 (80 points)
Write a function, perishable, that has one parameter - number of
items in the store. The function reads the barcode (integer number) for
each item and its price (floating number). All perishable items in the
store
have EVEN barcodes.
The function finds and returns the number of PERISHABLE items that cost
under 2 dollars.
Write main that reads the number of items in the store,
calls function
perishable to find the number of PERISHABLE items that cost
under 2 dollars.
If there are
NO such items, the program prints appropriate message.
You can randomly generate your data instead of the user input
Bonus: Function also finds the average price for ALL PERISHABLE items
and average price for ALL NOT PERISHABLE items