External Exam Download Resources Web Applications Games Recycle Bin

exercises



  1. Write a program that writes “My Kitchen Rules” to the screen
  2. write a program that outputs a sentence from a dank meme
  3. Write a program that asks for a user name, and tells the user they are a meme
  4. Write a program that adds 1 plus 1 together and outputs the answer
  5. write a program that inputs two whole numbers into two variables (lets say x and y), then outputs the sum, product and difference of those two numbers.
  6. write a program that outputs the role of a dice. Challenge: add a second dice and calculate the total (so this could be used in monopoly)
  7. Write a program that asks a user the colour of a traffic light. If it is a “green” light, output “go”. If it is a “yellow” light, output “wait”. If it is a “red” light, output “stop”.   help
  8. write a program that inputs the current temperature as a whole number (celcius) and tells me whether it is hot or cold (lets assume hot is anything 20 or over, everything else is cold).
  9. try to get your program to 'pause'..   help
  10. write a program that puts your computer into an infinite loop (hint: when 1 == 1)
  11. write a program that calculates simple interest. Challenge: put the formula to calculate simple interest into a method
  12. write a program that counts from 0-50, and for each number counted the program tells me if it is an even or odd number
  13. write a program that uses a method to find the area of a rectangle
  14. write a program that adds together all the even numbers from 0 to 100    help
  15. Write a program that adds all the odd numbers together from 1 to n (where n is a number inputted by a user)   help
  16. Write a program that uses a method to calculate the area of a circle   help
  17. Write an algorithm and program that inputs 5 numbers and calculates the average   help
  18. Write an algorithm that lists prime numbers between 1 and 20
  19. Code the algorithm that lists prime numbers between 1 and 20 (use mod / %)   help
  20. sort a simple array of five integer elements into ascending order
  21. write a program that finds the max, min and average of an array of 5 integers
  22. try and sort an array of n integers into descending order (where n is a whole integer number inputted by the user)
  23. write a multidimensional String array that stores the location of 3 sunken treasures (use the String value "Sunken Treasure" to designate this) at 3 random co-ordinates on an x and y axis to simulate a map of the ocean (you can limit the axis to values between 0 and 10)
  24. right a recursive java program to calculate the factorial of a number, e.g. 5! = 5 * 4 * 3 * 2 * 1 = 120

  25. currency converter: Write a program that converts any number to a currency string, e.g. 4 = “four dollars”
     help
  26. simple golf game: Welcome to Emerald Lakes Golf Club! You are 463m away from the hole. Please choose a club: A) Driver: 200m - 250m B) 5-Iron: 140m - 180m C) Sand Wedge: 30m - 100m D) Putter: 1m - 15m [>>A] You have chosen the Driver. You hit the ball 234m You are 229m away from the hole. Please choose a club: etc. randomize shot lengths

  27. Higher / lower. The computer picks a number between 1 and 10. I (the user) get 3 guesses. On each incorrect guess, the computer tells me if my guess was higher / lower than original number. After 3 guesses the computer tells me what the number was. Alternatively if I guess correctly, the computer tells me how many guesses it took me. I then get an option to play again or exit. Challenges: Give the user the option to set the variables in the game at run time – numOfGuessesAllowed, rangeMaxNum, rangeMinNum. Add new variables to keep track of: gamesPlayed, timesSolved, timesFailed, quickestFind

  28. Naughts and crosses The game board is represented by three lines of text:
    123
    456
    789
    Player “X” goes first:
    X23
    456
    789
    Player “O” goes next:
    X23
    4O6
    789
    The game continues until all 9 squares are filled. Challenges: Make Player “O” a computer player (so randomise their move). Make it check for “3 in a row” after each go, and display the winner if there is 3 in a row

  29.  help
  30. card deck: create an OOP class for a deck of cards with the methods shuffle() and drawOneCard(). also create a constructor that populates the deck.

  31.  help - deck class  help - card game / main method
  32. add the variable health to the Player class in the Object Oriented Programming examples. set it to 100 when an object of the class is instantiated (which means created). add the methods gainHealth(int amt) and loseHealth(int amt) to the class. write code for these, where amt is the amount of health i gain / lose.

  33. Finish the game of battleships from the multi-dimensional array examples. challenge: do it with methods (so make it modular, which means keep the main method short). epic mlg challenge: do it using object oriented programming techniques