PcPI Problem List - cs.uni.edu - University of Northern Iowa [PDF]

Military time to analog time. Accept a value indicating miliary time 00:00 to 23:59 (00 hours & 00 minutes to 23 hou

3 downloads 12 Views 110KB Size

Recommend Stories


RhythmsMusic at the University of Northern Iowa
Never let your sense of morals prevent you from doing what is right. Isaac Asimov

University Billing Office - The University of Iowa
Ask yourself: How confident are you in your abilities to make decisions for yourself? Next

by BA, University of Iowa
What you seek is seeking you. Rumi

The University of Iowa W9
We can't help everyone, but everyone can help someone. Ronald Reagan

Iowa Dairy Industry List
The beauty of a living thing is not the atoms that go into it, but the way those atoms are put together.

Problem List
Everything in the universe is within you. Ask all from yourself. Rumi

List of 'case open' slayings in Iowa
Your big opportunity may be right where you are now. Napoleon Hill

Review of Vendor Rebates Paid to Hospitals, University of Iowa Hospitals & Clincis, Iowa City, Iowa
We must be willing to let go of the life we have planned, so as to have the life that is waiting for

Assistant Professor The University of Iowa
At the end of your life, you will never regret not having passed one more test, not winning one more

University of Iowa Heart and Vascular Center
And you? When will you begin that long journey into yourself? Rumi

Idea Transcript


Problem-centric Programming Instruction—Problem List Stephen Hughes, Coe College J. Philip East, University of Northern Iowa Introduction/Background Several years ago we started revising our approach to teaching programming. The key idea was to introduce language features as needed in the context of doing things—solving problems large and small. That approach diverges significantly from what we consider the traditional and common approach of organizing and teaching around programming language features. We believe it allows a greater emphasis on problem representation and problem solving and better teaches programming. The original spark of this approach arose from Stephen's desire to "walk into class with a list of problems and tell students that by the end of the course, they should be able to solve them". Eventually someone asked, "Where's your problem list?" We hadn't really developed the list. But now we have and here it is. This page is evolving as is our the result of our continued examination of how programming can be better learned and taught. If you have questions, suggestions for improvement of what is included, or something to include, please contact us. At the moment we have not totally figured out how to start working on the big problems we expect students to be able to handle at the end of the course. There are lots of competing notions: avoid overwhelming students at the start emphasize and encourage planning solutions/algorithms provide coding practice in the context or real-life examples (very simple to quite complex) provide lots of opportunities for practice with/learning of problem solving (problem representation & algorithm development) and of coding (language features) We are still working on improving what we do. There is at least one element of our instructional approach that we feel is particularly useful for teaching programming. We try to encourage students to ask themselves a question when they encounter a new problem or experience difficulties — "Why can't I write this program? There are several possible responses to this question with suggested action when an answer is recognized. I don't understand what I am supposed to do In this case the student needs to: re-examine the problem statement identifying specific problem requirements; play with the problem —draw pictures of interaction, imagine inputs & outputs, ...; seek clarification from the originator of the problem, etc. I understand my task but don't know how to proceed A common obstacle novice programmers face arises from difficulty with problem representation. They are not familiar with thinking abstractly in terms of variables and operations on them. The action in this case is to specify the desired outcome and begin problem decomposition from that point. Identify the data needed to produce the outcome and where that data must come from. Identify necessary manipulations of the data. Identify selection and repetition tasks. ... I understand the task but don't know the required manipulations or relevant relationships among the data In this case domain knowledge is lacking. Additional research on the task is required. It may be as simple as looking up a formula or finding rules for a game or ... I know what to do but don't know how to accomplish it in the programming language I am using A different kind of research is needed here. Students can look up information in their text books or online about how some task can be accomplished in the programming language being used. Alternatively, they may need to consider how the problem can be represented using numbers and string or collections of them. Or, they might be encouraged to ask the teacher! I (think I) can write this program In this case the programmer proceeds to produce a program that (perhaps) correctly solves the problem. The programmer might also discover that their plan/algorithm or code did not quite work. Without this or some other mechanism to provide guidance for the programming process students are left to a guess-and-check development process that is inefficient, prone to bad habit formation, and, almost certainly, ineffective. Our original idea was to walk into class with a list of problems. We had no clear idea of what the problems might look like. Since then we have begun categorizing problems according to their size, instructional use, and/or programming concept addressed. Size Exercise problems Exercises allow for illustration of and practice with particular programming concepts. They are "small" and can be solved in a relatively small amount of time. With enough repetition the concepts are learned and eventually generalized as tools useful in larger programs. Final exam problems These problems require the use of all the critical concepts in the course in a context with minimal cognitive load. The goal is to check for conceptual understanding. Syntax is unimportant. Project problems Projects are realistic problems demonstrating the utilization of a full range of programming concepts, non-trivial problem representation, and substantial design considerations (in number and/or complexity). They will vary depending on the language being used. Preferably, students will choose their own project to supply/enhance motivation. Our problem list (below) is is organized in this way. There appears to be at least one more size for which we have not provided sample problems. It falls between the final exam problems and the project problems. Problems in this category would be the weekly problems assigned in a college programming class. They are more complex than the final exam problems but not as involved as projects. A recent (May 19, 2016) article about a new MIT course listed the following set of problems that would fit between final exam and project problems (though they might be a little "harder" than many of us might use :-) a Pandora-like music service; an image filter; a degrees-of-separation mapping; a real-time physics simulation; a solution to a tent packing problem; path collecting the maximum number of coins on a grid; a text auto completer; a route planner that avoids left turns; a variation of the board game Clue; a variation of the arcade game Breakout At the moment we have not included problems of this size in our list. Programming concepts In our minds all programming instruction should address all the fundamental concepts of programming. Those concepts are actions (on data) and the control structures that organize the actions: data and problem representation This part of programming is often overlooked, perhaps because we start with very simple "problems". But, representing the problem for the computer (using numbers and strings, and later collections of them) becomes a huge hurdle as the problems become larger. By explicating problem representation early on we hope to reduce later difficulties. Problem data and manipulations of the data are viewed as analogous to the vocabulary of a natural language—you can't communicate without vocabulary but communication is the goal, not vocabulary knowledge. sequence Again, this seems trivial on small problems, e.g., it is obvious that you must get input values before you can operate on them and the operations must be completed before you can report the results. But, again, the importance of thinking about what needs to be first or after some action, or actions that can occur simultaneously needs to be ingrained as a key aspect of programming. And, initialization often needs to occur before anything else. selection Choosing between actions (or no action) seems simple but also seems to be difficult for some students. We believe the difficulty has two sources, neither of which is the if structure itself. Problem representation causes trouble when generating conditionals used in the if and when coding the actions in the various parts of the scope of the if. And, sequencing actions within and around the if seems to be the second main source of difficulty. We try to overcome the first difficulty by including practice with Boolean expressions with basic actions, data, and sequence. We try to overcome the second difficulty by providing examples of and practice with lots of different (small) problems. repetition Similar to selection, repetition seems simple (to those who know programming) but also seems to be difficulty for some novice students. Again, web believe the difficulty mostly arises from problem representation and sequencing of action within and around the the looping structure. And, again, we view the main solution to the problem to be lots of examples and practice. modularization In addition to correctness & effectiveness issues computer scientists desire, using modules for subtasks is useful in the problem solving process (identifying main subtasks and hiding/ignoring details). It is also a mechanism for extending language features when working on larger problems. Instructional use Problems can be used in various ways in instruction. Those listed below seem obvious but may not include all uses. It seems reasonable to explicitly choose problems for a some reason or combination of reasons rather than using them randomly (though a random selection for assessment does seem reasonable). Demonstration Depending on one's goals, some problems are better suited for demonstration than other due to their: simplicity, complexity, familiarity to students, unfamiliarity to students, single manner of coding, multiplicity of coding alternatives, etc. Motivation Problems can be selected to motivate students (though what motivates one student may turn another off), to motivate particular thoughts in students, to motivate later problem selection, etc. Learning/Practice Learning requires doing and more is better. It is critical that practice activities vary in context particularly with regards to the kind of data used to represent the problem. Fluency with numeric, string, and Boolean data and manipulations provided by the language being used is critical for engendering transfer to problems other than those seen in the instruction. Assessment of learning Assessment (i.e., grading) activity should be separate and distinct from learning activity. Students should not be penalized because they performed less well than others while learning but ultimately were able to perform comparably with other students. Thus, grading should be reserved for specific assessment task except for some marginal amount to encourage the completion of learning activity. The set of problems selected to assess learning should be diverse, e.g., in: problem context, data used, complexity, attention to sequencing of actions, etc.

Finally, The Problems But first two more things. First, 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 suggest 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. 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. 5. Currency conversion Get an input value for number of euros and an exchange rate; then calculate and report the dollars equivalent. 6. Volume conversion Get an input value for cubic feet; then calculate and report the equivalent value for bushels. (And vice-versa.) 7. 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. 8. BMI Get input values for height in inches and weight in pounds; then calculate and report the BMI value (body mass index). 9. 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. 10. 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. 11. 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. 12. 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. 13. 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. 14. 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. 15. 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. Military time to analog time Accept a value indicating miliary time 00:00 to 23:59 (00 hours & 00 minutes to 23 hours and 59 minutes) and convert the value to analog time 00:00-11:59 or 12:00-11:59. 4. 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. 5. 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.) 6. Die roll Produce and report a random value indicating the roll of a six-sided die. 7. Dice rolls Produce and report random values indicating the rolls of each of two six-sided dice. 8. Dice total Produce and report a value representing the sum of the roll of two six-sided dice. 9. Door number Produce and report a random value indicating whether I should choose door 1, 2, or 3 on Let's Make a Deal. 10. 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 Celsius temperature; then calculate and report the related Fahrenheit 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 In the belief that it aids and focuses on problem solving by having students see or consider problem representation in terms of computer data, we try to always provide a context for doing a calculation. Thus, we try to minimize having students do calculations just to illustrate some operator or function. We hope that our "problems" seem realistic to students rather than just made up. The following are not "real" problems but are suggested for having student practice string operations which typically have not been part of the students' 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. The following are more realistic "problems" involving string processing. Note that solutions here may require multiple variables and assignment statements. 1. Welcome, Get an input value representing a person's full name; then display a message welcoming the person using the first name only. 2. Rearranged 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. 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 probably a good idea. We think of all Boolean expressions as answering a question about the data with yes/True or no/False. Thus, the wording of the problems/exercises. General problems 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. Regular pay? Declare a variable and set its value to answer the question, "Can I calculate pay without overtime?" 3. Old enough? Declare a variable and set its value to answer the question, "Can I legally purchase alcohol?" 4. Too young? Declare a variable and set its value to answer the question, "Am I too young to legally purchase alcohol?" Note that the above problems indicate that the way the question is asked affects how the solution is constructed. The following problems generally do not show both ways of asking the question (stating the problem), but they are always implied and can effectively double the number of problems you have. Compound conditionals can become quite complex depending on how the question is asked. 5. 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.] 6. 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.] 7. 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.] 8. 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.] 9. Obese? Declare a variable and set its value to answer the question, "Am I obese?" People with BMI values over 30 are considered obese. 10. Underweight? Declare a variable and set its value to answer the question, "Am I underweight?" People with BMI values below 18.5 are considered underweight. 11. 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.] 12. 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. 13. 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). 14. 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. 15. Hangman guess? Declare a variable and set its value to answer the question, "Does the word contain the guessed letter?" Assume you have a variable with a value for the word and a variable with a value for the user's guess guess. 16. 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. 17. 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. 18. 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.) 19. 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). 20. 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. 21. 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. 22. 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). 23. Normal height (1)? Declare a variable and set its value to answer the question, "I'm an American male, is my height normal?" The normal range for height of American males is 69.5 inches ± 3 inches. Assume you have an initialized variable height. 24. 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 . 25. 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.)

