
These are solutions to the programming problems from this week's exam. Please note that the methods presented are not the only way to solve the problems assigned. If you used a different approach and your code generated a valid answer, you could still earn full credit.
- Girl Scouts sell their signature cookies once a year. Each scout receives an order form and sells cookies. When order forms are collected by the Cookie Coordinator, she adds up all the individual box counts and places the troop order with the local council. The council only sells full cases of cookies so the Cookie Coordinator must round up the order if the troop has not sold an exact order of cases.
Write a program that accepts as its input the number of boxes of cookies sold by each scout (a scout might sell zero boxes). The program should add up all the individual orders and then determine how many cases the Cookie Coordinator needs to order. Terminate input with the sentinel value -1.
A case of cookies holds 12 boxes.
Hint: assume that you program adds up orders for only one flavor of cookie If the Cookie Coordinator needs to order more than one kind of cookie, she will run your program once for each flavor.

Cookie order code
- Write a program that prompts the user to input an integer. The program should then output a message to the user stating whether the number provided was even, odd, or exactly zero.
Hint: use an if/else if construction and handle the case of exactly zero first.

Positive, negative, or zero
- Write a program that accepts as its input three numbers. Determine whether or not these three numbers define a triangle. Three numbers define a triangle iff the sum of any two is strictly greater than the third.
Hint: you can test all three combinations in one if decision.
BONUS: Test valid triangle input to determine if the triangle entered is a right triangle, remembering that a the squares of the legs of a right triangle are equal to the square of the hypotenuse, a^2 + b^2 = c^2.
Hint: you can test all three combinations in one if or ternary decision.

First half of main testing for triangle

Second half of main with bonus question