Spring Semester 2003


Midterm Exam: What, When, Where, Why. How.

As an UNDERGRADUATE:

As a GRADUATE student:

Problems you can choose from:

  1. (Submitted by Shon Doseck)

    As an exercise in maintaining state, implement a script to track an online shopper's wishlist. Similar to a shopping cart application, the list will reference items from an inventory and provide the user an ability to remove selected items from the list. While viewing the inventory or catalog of items, the user is able to select an item to be included on their wishlist. The wish list is generated at the bottom of or on a separate page from the inventory. From the wishlist, the user is also able to remove any of the items already selected.

  2. (The First to 100 Wins!)

    You're playing a game with the computer. You take turns. You start at 0 (zero). When one's turn comes one can add at least 1 and at most 10 to the current number. Whoever makes the number 100 or bigger, wins the game.

  3. (The Rock, Paper, Scissors Game).

    You and the computer play a game. When the game starts the score is 0 (zero) for the computer, and 0 (zero) for you. The computer chooses FIRST (paper, rock, scissors). Then you choose and submit the choice. The computer checks and determines who gets the point (your or the computer). Then the new scores are updated, listed, and the computer makes a new choice and you get to provide one and thus you keep playing.

  4. (The Game of Nim)

    Two players (you and the computer) alternately take marbles from a pile of 100 marbles. In each move, a player chooses how many marbles to take, then removes the marbles. The player must take at least one but at most half of the marbles (unless there's only one left, in which case the player must take it). Then the other player takes a turn. The player who takes the last marble loses. Your program should report the current height of the pile and determine who wins at the end.

  5. (Fibonacci Numbers)

    The first two Fibonacci numbers are 1 and 1. All the other Fibonacci numbers are calculated by summing up the two previous numbers. Write a program that allows you to look at the Fibonacci numbers starting at the beginning and generating a new number every time you click Proceed.

  6. (Guess the Number in Ten Tries)

    This is the problem in Lab Seven.

  7. (A Simple Vending Machine)

    Implement a web script that would behave more or less like this:

    prompt> java Vendor
    Welcome. We sell stamps ($3.40) Please enter money:
    enter> nickel nickel dollar dollar quarter
    Thanks. Your credit is $2.35 I need $1.05 more.  
    enter> cent cent
    Thanks. Your credit is $2.37 I need $1.03 more. 
    enter> dollar quarter
    Thanks. Your credit is $3.62 The stamps are yours.
    Your change is: $0.22
    Thanks for using this program. 
    This being a web script, it should provide the behaviour of your calculator.

  8. (PHP Hangman)

    Implement the Hangman game in PHP.

  9. (Submitted by Jennifer J. Allen)

    Create a addition/subtraction game for a child that consists of twenty questions. The child is given two random numbers(less than 100 but bigger than -100) and chooses addition or subtraction (or multiplication or division), and submits an answer. If the child submits the wrong answer, the right answer is displayed. The total number of correct answers is presented at the end of the game.

  10. (Submitted by Meagan Cockram)

    Suppose you are starting a website about something that needs discussion of ideas such as organic gardening methods or cheap travel for students. Now suppose you want to have a message board where users can submit their comments and have it appear on the site. The comments can be ordered from oldest to most recent, or most recent to oldest. This is not like our a348 discussion board. It's much more primitive because it doesn't link to the message using the subject line, or provide an opportunity for the user to reply to a specific comment. Think carefully about maintaining state. Is there any way to do it on the client's side?

  11. (Submitted by Jennifer J. Allen)

    The game of twenty one: The player competes with the computer in a match of 5 games of Black Jack (otherwise known as twenty-one). Each game consists of the following: The computer will deal the player two cards and will also show the player one of the computer's cards two cards. "Cards" are simply random numbers between one and eleven. The player can request another card after looking at his/her current hand. The computer is dealt another card if it's hand is less than 13. The object of the game is to get a higher score than the computer without exceeding 21. If your hand totals 21 exactly you automatically win. Five games are played. After five games, a final winner is determined based on the total number of games won.

  12. (Submitted by Raghuveer Mukkamalla)

    As a graduate student requirement, I propose the Prisoner's Dilemma problem.

    The details can be found at

    http://serendip.brynmawr.edu/bb/pd.html
  13. (Submitted by Jamie Long)

    Create a simple online message board for personal notes. It should consist of a simple form where you can enter text into some fields (time/date, message, etc). When you hit submit, the next screen should show a posted version of the message you just typed. This screen should also include another blank form where you can add another message. Once you complete the form again and hit submit, the next screen should show a posted version of the original message followed by the last message you just typed. With each subsequent posting the overall message thread should increase by one more message. When the total number of messages reaches 10, the system should notify the user that a new message thread needs to be started and the system should reset back to the beginning with a blank form and no posted messages.

  14. (Submitted by Jocelyn Bauer)

    My suggestion for a problem for the midterm is tictactoe played against the computer. You enter in the row and column that you want to place your X and the program checks that it's a valid move and then places you there if it is. The computer then makes a random move and the tictactoe board is refreshed.


Last updated: Feb 24, 2003 by Adrian German for A348/A548