2A PROGRAMSExcellence (6 points): Complete GoneBananas, MinutesToHours, and BritConversions within 50 hours. All coding standards are demonstrated throughout all programs.
Advanced (5 points): Complete GoneBananas, MinutesToHours and BritConversions by the end of Cycle 2. All coding standards are demonstrated throughout all programs. Proficient (4 points): Complete GoneBananas OR MinutesToHours and BritConversions by the end of Cycle 2. All coding standards are demonstrated throughout all programs. Basic (3 points): Complete GoneBananas and MinutesToHours by the end of Cycle 2. Below Basic (2 points): Complete GoneBananas by the end of Cycle 2. |
|
GoneBananas
Write a program to ask for a number of bananas in a bunch. Output the number of whole clusters of 2, 3, 4, 5, and 6 bananas you could create AND note how many leftover bananas you would have for each cluster.
TEST DATA:
Input: 56
Outputs:
28 clusters of 2 with 0 leftover
18 clusters of 3 with 2 leftover
14 clusters of 4 with 0 leftover
11 clusters of 5 with 1 leftover
9 clusters of 6 with 2 leftover
Write a program to ask for a number of bananas in a bunch. Output the number of whole clusters of 2, 3, 4, 5, and 6 bananas you could create AND note how many leftover bananas you would have for each cluster.
TEST DATA:
Input: 56
Outputs:
28 clusters of 2 with 0 leftover
18 clusters of 3 with 2 leftover
14 clusters of 4 with 0 leftover
11 clusters of 5 with 1 leftover
9 clusters of 6 with 2 leftover
MinutesToHours
Write a program that will read in a number of minutes and output the equivalent amount in hours and minutes in the standard HH:MM format. If the number of hours or minutes is a single digit, show a 0 before it when displaying the time.
TEST DATA:
Input: 150 minutes
Output: 02:30
Input: 876 minutes
Output: 14:36
Input: 609 minutes
Output: 10:09
Input: 61 minutes
Output: 01:01
Write a program that will read in a number of minutes and output the equivalent amount in hours and minutes in the standard HH:MM format. If the number of hours or minutes is a single digit, show a 0 before it when displaying the time.
TEST DATA:
Input: 150 minutes
Output: 02:30
Input: 876 minutes
Output: 14:36
Input: 609 minutes
Output: 10:09
Input: 61 minutes
Output: 01:01
BritConversions
Write a program that reads in a number of feet and outputs the equivalent number of different British units of measurement and the remainder indicated, as well as its decimal form (to two decimal places) if division is necessary. Use this article to help you.
Hint: At some point, you need to calculate the number of inches and store it in a variable even though you do not need to output the conversion in inches.
Here are the British units and the remainders (if applicable). Note that you also need to output the decimal form also if indicated. See the test data for examples.
a) Barleycorns, no remainders
b) Palms, no remainders
c) Cubits, remainder in inches + decimal form
d) Yards, remainder in feet + decimal form
e) Furlongs, remainder in feet + decimal form
f) Miles, remainder in feet + decimal form
-----------------------------------------------------------
TEST DATA
-----------------------------------------------------------
Input: 6002 feet
Output:
216072 barleycorns
24008 palms
4001 cubits, 6 inches remainder or 4001.33 cubits
2000 yards, 2 feet remainder or 2000.67 yards
9 furlongs, 62 feet remainder or 9.09 furlongs
1 mile, 722 feet remainder or 1.14 miles
-----------------------------------------------------------
Input: 9999 feet
Output:
359964 barleycorns
39996 palms
6666 cubits, 0 inches remainder or 6666.00 cubits
3333 yards, 0 feet remainder or 3333.00 yards
15 furlongs, 99 feet remainder or 15.15 furlongs
1 mile, 4719 feet remainder or 1.89 miles
Write a program that reads in a number of feet and outputs the equivalent number of different British units of measurement and the remainder indicated, as well as its decimal form (to two decimal places) if division is necessary. Use this article to help you.
Hint: At some point, you need to calculate the number of inches and store it in a variable even though you do not need to output the conversion in inches.
Here are the British units and the remainders (if applicable). Note that you also need to output the decimal form also if indicated. See the test data for examples.
a) Barleycorns, no remainders
b) Palms, no remainders
c) Cubits, remainder in inches + decimal form
d) Yards, remainder in feet + decimal form
e) Furlongs, remainder in feet + decimal form
f) Miles, remainder in feet + decimal form
-----------------------------------------------------------
TEST DATA
-----------------------------------------------------------
Input: 6002 feet
Output:
216072 barleycorns
24008 palms
4001 cubits, 6 inches remainder or 4001.33 cubits
2000 yards, 2 feet remainder or 2000.67 yards
9 furlongs, 62 feet remainder or 9.09 furlongs
1 mile, 722 feet remainder or 1.14 miles
-----------------------------------------------------------
Input: 9999 feet
Output:
359964 barleycorns
39996 palms
6666 cubits, 0 inches remainder or 6666.00 cubits
3333 yards, 0 feet remainder or 3333.00 yards
15 furlongs, 99 feet remainder or 15.15 furlongs
1 mile, 4719 feet remainder or 1.89 miles
ABC: OddsAndEvens (+2)
Odds and evens is a 'game' that is used to quickly settle disputes between two people; there is always a winner and a loser. The traditional version goes like this: One of two contestants selects Odds or Evens (assigning the other player the unchosen one), and then both contestants simultaneously show either one or two fingers of one hand. If the total number of fingers is odd, then the player assigned odds wins (and vice versa for evens).
Create a version of Odds and Evens in which a human player challenges the computer. However, there are some modifications:
In this clip of Seinfeld, Jerry and George both want to move into a new apartment and they both like the same one. They settle the dispute first by flipping a coin (unsuccessfully) and then by playing "Choose"--which is really Odds and Evens.
Note: Elaine has been promised Jerry's sofa if he moves to the new apartment, hence her use of the tape measure near the end.
Note: Seinfeld (along with The Office, 30 Rock, and Arrested Development) is one of my favorite shows, so references these shows in programs are always appreciated.
Odds and evens is a 'game' that is used to quickly settle disputes between two people; there is always a winner and a loser. The traditional version goes like this: One of two contestants selects Odds or Evens (assigning the other player the unchosen one), and then both contestants simultaneously show either one or two fingers of one hand. If the total number of fingers is odd, then the player assigned odds wins (and vice versa for evens).
Create a version of Odds and Evens in which a human player challenges the computer. However, there are some modifications:
- The human always picks odds or evens, then inputs ANY positive integer (1, 2, 3, 4, ...)
- The computer's choice of number is a random value 1-100.
- Both the user's and computer's selections are output, the sum is output, and the winner is declared.
- The game continues to a "Best of 5", in which the first player to win three games is victorious.
- This means that every run of this program will run three to five rounds. However, if either human or computer win the first three rounds then the fourth and fifth rounds should not be played. Likewise, if a winner is declared on the fourth round, the fifth should not be played.
In this clip of Seinfeld, Jerry and George both want to move into a new apartment and they both like the same one. They settle the dispute first by flipping a coin (unsuccessfully) and then by playing "Choose"--which is really Odds and Evens.
Note: Elaine has been promised Jerry's sofa if he moves to the new apartment, hence her use of the tape measure near the end.
Note: Seinfeld (along with The Office, 30 Rock, and Arrested Development) is one of my favorite shows, so references these shows in programs are always appreciated.