Description
1 Program Overview
The Pluf Light Bulb Company is a world leader in manufacturing one watt light bulbs. These fragile light
bulbs must be packaged in special containers, where each container must be filled to capacity (reduced
breakage). The four different types of containers and their costs are listed in the following table.
Name
Capacity
(bulbs)
Cost
($)
huge 20 5.00
large 15 3.50
medium 7 2.00
small 1 0.75
A program is needed to calculate the minimum number of containers required for any size order (you may
assume integer input greater than zero) and total cost (bulbs and packaging). Assume bulbs cost $1.55 each.
2 Program Description
You will need to create the subdirectory Lab1 in your CSC112 directory to store your program. Once the
directory has been created, create a new file called lab1.cpp in your CSC112/Lab1 subdirectory. Your
program must solve the problem described in the previous section. Once the program starts, first prompt
the user for the number of light bulbs in the order. Below, the user input is 59.
✷ Terminal ✷✷
Enter the number of light bulbs in the order -> 59
After reading the number of bulbs in the order, calculate and display the minimum number of containers
required, the cost of the bulbs, the cost of the packaging, and the total cost of the order. For 59 bulbs the
output would be
✷ Terminal ✷✷
Shipment Schedule for 59 Bulbs.
——————————-
Number of Containers Required
Huge 2
Large 1
Medium 0
Small 4
Cost of the light bulbs: $ 91.45
Cost of the containers: $ 16.5
Total cost of order: $ 107.95
2.1 Programming Points
You must turn-in printed and electronic copies of your programs before the assignment due date. Printed
copies must be given to Dr. Fulp while electronic copies will be submitted placing your source code in the
Grade/Lab1 directory. You must adhere to all of the following points to receive credit for this program.
CSC 112
Spring 2015
1
1. Name your source (C++ program) file lab1.cpp
2. The program must have at least four functions:
• main
• inputOrder – Get the order information
• calcOrder – Calculate order shipping schedule and cost.
• outputOrder – Print shipment schedule and cost.
3. Selection and repetition structures are not allowed.
4. Program must compile without errors or warnings using the -Wall and -pedantic options
5. Global variables are not allowed. All variables must be declared within a function.
6. All prompts and output must appear as described in the previous section. Please note the example
output carefully.
7. All code must follow the style guidelines for this course and be documented.
3 Electronically Submitting Your Program
Make certain to place your copy of lab1.cpp in your Grade/Lab1 directory before the due date. Penalty for
late work is 10 points/day.
CSC 112
Spring 2015
2