Homework Zero

Due 21 April via email @ 11:59pm

Details: For all questions that require source code, please submit individual files. (ie: you can't show the answers to two questions in one source file).

  1. Please examine the following program. . When you execute it, use the command "java args I love cheese". Now, describe what the parameters to main, the String[] args, do.
  2. Please create a class called Coordinate. This class should have two members. A double called x, and a double called y. This object is to represent a simple two dimensional coordinate.
  3. Please write a program that uses the object in Question 2. This program should have two pointers to Coordinate objects, called a and b. a should represent the coordinate 3,4, and b should represent the coodinate -5,6. Calculate and print out the distance between the two points.
  4. Please rewrite the program in Question 3 to ask the user to enter in the values for both coordinates.
  5. Please write a program that has the user enter 10 x,y coordinates and then prints out the coordinate that is closest to 0,0. You must use an array of Coordinate objects.
  6. Please examine the card object as discussed in class. Please write the game first Jack. Two players play the game first jack. They each take turns pulling cards from an infinite deck. The first player to get a Jack is the winner.
  7. Please write the game Most Jacks. Each player gets 10 cards from an infinite deck. The player with the most number of jacks is the winner. If both players have the same number of jacks, then the world comes to an end and we all loose.

This homework is worth 60 points.