26. Door 2? Declare a variable and set its value to answer the question, "Should I choose door 2?" 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. 27. 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). 28. 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). 29. Contains double spaces? Declare a variable and set its value to answer the question, "Does the text contain two contiguous space characters?" Assume you have an initialized variable with the text (textValue). 30. 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. 31. 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. 32. Smallest number? Declare a variable and set its value to answer the question, "Is this value smaller than the smaller than previously encountered?" Assume we are comparing numbers and have initialized variables currVal and leastVal. 33. Smallest alphabetically? Declare a variable and set its value to answer the question, "Does this value come before the alphabetically earliest value previously encountered?" Assume we are comparing strings and have initialized variables currVal and firstVal. 34. 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. GUI problems Teaching using GUIs means students need to be able to examine values from the GUI elements such as checkboxes, radio buttons, etc. The items below includes that kind of activity. (These questions were framed in the context of Visual Basic but should be relatively general.) 1. Data entered? 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. 2. Numeric? 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. 3. Smaller? Declare a variable and set its value to answer the question, "Did the user indicate a small pizza was desired?" Assume you have a radio button (rdoSmall) that allows for this choice. 4. Size? 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? 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. 6. Pizza? 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. Context-specific problems Some of our larger problem contexts are dice and card games that might require more information than the above problems. Some examples are provided below. Craps 1. Set inComeOut Declare a variable, inComeOut, and set its value to True. [We will use this variable in the context of a craps game.] 2. 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.] 3. 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.] 4. 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.] 5. 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.] Card games 1. 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. 2. 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.

