Problem List:

Problem-centric Programming Instruction

The problems below are phrased to communicate the problem to you, a teacher who already knows programming. We encourage you to rework the problem statements to be more natural/realistic and less prescriptive of solution, e.g., remove the specifications about getting specific inputs and reporting specific results. Second, the lists begin with small problems and work their way up to more complex problems. That arrangement is probably most readily applied to the way most programming is currently taught and suggests a more bottom up approach as opposed to a more holistic problem solving approach. We hope you will keep in primary goal of problem-solving in mind as you use this list for your own instructional purposes.

Practice Problems/Exercises

Sequence & Assignment & I/O with Primitives

These problems or exercises are similar to learning activity for vocabulary and basic grammar when studying a new natural language. While you can make plans in your native language you cannot actually say or write in the new language without knowing the words and legal ways of combining them. This does not imply that you must start with these. A whole language approach would (we think) have you do the planning and learning of vocabulary at the same time.

We associate these problems/exercises with the programming language primitive data types which are typically numeric, string, and Boolean. There are operators and functions associated each kind of data that are used to formulate expressions that solve the "problems". An additional element of these exercises is that they involve variable declarations, the use of input & output, and the use of GUI element definitions (if your language has GUIs).

Numeric

Note that there are at least two ways to use these problems. You can provide students with formulas to use or you can include finding an appropriate formula as part of the problem. We have used both types, often posing the question, "Why can't you write this program?" An answer to that question is "I don't know how to calculate it." Solving the problem then requires determining a formula for the calculation as well as translating it into appropriate code. The other common answer to the question is I don't know how to do that in ____ (Python, Java, Visual Basic, ...). Solving the problem then requires knowledge of a particular programming feature (e.g., random number generator, conversion to integer, string search).

"Basic" arithmetic

The items below are mostly restricted to four-function arithmetic.

1. MPG

Get input values for miles driven and gallons of fuel used;  then calculate and report MPG.

2. Hybrid savings

Get input values for miles driven per year, MPG with current car, MPG with new hybrid, and cost of gasoline;  then calculate and report the cost of fuel for each and the savings with the hybrid.

3. Pay (w/o overtime)

Get input values for hours-worked and pay-rate;  then calculate and report pay (assuming no overtime pay).

4. Sale price

Get input values for original price and percent-off;  then calculate and report the "sale price" of the item.

5. Percent reduction

Get input values for original price and desired sale price;  then calculate and report the "percent off" I can advertise for the item.

6. Original price

Get input values for sale price and percent-off;  then calculate and report the original price of the item.

7. Currency conversion

Get an input value for number of euros and an exchange rate;  then calculate and report the dollars equivalent.

8. Volume conversion

Get an input value for cubic feet;  then calculate and report the equivalent value for bushels. (And vice-versa.)

9. GPA

Get input values for total credit hours and the number of gradepoints for each of the grades (A, A-, B+, B, B-, ...);  then calculate and report the appropriate GPA.

10. BMI

Get input values for height in inches and weight in pounds;  then calculate and report the BMI value (body mass index).

11. One mile time

Get an input value for current speed (in MPH) and;  then calculate and report the time in minutes necessary to travel 1 mile.

12. One minute distance (scaling factor)

Get an input value for current speed (in MPH) and;  then calculate and report the distance (in miles) that can be traveled in 1 minute.

13. Time left to travel

Get input values for current speed (in MPH) and distance to travel ;  then calculate and report the time necessary to reach the destination assuming the same speed.

14. Score as a percentage

Get input values for a score and the maximum possible score on a programming assignment;  then calculate and report the percentage score.

15. Score range conversion (scaling factor)

I record scores using a 10 point scale but want each score to count as some percent of the total (e.g., 0.2%). Get input values for the the score and how much it counts and produce the scaled result.

16. Score weighting multiplier (scaling factor)

Get input values for a possible total score for an area of grades and the weighting (percentage the area counts toward the overall grade) ;  then calculate and report the value needed to convert the raw score to a weighted score.

17. Estate division (from Marilyn vos Savant)

We are dividing up my mother's estate. She has \$30,000 in cash and some of us want some non-cash items. Sibling A wants \$2,000 in tools. Sibling B wants the \$500 coin collection. Sibling C just wants cash. And Sibling D want's a doll collection worth \$1,000. How much cash will sibling C receive?

"Advanced" arithmetic

These items add functions and more rarely encountered operations.

1. Grain bin capacity

Get input values for the dimensions for a cylinder with a conic top to it (used as a grain silo);  then calculate and report how many bushels (of corn or wheat) it will hold.

2. Archery target—color's percentage

A standard archery target has ten rings—rings 1 & 2 are white; 3 & 4, black, 5 & 6 blue; 7 & 8 red; 9 & 10, yellow); the outer ring's outside diameter is 48 inches; each individual ring adds 4.8 inches to the radius of its circle. Report the percentage of the whole target that the yellow color constitutes.

3. Floor tile cases

Get input values for length and width of a room (in feet and inches);  then calculate how many cases of tiles of a given size (a literal in the program) are needed to cover the floor. Tiles come in cases of 12 tiles. Assume the cutoff portion of tiles cannot be used.

4. Peeps' births

