Adopting a working game of ping pong in java

Assignment Help JAVA Programming
Reference no: EM13919704

Object-Oriented Design in Java

This homework is geared towards fine tuning your programming and understanding of GUI/graphics/threading skills. You will be adopting a working (but not correct) game of ping pong in Java, porting it from Applet to Java Swing. You will also be practicing your thread programming skills.

The basic Ping Pong source code available. Please download the code, and make sure you can get it running. To help you along, I'm outlining step by step guidelines for you to follow.

1) Basic port

a. First start by getting the applet version to run.

b. You need to use threads in this project.

c. Now look over the code and understand how the pieces work together.

d. Create a new Java project. You will be porting each of the classes from the example code to swing, so its better to code in empty class and fill in the details....feel free to rename or rethink the pieces of the program, make sure each of the next steps runs before continuing to the next step, MAKE SURE TO ADD COMMENTS TO YOUR CODE.

a. Don't do anything except get a blank window to open up (and close/exit correctly).

b. Port the field class so that you can display a colored field (switch the background color to whatever you like.

c. Port the ball class, so that you can get a bouncing ball on the screen. Don't forget to play around with the ball color.

d. Get the ball to bounce around the screen (for this step you can leave it as it is so that it bounces off the back wall back into the game

e. Port the paddle so that it shows up in the game.

2) More complicated coding

a. Add a score counter; so you can show the current score

b. Add a miss counter; to show how many times the paddle missed the ball

c. Add a hit counter; so that every time the ball is hit, the number is incremented....i.e. every time the ball and paddle meet, the number goes up by one.

d. Convert the ball class, it so that it works for the current window's size....and not as it is done...i.e. if I resize the window, it will still work.

e. Make sure you are not hard coding any of your code to a specific window size

f. Change it so that if the ball misses the paddle (to the right of the paddle) it disappears and the miss counter is incremented.

g. Every 10 times you hit the ball you should get 1 point (on the score counter).

3) Test to see if you can play a regular game of ping pong.

Reference no: EM13919704

Questions Cloud

Freely floating exchange rate system : Under the so called "freely floating exchange rate system,"
Compute the percentage total return : Suppose a stock had an initial price of $59 per share, paid a dividend of $1.5 per share during the year, and had an ending share price of $67. Compute the percentage total return.
What are some of the advantages of using lean manufacturing : Layout decisions can greatly impact productivity, costs, safety, and quality. What are the 3 main types of layouts? Briefly describe each type and explain some of the advantages and disadvantages associated with each type. How can the layout help ..
Piece of equipment costing and after-tax return on equipment : Darling leasign is considering the lease to Major State University of a piece of equipment costing $100,000. The period of the lease will be 8 years. The equipment will be depreciated under MACRS rules for 7-year class assets. Darling's marginal tax ..
Adopting a working game of ping pong in java : Create a new Java project. You will be porting each of the classes from the example code to swing, so its better to code in empty class and fill in the details - Object-Oriented Design in Java
Significant differences among the three treatment means : The following data summarize the results from an independent-measures study comparing three treatment conditions.
What is the bonds conversion ratio and value : The following data apply to Saunders Corporation’s convertible bonds. What is the bond’s conversion ratio? What is the bond’s conversion value? What is the bond’s straight-debt value?
Measures electrical activity in brain : Sonal is at a brain research center, participating in a study. She is hooked up to a machine that measures electrical activity in her brain through the use of electrodes attached to her scalp. This description best characterizes which of the follo..
Prepare a report for the professional gambler : Prepare a report for the professional gambler that summarizes your findings. At some casinos, the dealer is required to stay (stop taking hits) when the dealer hand reaches soft or hard 17.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Prepare a java program to create a bank account

Write a client java program that will use a pre-implemented class BankAccount.java. BankAccount class provides template to create BankAccount objects that represent real world bank accounts

  Java program ask user to enter 10-character telephone number

Write a Java program that asks the user to enter a 10-character telephone number in the format XXX-XXX-XXXX. The program should display the telephone number with any alphabetic characters

  Display random numbers to simulate rolling a die

1. Display random numbers to simulate rolling a die2. Create a java program that simulate a casino game. (rollin a die)

  Write a program in java that reads a file

Write a program in Java that reads a file of numbers of type int and outputs all the numbers to another file, but without there being any duplicate numbers.

  Prepare address book java application

Prepare an application that reads the contents of your address book file and prepare a user guide that includes a description of the functionality of your overall address book system.

  Use java

How to use Java.

  Create a java class named headphone

Create a Java class named HeadPhone to represent a headphone set. The class contains: ? Three constants named LOW, MEDIUM and HIGH with values of 1, 2 and 3 to denote the headphone volume.

  Ask the user to enter a positive non-zero integer value.

Write a program which aske the user to Enter a positve non-zero integer value. if the value enterd zero or negative print as error message and end the program; otherwise, use the integer to call a method displayPattern(n) which must display the follo..

  Java program to read line of text which ends with period

Write down the java program which will read the line of text which ends with the period, which serves as sentinel value. Show all the letters which occur in the text.

  Demonstrate all of the methods of your stack.

Create a StackTest.java file to demonstrate all of the methods of your stack. Instantiate two stacks; one for String and one for Integer. Push words/integers onto your stack. After you have pushed a series of words/integers on your stack use..

  The continual rise in popularity of php as a solution

Question: With the continual rise in popularity of PHP as a solution to e-commerce applications and the tendency to protect intellectual property, just how open do you think the future will be as far as Web application development is concerned? For t..

  Create a class rectangle with attributes length and width

Create a class Rectangle with attributes length and width, each of which defaults to 1. Provide member function that calculate and the area of the rectangle.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd