You may complete any programs you didn't complete in the course (from Cycles 1-5*) as part of your final portfolio as part of your Student Choice grade. Here are the details.
*Since Cycle 6 is remaining open until the end of the semester, this cannot count towards this grade.
- All "regular" programs are worth two points. It cannot be a program you completed already in the course, but it can be one that you never finished or had errors on. Use the Status page to scan for programs to complete.
- ABCs or Bloomsburg 2019 programs are worth 3.5 points.
- I also have a few new ideas I would like to test out, so completing the ones below would also be an option (I'll give 2.5 points for these).
- Please use this dropbox and mark the module it came from. If it is one of the programs below, call the module "UB".
*Since Cycle 6 is remaining open until the end of the semester, this cannot count towards this grade.
StringMeAlong
Allow the user to enter a byte of 0's and 1's with or without leading zeroes on the byte. Read this into a string variable. Output the ASCII character associated with that byte.
TEST DATA:
-------------------
INPUT
01000000
OUTPUT
A
-------------------
INPUT
1000000
OUTPUT
A
------------------
INPUT
101110
OUTPUT
.
Allow the user to enter a byte of 0's and 1's with or without leading zeroes on the byte. Read this into a string variable. Output the ASCII character associated with that byte.
TEST DATA:
-------------------
INPUT
01000000
OUTPUT
A
-------------------
INPUT
1000000
OUTPUT
A
------------------
INPUT
101110
OUTPUT
.
LetMeCountTheWays
People like to know their options. When they list them, different folks list things differently.
In this program, allow the user to enter a list of options on a single line in any of the above forms and output how many options were listed.
Hint: Which substrings represent separators of your options, and is counting those more important than counting the options themselves?
TEST DATA (not complete--look at list above.
------------
INPUT
A, B, C, or D
OUTPUT
4
------------
INPUT
Huron or Erie or Ontario or Michigan or Superior
OUTPUT
5
------------
INPUT
Happy/Sad
OUTPUT
2
People like to know their options. When they list them, different folks list things differently.
- Paper, plastic, or reusable?
- Paper, plastic or reusable?
- Paper or plastic or reusable?
- Paper/plastic/reusable?
In this program, allow the user to enter a list of options on a single line in any of the above forms and output how many options were listed.
Hint: Which substrings represent separators of your options, and is counting those more important than counting the options themselves?
TEST DATA (not complete--look at list above.
------------
INPUT
A, B, C, or D
OUTPUT
4
------------
INPUT
Huron or Erie or Ontario or Michigan or Superior
OUTPUT
5
------------
INPUT
Happy/Sad
OUTPUT
2
WhatAreTheOdds
Horse racing, while morally and ethically dubious for many reasons, presents a lot of interesting mathematical principles. In each horse race, right up until race time, scoreboards show the "odds" of a horse winning a race. This is a little different than mathematical odds for a few reasons.
A horse that has stated odds of 3-1 has mathematical odds of 1:3. This means that the horse is projected to be successful (win) once for every three unsuccessful (not win) tries. Probability-wise, this is 1/4 or 25%.
However, stating the odds as 3-1 is done for the benefit of the betting fans. Doing so tells the fan that they will receive $3 for every $1 bet on that horse to win.
Those odds are not in any way based on an expert's perception of the horse, but on the amount of money that was wagered in the race. In this way, the odds are "crowd-sourced" and all of the bets are based on each bettor's notion of which horse will actually win.
Here's a mathematical example:
The program challenge: Using a 20% take and a maximum of 15 horses in the race, write a program that does the following:
TEST DATA:
------------------
INPUTS
Use the five horses and wager amounts above.
User wagered $15 on Barista.
OUTPUTS
Odds as shown above.
Winning horse was Alphabet Soup.
User's profit/loss was -15.
------------------
INPUTS
Use the five horses and wager amounts above.
User wagered $15 on Barista.
OUTPUTS
Odds as shown above.
Winning horse was Barista.
User's profit/loss was $50.
------------------
INPUTS
Seven horses named A-G with totals of 100, 200, 300, 400, 500, 600, and 900.
User wagered $10 on C
OUTPUTS:
A: 23-1
B: 11-1
C: 7-1
D: 5-1
E: 19-5
F; 3-1
G: 5-3
Winning horse was F
User's profit/loss was -10.
------------------
INPUTS
Seven horses named A-G with totals of 100, 200, 300, 400, 500, 600, and 900.
User wagered $10 on C
OUTPUTS:
A: 23-1
B: 11-1
C: 7-1
D: 5-1
E: 19-5
F; 3-1
G: 5-3
Winning horse was C
User's profit/loss was $60.
Horse racing, while morally and ethically dubious for many reasons, presents a lot of interesting mathematical principles. In each horse race, right up until race time, scoreboards show the "odds" of a horse winning a race. This is a little different than mathematical odds for a few reasons.
A horse that has stated odds of 3-1 has mathematical odds of 1:3. This means that the horse is projected to be successful (win) once for every three unsuccessful (not win) tries. Probability-wise, this is 1/4 or 25%.
However, stating the odds as 3-1 is done for the benefit of the betting fans. Doing so tells the fan that they will receive $3 for every $1 bet on that horse to win.
Those odds are not in any way based on an expert's perception of the horse, but on the amount of money that was wagered in the race. In this way, the odds are "crowd-sourced" and all of the bets are based on each bettor's notion of which horse will actually win.
Here's a mathematical example:
- There are five horses in a race named Alphabet Soup, Barista, Cash and Carry, Delightful, and EverythingNow.
- The bettors placed wagers on which of the five horses to win. The total amount wagered on each horse is as follows:
- Alphabet Soup: $500
- Barista: $300
- Cash and Carry: $150
- Delightful: $1000
- EverythingNow: $150
- Altogether, $2000 was bet on this race. The "take" is the amount the racetrack pulls from that total to pay its bills, taxes, employees, and create profits. Let's suppose that state law dictates a 20% take by the track. For this race, $400 is the take and $1600 remains.
- The odds are then calculated (proper mathematics) as "money bet : money not bet" for each horse, using that $1600 as the total. Reduce those odds down to the simplest 'fraction' available. The odds are written in the "reverse and dash" form of the mathematical odds.
- Alphabet Soup --> 500 : 1100 = 5:11 --> 11 - 5
- Barista --> 300 : 1300 = 3:13 --> 13 - 3
- Cash and Carry --> 150 : 1450 = 3:29 --> 29 - 3
- Delightful --> 1000 : 600 = 10: 6 --> 10 - 6
- EverythingNow --> 150 : 1450 = 3:29 --> 29 - 3
- Suppose that someone bet $30 on delightful. Their payout would be $50, since they got $10 for every $6 they spent. On that wager, they gained $20.
The program challenge: Using a 20% take and a maximum of 15 horses in the race, write a program that does the following:
- Reads in the names of the horses and the amount wagered on each.
- Outputs the odds of each horse winning.
- Asks the user who he/she wagered on and how much.
- "Runs the race" in a simulation by randomly choosing a winning horse.
- Tells the user who won and the user's profit or loss.
TEST DATA:
------------------
INPUTS
Use the five horses and wager amounts above.
User wagered $15 on Barista.
OUTPUTS
Odds as shown above.
Winning horse was Alphabet Soup.
User's profit/loss was -15.
------------------
INPUTS
Use the five horses and wager amounts above.
User wagered $15 on Barista.
OUTPUTS
Odds as shown above.
Winning horse was Barista.
User's profit/loss was $50.
------------------
INPUTS
Seven horses named A-G with totals of 100, 200, 300, 400, 500, 600, and 900.
User wagered $10 on C
OUTPUTS:
A: 23-1
B: 11-1
C: 7-1
D: 5-1
E: 19-5
F; 3-1
G: 5-3
Winning horse was F
User's profit/loss was -10.
------------------
INPUTS
Seven horses named A-G with totals of 100, 200, 300, 400, 500, 600, and 900.
User wagered $10 on C
OUTPUTS:
A: 23-1
B: 11-1
C: 7-1
D: 5-1
E: 19-5
F; 3-1
G: 5-3
Winning horse was C
User's profit/loss was $60.