Peeps are cute little critters that live on tropical islands. At age two they pair up to mate and produce a single offspring at age 3. (They die at age 6.) Get an input value indicating the number of two-year-old peeps and report how many children they have. (Note: you can't have half a peep.)

5. Die roll

Produce and report a random value indicating the roll of a six-sided die.

6. Dice rolls

Produce and report random values indicating the rolls of each of two six-sided dice.

7. Dice total

Produce and report a value representing the sum of the roll of two six-sided dice.

8. Door number

Produce and report a random value indicating whether I should choose door 1, 2, or 3 on Let's Make a Deal.

9. Dogs & buns (thank you, Ken Funk)

Hot dogs come in packages of 8 and buns come in packages of 6. Get input values for the number of people who RSVPed and the number of hots dogs I plan to serve each person (it might be 2.5);  then calculate and report the number of packages of hot dogs and of buns that I need to buy.

Order of operations

These items use more complex expressions and/or the need to consider overriding operator precedence.

1. Pay (w/ overtime)

Get input values for hours-worked and pay-rate;  then calculate and report pay (assuming overtime pay).

2. Pay (For true geeks, no `If`, use `Max()`)

Get input values for hours-worked and pay-rate; then calculate and report pay (with or without overtime).

3. Temperature conversion

Get an input value for a Fahrenheit temperature;  then calculate and report the related Celsius value.

4. Wind chill

Get appropriate input values;  then calculate and report the wind chill.

5. Sale Price

Get input values for original price and percent off;  then calculate and report the sale price I can advertise for the item.

6. Total cost for sale item

Get input values for original price, the "percent off" for the big sale, and the tax rate;  then calculate and report the amount of money needed to pay for the item.

7. Carpet cost

Get input values for length and width of a room (in feet and inches), the square yard price for carpet, and the square yard cost for installation;  then calculate the cost of the carpet including a given value for sales tax.

8. Inventory values

The cost of inventory items varies so an average cost is calculated. When new items arrive they have a cost per item that needs to be combined with the average cost of items already in stock. Assume you have values for `itemsOnHand` and `averageCost`. Get input values for the count of incoming items and the cost per item; then revise the values of `itemsOnHand` and `averageCost` appropriately and report the new values.

9. Combined GPA

Get input values for credit hours and GPA at the community college and the number of credit hours and GPA at the four-year school;  then calculate the combined GPA.

10. Credit card interest

Given the information in a credit card bill, get a value for payment to be made;  then calculate and report the interest that will be charged on the next bill.

Text/String

We try to ensure students see all types of data and operators so their problem representation repertoire is complete. Thus we explicitly include character/string data and related functions. Some problems/tasks are include just to illustrate particular functions, but mostly we try to use problems that seem realistic to students rather than just some generic language-driven tasks.

"Basic" string knowledge

These are not "real" problems but are suggested for having students practice string operations which typically have not been part of their past experience as arithmetic operations have.

1. Length

Get an input string value;  then determine and report the string's length.

2. Indicated character

Get an input string value;  then determine and report the its first character, its last character, its middle character.

3. Substring (1)

Get an input string value;  then determine and report the first half of its contents, the last half, the first third, the last third, the middle third.

4. Substring (2)

Get an input string value;  then determine and report the content of the string before the first period, the content after the first period.

5. Substring (3)

Get an input string value;  then determine and report the content of the first word, the second word.

6. Find character

Get an input string value;  then determine and report the location of the first space, the first period, the first at sign, the first number sign, ...

7. Find string

Get two input string values;  then determine and report the location of the first occurrence of the second input within the first.

More "realistic"

These are more realistic problems involving string processing. Note that solutions here may require multiple variables and assignment statements.

1. Welcome, <name>

Get an input value representing a person's full name;  then display a message welcoming the person using the first name only.

2. Rearranged <name>

Get an input string value representing a person's name in the form `Last,First Middle`;  then determine and report the name as `First Middle Last`, as `First Last`, as `Middle Last`.

3. E-mail parts

Get an input value representing a person's e-mail address;  then display a message identifying the user id, the mail server, the domain of the server.

4. URL parts

Get an input string value representing a webpage URL;  then determine and report the host, the path, the file name, the anchor indicator.

5. Build city/state/zip

Get separate input string values representing city, state, and zip code;  then report the address line that would appear on an envelope (with comma between city and state and two spaces before the zip code).

6. Disassemble city/state/zip

Get an input string value representing city, state, and zip (e.g., `Cedar Falls, IA  50614` ;  then report the separate values for city, state, and zip code.

7. Search a string

Get two input string values—a phrase, sentence, or paragraph and a single word;  then determine and report the location of the first occurrence (if any) of the word.

Conditional/Boolean

Boolean expressions are most often used as the conditionals in selection and repetition. However, they are or can be used as flag values and it is not unreasonable to teach them that way. Indeed, separating the formulation of conditional expressions from `if` and `while/until` statements is a good idea. We think of all Boolean expressions as answering a question about the data with yes/True or no/False. The wording of the problems/exercises is typically phrased in a way that seeks a yes/True answer. Note that problem phrasing can be negated and effectively double the number of problems you have.

The tasks/problems provided here are organized according to our (initial/tentative) taxonomy of conditionals. The primary purpose of organization by the taxonomy is to provide a comprehensive set of problem types for students to encounter.

Match (& not match)
1. Answer correct?

Is my response the right answer?

2. Answer wrong?

Did I "miss" this item?

3. Any input?

Declare a variable and set its value to answer the question, "Did the user enter something?" Assume you have an initialized string variable `inputVal` that captured the value, if anything, the user entered.

4. Is input numeric?

Declare a variable and set its value to answer the question, "Is the input value numeric?" Assume you have an initialized string variable `inputVal`.

5. Data entered? (GUI)

Declare a variable and set its value to answer the question, "Did the user enter data in the text box?" Assume you have a text box (`txtInput`) for data entry.

6. Numeric? (GUI)

Declare a variable and set its value to answer the question, "Did the user enter a number in the text box?" Assume you have a text box (`txtValue`) for data entry.

7. Is the number even?

Interact with the user to get a value and indicate whether the number is even (divisible 2)?

8. Divisible by (multiple of)?

Interact with the user to get a value and indicate whether the number is divisible by a particular second value?

9. Perfect square?

Interact with the user to get a value and indicate whether the number is a perfect square (has a square root that is an integer)?

10. Hangman guess?

Declare a variable and set its value to answer the question, "Does the word contain the guessed letter?" Assume you have a variables `word` and `guess`.

11. Pizza choice? (GUI)

Declare a variable and set its value to answer the question, "Did the user indicate a pizza choice?" Assume you a combo box that lists pizza types. The first item in the list is "Select type of pizza". It is preselected and indicates that no selection has been made.

12. Craps: Rolled the point?

Declare a variable and set its value to answer the question, "Did the shooter roll her/his point in the craps game?" Assume you have a variable `roll` indicating the total of two dice rolled and a variable `point` indicating the goal. [In craps, once the point has a value the shooter rolls the point value or a 7 is rolled.]

13. Card an ace?

Declare a variable and set its value to answer the question, "Is the given card an ace?" Cards are represented by the numbers 0-51. Arbitrarily the following representation is assumed, 0: ace spades, 1: 2 spades, 2: 3 spades, ..., 11: queen spades, 12, king spades, 13: ace diamonds, ..., 25: king diamonds, 26 ace clubs, ..., 38: king clubs, 39: ace hearts, ..., 51: king hearts. Assume you have an initialized variable `cardVal` indicating the card in question.

14. Card a diamond?

Declare a variable and set its value to answer the question, "Is the given card an ace?" Card are represented the numbers 0-51. Arbitrarily the following representation is assumed, 0: ace spades, 1: 2 spades, 2: 3 spades, ..., 11: queen spades, 12, king spades, 13: ace diamonds, ..., 25: king diamonds, 26 ace clubs, ..., 38: king clubs, 39: ace hearts, ..., 51: king hearts. Assume you have an initialized variable `cardVal` indicating the card in question.

Threshold (inclusive)
1. Regular pay?

Declare a variable and set its value to answer the question, "Can I calculate pay without overtime?"

2. Old enough?

Declare a variable and set its value to answer the question, "Can I legally purchase alcohol?"

3. Passing the course?

Declare a variable and set its value to answer the question, "Am I passing the course?" Assume you have a variable indicating your course total (out of 100) and that passing means a D or better, i.e., the lowest D score is 17. [your instructor uses a weird grading scale.]

4. Getting an A?

Declare a variable and set its value to answer the question, "Am I getting an A?" Assume you have a variable indicating your course total (out of 100) and that the lowest A score is 84. [your instructor uses a weird grading scale.]

5. Obese?

Declare a variable and set its value to answer the question, "Am I obese?" People with BMI values of 30 or more are considered obese.

6. Do I have enough money?

I saw an item I want that is on sale and wonder if the amount of money I have will cover the cost. Get input values for the the original cost, percent off, and taxrate and indicate whether my cash on hand is sufficient to make the purchase. (Cash on hand will be hard-coded.)

7. Title Length Okay?

Declare a variable and set its value to answer the question, "Is the title length ok?" Assume you have the text of the title in the variable `title`. The title should contain no more than 50 characters.

8. Student a senior? [see grade level selection problem]
9. Is my overall cholesterol value okay? [see the cholesterol selection problem]
Threshold (exclusive)
1. Must pay overtime?

Declare a variable and set its value to answer the question, "Does my pay calculation need to account for overtime?"

2. Too young?

Declare a variable and set its value to answer the question, "Am I too young to legally purchase alcohol?"

3. Below freezing?

Declare a variable and set its value to answer the question, "Is it below freezing outside?" [Freezing point is 32° F, 0° C.]

4. Heads?

Declare a variable and set its value to answer the question, "Did the coin flip result in heads?" Use a randomly generated number to indicate heads (half the possible values should be heads).

5. Student a freshman (see grade level selection problem)
6. Is my overall cholesterol value cause for concern? [see the cholesterol selection problem]
7. Smallest number?

Declare a variable and set its value to answer the question, "Is this value smaller than the smallest value previously encountered?" Assume we are comparing numbers and have initialized variables `currVal` and `leastVal`.

8. Smallest alphabetically?

Declare a variable and set its value to answer the question, "Does this value come before the earliest (alphabetically) value previously encountered?" Assume we are comparing strings and have initialized variables `currVal` and `firstVal`.

Range/Boundary
1. Getting a B?

Declare a variable and set its value to answer the question, "Am I getting a B?" Assume you have a variable indicating your course total (out of 100) and that the B range is 67 - 83. [your instructor uses a weird grading scale.]

2. Abstract Length Okay?

Declare a variable and set its value to answer the question, "Is the abstract's length okay?" Assume you have the text of the title in the variable `abstract`. The abstract should contain between 75 and 200 characters.

3. Normal blood sugar?

Declare a variable and set its value to answer the question, "Is my blood sugar level okay?" Normal blood sugar levels are 70-100 if tested when "fasting" and 70-140 otherwise. Assume you have the variables `bloodSugar` (a number) and `fasting` (a Boolean).

4. Normal height (1)?

Declare a variable and set its value to answer the question, "I'm an American female, is my height normal?" The normal range for height of American females is 64 inches ± 2.5 inches. Assume you have an initialized variable `height`.

5. Door 2?

Declare a variable and set its value to answer the question, "Should I choose door 2?" (There are 3 doors.) Have the computer generate a random number and use it to set your variable to true or false. Think carefully about how you use the random number generator.

(This assumes the random is a value in [0..1). The question could be a "match" problem if random produces integers from 1-3.)

6. Student a sophomore (or junior)? [see grade level selection problem]
7. Light wave is visible? [see light waves selection problem]
8. Is this color red (or blue or ...)? [see light waves selection problem]
9. Teenager? [see teen verifier selection problem]

My grandson keeps claiming he’s a teenager (he’s will be 12 on his next birthday). I want a program for him to run when he says he a teenager and I can tell him to see what the computer says whenever he makes that claim. It should ask him how old he is.

One of (inclusion)
1. Contains a vowel?

Declare a variable and set its value to answer the question, "Does this string contain a vowel?" Assume you have a variable `word` that contains a string to be checked. Consider vowels to be "a", "e", "i", "o", "u", and "y". Also assume the word contains all lower case letters.

2. Blood pressure worrisome?

Declare a variable and set its value to answer the question, "Is the blood pressure reading indicate a possible problem?" Blood pressure could indicate a problem if the systolic value is above 140 or the diastolic value is above 90. Assume you have initialized variables for these values (`systolic` and `diastolic`).

3. Sentence?

Declare a variable and set its value to answer the question, "Does this string value contain a sentence?" It contains a sentence if it contains a period, an exclamation mark, or a question mark. Assume you have an have initialized variables `stringValue`.

4. Pizza size selected? (GUI)

Declare a variable and set its value to answer the question, "Did the user indicate a desired pizza size?" Assume you have radio buttons (`rdoSmall`, `rdoMedium`, `rdoLarge`) that allow for this choice.

5. Ethnicity? (GUI)

Declare a variable and set its value to answer the question, "Did the user indicate an ethnicity?" Assume you have check boxes (`chkAfricAmer`, `chkAsia`, `chkCaucasian`, `chkHispanic`, `chkNative`, `chkDecline`) that allow for this choice.

All of (conjunction)
1. Scholarship Eligibility? (1)

Declare a variable and set its value to answer the question, "Is the candidate eligible for the scholarship?" Eligibility requires being Native American and having a GPA of 2.5 or better. Assume variables with appropriate values have been declared and initialized.

2. Blood pressure okay?

Declare a variable and set its value to answer the question, "Is the blood pressure reading okay?" Blood pressure is okay if the systolic value is below 140 and the diastolic value is below 90. Assume you have initialized variables for these values (`systolic` and `diastolic`).

3. Craps: Seven out?

Declare a variable and set its value to answer the question, "Did the shooter roll a 7 during the point phase of the craps game?" Assume you have a variable `roll` indicating the total of two dice rolled and a variable `inComeOut` indicating whether the state of the game is in the come out phase. The game is always in either the come out phase or the point phase of the game. [In craps, one must be in the point phase for a 7 to lose.]

Eligibility
1. Scholarship Eligibility? (2)

Declare a variable and set its value to answer the question, "Is the candidate eligible for the scholarship?" Eligibility requires two years of high school Spanish and either having a high school GPA of at least 3.0 or having an ACT score of 21 or more. Assume variables with appropriate values have been declared and initialized.

2. Can I draw IPERS?

Declare a variable and set its value to answer the question, "Can I start drawing my IPERS retirement?" To draw IPERS (Iowa Public Employees Retirement System) retirement one must no longer work for and IPERS employer and meet one of three conditions for age and service. The three conditions are: sum of age and years of service equals or exceeds 88; age is at least 62 and years of service is at least 20; age is 65 or more. Assume you have an initialized Boolean variable indicating work status (`IPERSemployer`) and variables with values for age (`age`) and years of service(`years`).

3. Mortgage approved?

A mortgage application can be instantly approved if the applicant has a credit score of 390 or above. Applications can also be approved when the down payment is at least 15% of the mortgage and the applicant has never declared bankruptcy. Suppose you have data in the following variables: `creditScore`, `hasBankruptcy` (True when the applicant has declared bankruptcy), `mortgageAmount`, `downPayment`. Provide an expression that evaluates to true when the application should be approved and false otherwise. Assign the result to a variable called `isEligible`.

4. Can get library card?

The local library only issues library cards to people who can prove that they are residents. To demonstrate residency, one can show a Utility Bill and at least 3 other pieces of official mail. Alternatively, one can show a valid driver’s license. Suppose that you have data already stored in the following variables: `hasUtility` (True if the patron has a utility Bill), `numMail` (a count of the number of additional pieces of official mail), and `hasDL` (True when the patron has a valid driver’s license). Write a single assignment statement that assigns a value to a variable `isResident` according to the library's standards.

5. Eligible for the Kartoffelkopf scholarship?

A person is eligible for the Kartoffelkopf scholarship if their ACT score is above 23 and they either are of German decent or have studied German language for at least 2 years. Suppose that you have data in the following variables: `ACT`, `isGerman` (True when the person is of German ancestry), and `yearsOfGerman`. Assign the variable `isEligible` indicating eligibility for the scholarship.

6. Join the Army?

To join the US Army, it appears you must: be a citizen, be 17-35 years old, have no felony convictions, have a minimal level of education (high school diploma, GED, or 15 semester hours of college coursework), be somewhat phycially fit, have no tattoos on the neck or below the wrist, and not be a single parent. Produce an expression that would indicate whether a person might be able to join the Army.

Status
1. Leap year?

Declare a variable and set its value to answer the question, "Is 'this' a leap year?" [Leap years are divisible by 4 and not divisible by 100 unless they are also divisible by 400. Note, this definition may not be the best way to formulate your expression.]

2. Good golf day?

Declare a variable and set its value to answer the question, "Is this a good day for golf?" Assume you have variables (with values) for temperature (in Fahrenheit) `tempF` and wind speed `wind`. Also assume a boolean variable (with a value) `rain` indicating whether it is raining. A good golf day is one with the temperature between 60 and 90, no rain, and the wind below 20 MPH.

3. Normal height (2)?

Declare a variable and set its value to answer the question, "I'm American, is my height normal?" The normal range for height of American males is 69.5 inches ± 3 inches and for American females 64 ± 2.5 inches. Get input from the user to set values for `height` and `isMale`.

4. Cholesterol levels?

Declare a variable and set its value to answer the question, "Do my cholesterol levels indicate I am at risk?" Risk can come from LDL being too high (above 190), HDL being too low (below 40), triglycerides too high (above 200), or the total cholesterol (HDL + LDL + .2 * triglycerides) being too high (above 250). Assume you have initialized variables (`ldl`, `hdl`, `trygly`) to use.

(Do NOT consider this authoritative. It is put together from various web sources solely for the purpose of generating a programming problem.)

5. Blood sugar okay?

Normal Blood sugar levels are 70-100 when fasting, but 70-140 otherwise. Provide an expression that will answer the question (given a blood sugar value and a value for fasting).

6. Craps: Roll is a natural?

Declare a variable and set its value to answer the question, "Was a 7 or 11 rolled during the come out phase of the craps game?" Assume you have a variable `roll` indicating the total of two dice rolled and a variable `inComeOut` indicating whether the state of the game is in the come out phase. [In craps, one must be in the come out phase for a 7 or 11 to count as a natural.]

7. Craps: Crapped out?

Declare a variable and set its value to answer the question, "Did the shooter roll a 2, 3, or 12 during the come out phase of the craps game?" Assume you have a variable `roll` indicating the total of two dice rolled and a variable `inComeOut` indicating whether the state of the game is in the come out phase. [In craps, one must be in the come out phase for a 2, 3, & 12 to count as a crapping out.]

Selection

There are a number of ways that if statements may be organized:

• simple if—change default or guarded action
• if-then-else—choose between or alternative actions
• if-then-elseif—categorization (typically tests the same value)
• nested if-then-else seeking to answer a single question—decision tree (typically test the same value)
• ?????—any of these nested within one of these (and often not testing the same value)

Generally speaking, the choice of which to use is a matter of personal preference rather than correctness, particularly for novice programmers.

General

1. Report least of two (numeric) values

Get input for two numeric values and identify the lesser of the two.

2. Report greatest of two (string) values

Get input for two string values and identify the greater (which comes last alphabetically) of the two.

3. Report least of three values

Get input for three values and report the lesser of the three (lesser means "comes first alphabetically" for string values).

4. Report relation of guess to actual value

Get input for a guess of a number and report to the user "too high", "too low", or "that's it".

5. Pay

Get input values for hours worked and pay rate;  then determine and report gross and net pay that accounts for overtime. Net pay will be the gross pay less 15% federal tax, 5% state tax, 6.2% FICA, & 1.45% Medicare.

6. Leap year (1)

Get an input value indicating a year and report whether it is a leap year.

7. Determine the student's high school grade level

Students are classified according to the number of credits that they have completed. A freshman is any student with less than 8 credits. With every additional 8 credits students are successively ranked as sophomores, juniors, and seniors. (There is no level above senior, regardless of credits.)

8. Determine the color of light

Our eyes are sensitive to a relatively small band of the electo-magnetic spectrum known as visible light. Visible light can be further classified into bands of color, depending on the wavelength.

9. Can I retire? If not, how long must I wait?

IPERS is the Iowa Public Employees Retirement System. To be eligible to collect pay from IPERS (i.e. to retire), you must meet one of three requirements. a) The sum of the age and years of service equals or exceeds 88; b) age is at least 62 and years service is at least 20; c) age is 65 or more.

