A strange professor throws candy at…, er, to students. Write a program to help him estimate the cost of candy for a semester.
The worksheet starts like this:
Assume pieces per student, and cost per piece are already in the worksheet, and are correct. You don't have to validate them. They can be fractional.
Here is some sample output:
The user inputs three numeric values: students, weeks, and attendance percentage. Test that they are numeric, and one or greater. You can assume users only enter whole numbers. Percentage attendance must be 100 or less.
The user can enter a course number as well, so that it shows when the worksheet is printed. You don't need to do any validation of the course number.
Your program should output total number of candy pieces needed (always a whole number), and total cost in dollars (could be fractional). You do not need to round or truncate the values.
Show error messages, like this:
NOTE: show all error messages that apply. Also notice that the output cells are blank when there are errors. Remember to clear old error messages the next time the program is run.
Here's some more output:
You don't have to use subroutines, though you can if you want.
- Use the flag pattern.
- Candy pieces is a whole number, but it could be big, so Dim it as Long. In fact, just Dim all of the whole number variables as Long, instead of Integer. It will help you avoid subtle bugs.
Upload your Excel workbook.
(If you were logged in as a student, you could submit an exercise solution, and get some feedback.)