Selection There are a number of ways that if statements may be organized: simple if (and simple conditional)—guarded action if-then-else (and simple conditional)—alternative actions if-then-elseif (and simple conditional)—categorization or case structure nested if-then-else (and simple conditional)—decision tree any of these with a compound conditional (no particular task "pattern") While all these are possible, take care to maintain the emphasis on problems, not on how if statements may be used. Generally speaking the choice of which to use is a matter of personal preference rather than correctness, particularly for novice programmers. General 1. Least of two Get input for two numeric values and identify the lesser of the two. 2. Least of two (2) Get input for two string values and identify the lesser (which comes first alphabetically) of the two. 3. Least of three Get input for three values and report the lesser of the three (lesser means "comes first alphabetically" for string values). 4. Number guessing 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. 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. 8. 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. 9. 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. 10. Abstract length (2) Get an input value indicating an abstract for a article. Report to the user that the abstract's length is okay, too short, or too long. 11. 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. 12. Blood sugar Get an input value indicating blood sugar level and indicate to the user if it is too low, okay, high, or extremely high. The cutoff values are 50, 180, & 400. (Do NOT consider this authoritative. It is put together from various web sources solely for the purpose of generating a programming problem.)

13. Coin flip Use the system's random number generator to indicate whether a head or a tail was flipped. 14. 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. 15. Military time to analog time Accept a value indicating miliary time 00:00 to 23:59 (00 hours & 00 minutes to 23 hours and 59 minutes) and convert the value to analog time 00:00-11:59 AM or 12:00-11:59 PM. 16. 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. 17. 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. 18. Craps: 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". 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.) 19. 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. 20. 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. 21. 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). 22. 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. 23. 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. 24. 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. 25. 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.] 26. 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. GUI Oriented 27. Data entered Provide code that will notify the user if they have clicked the button but not entered any data in the textbox txtInput. 28. Number entered Provide code that will notify the user if they have clicked the button but not entered numerical data in the textbox txtAge. 29. Selection made Provide code that will notify the user if they have clicked the button but not selected anything in the combo box cboBirthYear. 30. 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. 31. 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. 32. 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. 33. 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. 34. 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. 35. Password tester (2) 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 its "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).

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 that that are in the normal range, i.e., within one standard deviation of the average. 11. Replace double blanks Examine a string value (or file) replacing all occurrences of contiguous space characters with a single space. 12. 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. 13. 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. 14. Vowel count Given a string representing a word count the occurrence of vowels (a, e, i, o, u, y) in the word. 15. Password strength Given a string representing a password calculate and report the strength of the password that depends on the number and type of characters used. 16. 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. 17. 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). 18. 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. 19. 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. 20. Syllable count Given a string representing a word provide code to count and report the syllables in the word using the Flesch reading scale. Computerbased 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. 21. Receipt preparation Values in a list (or array or listbox) have the form $###.##. 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.) 22. 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. 23. 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". 24. 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. 25. 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. 26. 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. 27. 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. 28. 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. 29. 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. 30. 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 having produced one offspring by the next year and another by/at age 4. The simulation can proceed for a fixed number or years or until the population stabilizes (perhaps at 0). 31. ? ?

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 and appropriate number on the end. The revised list of user names & id numbers should be written back out the the username file. 8. ? ?

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. The system administrator will run the program periodically to produce usernames for a number of new employees that arrive at the same time. Alternatively, users (or the sys admin) will enter an individual name and id number to generate the default username or a personalized one of their choice. A file of usernames and id numbers exists and should be used to ensure that duplicate usernames (for e-mail addresses) 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 6. 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.] 7. 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.] 8. 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. 9. 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. 10. 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. 11. 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 12. 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. 13. Climate data analysis 14. Encryption/Decryption (1) After exploring the notion of cryptography, create you own system for encoding a message. 15. Encryption/Decryption (2) After exploring public-key cryptography, develop a program that implements that activity. 16. ? ?

Smile Life

When life gives you a hundred reasons to cry, show life that you have a thousand reasons to smile

Get in touch

© Copyright 2015 - 2024 PDFFOX.COM - All rights reserved.