10. Is my cholesterol okay? If not, what is problematic?

Cholesterol levels can put people at risk for heart disease. Problems may occur when LDL (bad cholesterol) is too high (above 190), HDL (good cholesterol) is too low (below 40), or triglycerides are too high (above 250). Patients should also be concerned if their overall cholesterol is too high—HDL+LDL+20% of triglycerides is above 250.

11. Discount value (1)

The Thing-a-ma-bob shop offers volume discounts. Thing-a-ma-bobs are \$7.99 each, but on orders of 10 or more, you can get them for \$7.39 each. Produce code that will indicate the price of the order.

12. Shipping cost

Acme Inc. assigns shipping charges at \$1.25 per pound, or a flat rate of \$2 for all orders less than 3 lbs. Prompt the user to enter the weight of their shipment and then compute (and report) the appropriate shipping charges.

13. Final grade

Professor Block’s class has four exams that each count for 25% of your final grade. However, if a student can score 10% better on the final (fourth) exam than the average of their first three exams, Professor Block will count the final exam score as 100% of the final grade. For example, if the student averaged 75% on the first three exams, but earned 83% on the final exam; the final grade would be an 83%. Report a student’s grade based on their exam scores.

14. Leap year (2)

Get an input value indicating a year and report whether it is a leap year. If it is a leap year, indicate so. If it is not a leap year indicate why, i.e., it is not divisible by 4 or it is divisible by 100 but not 400.

15. Title length

Get an input value indicating a title for a article. If the title is too long (more than 50 characters), report that to the user.

16. Abstract length (1)

Get an input value indicating an abstract for a article. If the title is too short (fewer than 150 characters) or too long (more than 300 characters), report to the user that the abstract is of unacceptable length.

17. Abstract length (2)

Get an input value indicating an abstract for an article. Report to the user that the abstract's length is okay, too short, or too long.

18. Roll flooring

Some types of flooring comes in rolls of fixed width, perhaps 12 feet. Get input values for the dimensions of a room and indicate the number of lineal feet of floor covering that will be needed.

19. Cloud cover

The National Weather service provides guidelines for how to describe the cloudiness based on the degree of cloud cover. The following table provides the percentage of cloud cover and the corresponding description. Provide code that accepts the percentage of cloud cover as input and displays the appropriate description.

Percentage Description
0-30 Clear
31-70 Partly Cloudy
71-99 Cloudy
100 Overcast
20. Blood sugar

Normal Blood varies from person to person but a reasonable starting place is that normal sugar levels are 70-100 when fasting, but 70-140 after a meal. Indicate whether, or not, a given blood sugar value is okay under a specified value for fasting (or not).

21. Blood pressure

The table below addresses blood pressure values. Identify the category indicated by a given pair of blood pressure values.

Systolic Diastolic Category
Below 120 and Below 80 Normal
120-139 and Below 80 Elevated
130-139 or 80-89 Hypertension Stage 1
140-180 or 90-120 Hypertension Stage 2
above 180 or above 120 Hypertensive Crisis
22. Discount value (2)

We want to offer price discounts for senior citizens and for veterans. Senior citizens get a discount of 7.5%. Veterans receive a 10% discount. The discounts are additive. Interact with the user to get necessary values and provide the appropriate charge.

(This problem can vary by having the discounts not be additive or by having a specified discount for seniors who are also veterans or by leaving some information ambiguous.)

23. Coin flip

Use the system's random number generator to indicate whether a head or a tail was flipped.

24. Grade determination

Get input values representing a student's total score for the course and the total of possible points; then report the grade for that student score. Assume only A, B, C, D, F will be used—no plusses or minuses.

25. Money conversion

You are planning to take a trip to Europe and need to convert your Dollars to Euros. Your local bank will exchange Dollars to Euros at a rate of .882, after a \$15 service fee. The European bank offers a rate of .801 with no service fee. Which bank will give you the most euros? How many Euros can you get?

26. Triangle identification

Given the lengths of three legs of a potential triangle, you should report type of triangle that results or indicate the values do not form a triangle. Types of triangles are: equilateral (3 equal sides), isosceles (only two equal sides), scalene (all sides are different in length). The values cannot form a triangle if the sum of the two shorter sides is not greater than longest side's length.

27. Craps: come out

Generate random values for two dice rolls. If the roll is craps (2, 3, or 12) report "Craps! New shooter." If the roll is 7 or 11 report "Natural, a winner!" Otherwise set the point variable to the value of the roll and set the come-out flag to False.

28. Craps: point

Generate random values for two dice rolls. If the roll is 7 report "Seven out! New shooter." and set the come-out flag to True. If the roll is the same as the point value report "Point, a winner!" and set the come-out flag to True. Otherwise set the point variable to the value of the roll and set the come out state variable to False.

29. Craps: Validate bet value

Computerized gaming and betting typically has the user/player enter a amount in their bank. Bets must be greater than zero and less than the "bank". Provide code that will get an input value for the bet amount; then report if it is not a valid bet. (No action on valid bets.)

30. Tip calculator (1)

I hate being thought of as a cheap tipper. So I always tip 20% of the meal cost. But I know that people working at inexpensive places work as hard to serve me as those in expensive places so I always tip at least \$4.00. Produce code that will get an input value for the meal cost and report how much to tip according to my rules.

31. Tip calculator (2)

I hate being thought of as a cheap tipper. So I always tip 20% of the meal cost. But I know that people working at inexpensive places work as hard to serve me as those in expensive places so I always tip at least \$4.00. And, I never tip more that \$5.00 per person served. Produce code that will get input values for the meal cost and persons served;  then report how much to tip according to my rules.

32. Arithmetic drill operator

Provide code that will request the user indicate the kind of drill and practice to present (Addition, Subtraction, Multiplication, Division) and set the value of the operator (variable named `op`) to `+`, `–`, `x`, or `/` to be used when displaying problems depending on what was entered (A, S, M, D).

33. Arithmetic drill problem generation

Provide code that will randomly generate arithmetic drill & practice problems for values 0 to 10. The problem will be presented in the form `value1 + value2 = ___` (the "answer" will be known but not shown). For addition and multiplication this is relative straightforward, i.e., `value1` and `value2` are randomly generated and the "answer" is the sum or product of the two. For subtraction and division the two values between 0 and 10 (inclusive) are randomly generated and and their sum or product calculated. That sum or product will be "`value1`" in the problem and the "answer" will be the first of the two generated values. Thus `value1` and `answer` will have their values swapped.

34. Arithmetic drill problem presentation and checking

Provide code that will display arithmetic practice problems in the form `value1 op value2 = ___`. Note that "`op`" is a variable containing one of `+`, `ndash;`, `x`, and `/` and the value of the `answer` will be known but not shown. Assume you have appropriate values for `op`, `value1`, `value2` and `answer`. Accept an input from the user, compare it with the correct answer, and report whether the user was correct.

35. IPERS

Provide code that will accept input indicating age and years of service; then report whether a person with these attributes can begin drawing IPERS retirement. To draw IPERS (Iowa Public Employees Retirement System) retirement one must meet one of three conditions for age and service. The three conditions are: sum of age and years of service equals or exceeds 88; age is at least 62 and years of service is at least 20; age is 65 or more.

36. Time-delay (Thank you, Ben Schafer)

Provide code that will take a given time (in AM/PM form) and add to it another given time (in AM/PM form with no assumptions about the delay value's validity, e.g., 1:90 is valid) and produce the resulting time (in AM/PM form). [A context for this is the publication of school bus pick-up schedules and the scheduled times when there is a school start delay.]

37. Archery target area percentage

A standard archery target has ten rings—rings 1 & 2 are white; 3 & 4, black, 5 & 6 blue; 7 & 8 red; 9 & 10, yellow); the outer ring's outside diameter is 48 inches; each individual ring adds 4.8 inches to the radius of its circle. Get a value indicating color and report the percentage of the whole target that the indicated color constitutes.

38. Teen Verifier

My grandson claims he's a teenager. He isn't. Produce a program that hardcodes his birthdate and indicates if he is a teenager when he runs it. (You will need to find information about the system date. Use any date you wish, I'll put his in it when I get it.]

GUI Oriented

1. Data entered

Provide code that will notify the user if they have clicked the button but not entered any data in the textbox `txtInput`.

2. Number entered

Provide code that will notify the user if they have clicked the button but not entered numerical data in the textbox `txtAge`.

3. Selection made

Provide code that will notify the user if they have clicked the button but not selected anything in the combo box `cboBirthYear`.

4. Pizza size

Check the pizza size radio buttons (`rdoSmall`, `rdoMedium`, `rdoLarge`) to determine the size of a pizza, i.e., set the variable `size` appropriately (10, 12, 16). If none of the radio buttons was selected the variable `orderOkay` should be set to False and the user notified that the size had not be indicated.

5. Pizza toppings

Check the pizza topping checkboxes (`chkHamburger`, `chkSausage`, `chkPepperoni`, `chkMushroom`, `chkPeppers`, `chkOnions`) to determine the toppings for a pizza. While doing so, construct a string indicating the toppings, e.g., `hamburger :: peppers :: onion`. If no toppings were selected the variable `orderOkay` should be set to False and the user notified.

6. Pizza order complete

Combine tests for pizza crust selection, pizza size selection, and pizza toppings selection. When all three have been checked and no error found, record the order.

7. Valid bet

Computerized gaming and betting typically has the user/player enter a amount in their bank. Bets must be greater than zero and less than the "bank". In craps there are a number of possible bets. Provide code that will get an input value for the bet and examine a combo box used to indicate the type of bet. The first and default selection for the combo box is `Select bet type` which is not a valid selection. Report "the" problem if the bet is not valid.

8. Password tester (1)

Assume we have an app that allows people to enter a password length and check radio buttons to indicate the planned content of their password and report whether it would be valid. Each of the following must be included for the password to be valid:  1) lower-case letter, 2) upper-case letter, 3) digit, 4) special character. The length must be at least 9 and all types of characters used for the password to be valid. Check input and report to the user whether the planned password is valid.

9. Coffee price (idea come from Lawrence Snyder's "fluency" text)

A coffee bar serves espresso, cappuccino, latte, cafe Americano, and and brewed coffee. The price depends on the number of shots of espresso and servings of milk included. Shots of espresso will vary with size but additional shots may be requested. The price of brewed coffee depends solely on size. Interact with the user to determine the order and display the price. Be sure to include tax in the price.

Scratch

Selection is used less in Scratch (block languages) than in textual languages because the system is event driven and has many sensors that can be responded to. So, examples are less easy to find but they do still exist. Also, repetition may be introduced with or before selection, so repeated selection tasks are reasonable. (Basic actions and repetition are relatively easy to identify so those other sections to not have a "Scratch" subsection.)

1. Quadrant identifier (1)

Respond to an event (mouse-click or sprite "dropped") by getting coordinate values associated with the event and report which quadrant the event occurred in.

2. Gender determination

Provide user interaction to determine the sprite's gender and set pronouns (her/his, he/she, etc.) and select appropriate costumes.

3. Frogs on the log

Provide user interaction to determine the desired number of frogs in our story. Make sure there are between 2 and 5 frogs.

4. Associate action with a clone

In our game, a sprite clones itself and every fifth clone will have a particular costume, i.e., clone 1 and clone 6 will share costumes. as will 2 & 7, etc. Provide code for the clone that checks its number and determines the appropriate costume.

5. Avoid the shark/monster/...

In our game, a sprite wishes to avoid a particular other sprite. Provide a portion of a script that will cause the sprite to reverse direction when it comes within 5 steps (either vertically or horizontally) of that sprite.

6. Avoid the edge

We want our sprite to move about randomly and draw circles. But we don't want the circle to go off the edge. Provide a portion of a script that will reset the sprite's X- or Y-coordinate to the minimum required distance from the edge.

Repetition

1. Coin flips (1)

Simulate the flipping of a coin repeatedly (e.g., 1,000 times). Record and report the counts of heads and tails.

2. Coin flips (2)

Simulate the flipping of a coin repeatedly with the number of repetitions depending on a value entered by the user. Record and report the counts of heads and tails.

3. Coin flips (3)

Simulate repeated trials of flipping of a coin 1,000 times with the number of trials depending on a value entered by the user. Report the result of each trial. When done report the average counts of heads and tails.

In a GUI context the average might be reported each time a new trial is done.

4. Coin flips (4)

Simulate the flipping of a coin repeatedly until five heads or tails have been flipped in a row.

5. Coin flips (5)

Simulate the flipping of a coin repeatedly until a user-specified number of heads or tails have been flipped in a row. (Be careful with values above 10.)

6. Arithmetic flash cards

Generate, present, and check & report correctness of flash card arithmetic drill and practice facts.

As with coin flipping, one can vary the loop control/stopping mechanism. Possibilities include: repeating a fixed number of times;  repeating until a correctness threshold (e.g., 80%) has been reached with some minimal number of items presented (e.g., 10);  repeating trials of a fixed size until a trial has been completed with a prescribed accuracy rating.

7. General flash cards

Read a file of items and answers (e.g., states & capitals) into a data structure for drill and practice presentation. Randomly select an item, present it, accept a user's "answer", check it, and indicate correctness keeping track of counts of items presented and correct answers.

As with coin flipping, one can vary the loop control/stopping mechanism. Possibilities include: repeating for a fixed number of items;  repeating until a correctness threshold (e.g., 80%) has been reached with some minimal number of items presented (e.g., at least 10 items with 90% correctness);  repeating trials of a fixed size until a trial has been completed with a prescribed accuracy rating.

Also, items answered correctly could be moved to the end of the list and not asked again until all items have been correctly answered. And, with the addition of times-asked and times-correct values for each item one can focus attention on the items the user has had the most difficulty with (maintaining an ordering based on percent correct).

8. Average score

Input (from the user or a file) a set of scores and calculate and report the count and average of the scores.

9. Standard deviation

Input (from the user or a file) a set of scores and calculate and report the count, average, and standard deviation of the scores.

10. Normal values

Input (from the user or a file) a set of scores and calculate and report the count, average, and standard deviation of the scores. Then, reprocess the scores identifying those that are in the normal range, i.e., within one standard deviation of the average.

11. Climate analysis [see "climate analysis" project problem]

Examine a file of climate data to calculate and report a particular statistic.

12. Replace double blanks

Examine a string value (or file) replacing all occurrences of contiguous space characters with a single space.

13. First letters

Build a string consisting of all the first letters of words in a given string or file of text. A word is set of non-blank characters. The first word in the string (or file or line) may or may not be preceded by a space.

14. Last letters

Build a string consisting of all the last letters of words in a given string or file of text. A word is set of non-blank characters. The last word in the string (or file or line) may or may not be followed by a space.

15. Vowel count

Given a string representing a word count the occurrence of vowels (a, e, i, o, u, y) in the word.

16. Password strength

Assume we have an app that allows people to enter a password and reports "strength". Strength depends on: a) length (1 point per character) and one additional point for each of the following characteristics: b) lower-case letter, c) upper-case letter, d) digit, e) special character. Report strength as one of the following: weak (scores less than 9), okay (scores of 9-10, good (scores of 11-12), strong: (scores over 12).

17. String reverse

Provide code that will accept a string value and produce and display the reverse of the string value, i.e., the characters in reverse order.

18. String reverse (2)

Provide code that will accept a string value and produce and display the reverse of the string value, i.e., the words as real words but in reverse order (the last word first).

19. Pig latin

Provide code that will accept a string of text and produces a string that contains the pig-latin version of each of the words in the original string.

20. Train schedule (a spin-off of a Ben Schafer suggestion)

Provide code that will take a beginning time (in AM/PM form), an ending time (in AM/PM form), and an increment value (in AM/PM form) and produce table of values starting with the given time that displays (in AM/PM form) all the time increments between the first time and last time.

21. Syllable count

Given a string representing a word provide code to count and report the syllables in the word using the Flesch reading scale. Computer-based analysis uses the following definitions:

Periods, explanation points, colons and semicolons serve as sentence delimiters; each group of continuous non-blank characters with beginning and ending punctuation removed counts as a word; each vowel in a word is considered one syllable subject to: (a) -es, -ed and -e (except -le) endings are ignored; (b) words of three letters or shorter count as single syllables; and (c) consecutive vowels count as one syllable.

22. Receipt preparation

Values in a list (or array or listbox) have the form `<item name/description> \$###.##`. Provide code that will examine the list and produce a string value containing each of the items with the price values aligned each on a separate "line" (followed by a new line character), a blank line, a labeled subtotal value, a labeled sales tax value, a blank line, and a labeled total value. (The string may be displayed on the screen or written to a file.)

23. Poker: initialize deck

Create a list/array of cards where the cards are represented as the numbers 0-51. Decide which numbers represent which suit & rank combination. Pick a random card position and report its suit and rank.

24. Poker: shuffle

Assume you have an array/list of numbers representing a deck of cards. Shuffle/randomize the deck. One way of doing so is to repeatedly:  1) pick a random position between "first" and "last";  2) swap the value there with the "last" value;  3) reduce "last" by 1. Keep doing this until the "last" becomes equal to "first".

25. Poker: deal

Assume hou have an array/list of numbers representing a shuffled deck of cards. Further assume you have a known number of players each of whom is to be dealt a hand of five cards. Starting at one end of the deck, deal the cards by filling the appropriate number hands with five cards (each hand will be an array/list). The top card should go to the first player, the next card to the second player, etc. Include a mechanism for showing each hand.

26. Poker: sort hand

Assume hou have an array/list of numbers representing a "hand" of five cards. Arrange the cards in order according to their rank. Include a mechanism for showing the hand before and after sorting.

27. Hangman play

Assume you have three string values representing the hangman game:  the word;  letters guessed  and solution. The solution starts out as a sequence of underscores. Provide code that accepts a new user guess and and appropriately updates the values of the letters guessed and the solution. Include a mechanism that shows the updated values.

28. Choice validation

Produce code that will repeatedly ask a user to enter a choice on a multiple choice quiz until an acceptable choice is entered. Acceptable choices are the letters A, B, C, D. If the user enters any other character or the lower case version of those letters the request is to be repeated.

29. Caesar cypher

The printable characters in the ASCII character set (used by computers in most English-speaking countries) begin with the space character and end with the tilde. Their numeric codes are 30 to 126. By subtracting 30 from those values we get 0-97 which can be readily used to "wrap around" when encoding and decoding with a Caesar cypher. Provide code that will take an ASCII string value and produce a result that shifts each character a user-indicated number of places (shift "up"). Check your work by using the same code to shift the code using the negative of the original shift value. the code should report the original string, the encoded string, and the decoded string.

30. Steganography

Devise a mechanism to hide a message in the lowest-order byte of the pixel data in an image. Your mechanism could include using only one color or using only certain pixels. Produce a program that would both place the message and retrieve it.

31. Peeps (Thank you, David Moursund, circa 1977)

Prepare a simulation of peep population. Peeps have consistent lives—birth, finding a mate, reproduction, enjoy life, die. They die at age 6 (or 8 or 10 or ...). At age 2 they mate, each pair producing one offspring by/at age 3 and another by/at age 4. The simulation can proceed for a fixed number or years or until the population stabilizes (perhaps at 0).

32. Quadrant identifier (2) (Scratch)

Respond to an event (mouse-click or sprite "dropped") by getting coordinate values associated with the event and report which quadrant the event occurred in. Use lists for test values and quadrant names.

Final Exam Problems

We often include a complete but hopefully straightforward programming problem on the final exam. To us, such problems should address control structure categories (sequence, selection & repetition), file usage, and data (both simple variables and collections). Some examples are shown below.

1. Place file data in one of two lists

Read email addresses from a file and put each into one of two lists. Those containing `uni.edu` should be placed in one and all the others placed in another.

2. Write list data to a file

Examine all the elements in a list and write/copy the UNI ones (those that contain `uni.edu`) to a file. Write all the others to a separate file.

3. Above & below average

Read a set of integer values into an array from a file. Process the values to calculate the average, then process them again to count the number of items above average and the number of items below average. Report the average and the counts.

4. Average word length

Read text from a file to determine the average word length. Assume words will have one or more spaces after them. Do not include the punctuation characters of . , ? ; : ! at the "end" of a word as part of the length of the word.

5. Word length counts

Read text from a file and produce the counts of the various word lengths (count all words of length 15 or greater as a single length). Report the counts to the user.

6. Sales receipt

Process the items in a list in a pizza ordering app to prepare a receipt for the order. Each item in the list will have a description and a price. The price will be preceded by a dollar sign and be at the end of the list item. The receipt is to contain all the items in the order list, then a subtotal for the cost of everything, then a value for sales tax (7.5% of the subtotal, then a value for tip/gratuity (15% of the subtotal), and finally the overall total (subtotal + tax + gratuity). Each of ordered items and the last three values should have a description in front of the value. The receipt is to be written to a file.

7. Username creation

Assume you have a file of existing usernames (in alphabetical order, each followed by an id number) and a file of incoming personnel (lastname, firstname, middlename, & id number separated by spaces). Process the file of incoming personnel to produce usernames by concatenating the last name (or first 12 characters of it) with two initials and a number if needed to avoid duplicates. If the new name duplicates an existing username append an appropriate number on the end. The revised list of user names & id numbers should be written back out the the username file.

Projects

These problems are meant to exemplify the problems someone might choose to program on their own after having had a programming course. As part of a high school or University class students are taking, they would likely take several weeks to complete. Some problems are substantially less complex in some languages and may not be appropriate. The expectation is that all problems will use:

• data: both simple variables and one or more collections
• control structures: sequence, selection, repetition, and modularization
• files (for input and/or output)
• multiple user tasks/interfaces

It is also assumed that project problems will be relatively involved algorithmically. Note that some of the projects are suitable for (perhaps only for) GUI-using systems. Also note that code for most projects will be available on the web. Some mechanism for ensuring that students develop their own code is essential, perhaps multiple check-in meetings to convince you that students know and produced the code.

Tool Apps

1. Flash cards (with user-based item history)

The program reads a set of questions/items and answers from a file into a collection. The user can choose to be anonymous or to have their own set of practice problems. Items will be selected and presented randomly.

In anonymous mode, the program should provide the user a choice of ways to have the problems presented. Some possibilities are: repeat until I want to stop; repeat for a program-specified number of items, then let me choose to go again or stop; repeat until I get some percentage correct with some minimum number of items; ...

In known-user mode, correctly answered items will be move to the end of the list and not asked again until all items have been answered correctly. The user is allowed to stop when desired and the program will store the items in a file associated with the user. When next the same user runs the program, their personalized problems with history will be used rather than the initial set of problems.

2. Text tools

A collection of tools that includes: character count, word count, frequency distribution on characters, frequency distribution on word lengths, Flesch-Kincaid reading level score, and, if the language readily allows, a frequency distribution of words and automatic suggestion of stop words and key words.

3. Class attendance & participation checkoff

A teacher might like to have program that shows students names in their relative locations in the classroom. The program should allow the teacher to initialize several classes. Thereafter, the teacher can call up a class, mark students as absent or present, revise the attendance record (e.g., a student came in late), and enter participation plusses and minuses. Participation scoring should allow for multiple entries which can be either of a common/standard amount or some multiple of that amount.

4. User name generation

This program has two kinds of users (sys-admin and regular users). The system administrator will run the program periodically to produce usernames for a number of new employees that arrive at the same time using a CSV file with last,first,middle,employee-ID. The default username will be the last name followed by a hyphen and the initials from the first and middle names. If an identical username already exists, an appropriate integer is to be concatenated to the username. Alternatively, a "regular" user may enter a username and id number to change her/his username (the revised one must be unique and the previous record will be deleted). The file of usernames and id numbers exists and should be used to ensure that duplicate usernames do not occur. The username & id file will initially be in alphabetical order by username and is to be so ordered after operation.

5. Pizza order app

A user (customer or server) uses the app to specify pizzas — size, crust, type or build-your-own (with selected toppings — in an order. The order may be revised before submission. Drinks and side dishes should also be included. Item names and prices should read from a file (to allow for changes without coding). Order forms (items ordered, for use by the preparers) and receipts (showing items, prices, subtotals, & tax) should be produced and written to a file (for printing).

Games

1. Craps

One player (the shooter) and (probably) restricted bet types. The program should have the user enter a bank amount and proceed to play. Bet types of pass and don't pass are to be provided (add others if you wish). During play the program should record each bet type and amount and the outcome (won in come out, lost in come out, point make, point not made). When play is over the game should process the record of play to produce an audit trail indicating starting time, number of rounds, number of bets, number of bets won, number of bets lost, amount won, amount lost, and ending time. [This is expected to use a GUI interface.]

2. Blackjack arcade game

One player against the computer dealer. The program should have the user enter a bank amount and proceed to play. During play the program should record each bet amount, any alterations to the bet (e.g., doubling down, split pair), and the outcome. The deck is reshuffled after each hand. The player may split pairs or double down without limit. When play is over the game should process the record of play to produce an audit trail indicating starting time, number of hands, number of bets, number of bets won, number of bets lost, amount won, amount lost, and ending time. [This is expected to use a GUI interface.]

3. Poker arcade game

One player and a particular game, e.g., Jacks or Better. The program should have the user enter a bank amount and proceed to play. During play the program should record each bet amount, the user's play (initial cards and draw), and the outcome. The deck is reshuffled after each hand. A payout table should be followed by the program and be available to the user for viewing. When play is over the game should process the record of play to produce an audit trail indicating starting time, number of hands, number of bets, number of bets won, number of bets lost, amount won, amount lost, and ending time.

4. Connect Four

Player against the computer. The program should include directions to the user and at least two levels of computer play—purely random and defensive (works to block 4 in a row). Results (user, date, games played, games won, average game time) should be recorded for each run. Users should be able to see a report of their history.

5. Concentration

The game can have two players or just one player. For a single player there should be a mechanism for winning & losing (too much time, too many incorrect guesses, ...). The program should provide directions to the user(s) if desired. Results should be recorded: for single players—user, date, times played, times won, average game time—and for pairs—users, date, user1 wins, user2 wins, average game time. Users should be able to see a report of their history.

6. Yahtzee

The game can have one or more players. The program should provide directions to the user(s) if desired. Results should be recorded by player (games played, high score, low score, average score). A set of high scorers should also be filed and updated as necessary. Users should be able to see a report of their history.

Data Processing

1. Web crawler

Assume we have a master list of URLs that includes the URL and the date it was last checked/crawled. Check the web page in a file of URLs appending any new URLs as appropriate to the the master list/file and the to-check list/file. While doing so, provide a separate file containing URLs of pages that meet the user-specified criteria, e.g., include particular words, have more than a specified number of links (or other characteristic), include particular HTML tags (tables, mail-to's, etc.). Avoid checking pages that have not changed since last crawled and update the timestamps in the master list of crawled pages.

2. Climate data analysis

A variety possibilities exist. Build a tool that allows users to specify the analysis result they would like to see (all of them should be implemented).

• Determine the average high and low temperature(s) for a given date over the years.
• Determine record high and low temperatures for a given date.
• Determine the average yearly temperature for each year on record.
• Determine the maximum high and low temperatures for each year on record.
• Determine the overall average temperature and count the days that were below (or above) that temperature
• Identify some statistic/relationship you are interested in and determine & report the results.
3. Encryption/Decryption (1)

After exploring the notion of cryptography, create your own system for encoding a message.

4. Encryption/Decryption (2)

After exploring public-key cryptography, develop a program that implements that activity.