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

  Determine the best way to gather business rules

You have been hired by Happy Health to determine the best way to gather business rules for a new phone system.

  Prepare a java simulation program

Given a hash function h, prepare a java simulation program to determine each of the subsequent quantities after 0.8*tablesize random keys have been generated. The keys should be random integers.

  Method level comment

What type of information should be included in a method level comment?

  Determine the visual resolution of resulting image

Drawing in 8.5 by 11 inch sheet is digitized by means of 300 dpi (dots per inch) scanner. Determine the visual resolution of resulting image (number of dots in each dimension)?

  Button to increase or decrease the number of the balls

Simulates a bouncing ball. Extend to allow mulitple balls. You can use the +I or -I button to increase or decrease the number of the balls and use teh Suspend and Resume buttoms to freeze the balls or resume bouncing. For each ball, assign a random c..

  Design an interface interactive game

First, design an interface InteractiveGame that generalizes the playing of any two-person game between a human player and the computer. Design two actual games, Nim and another game of your choice, except TicTacToe, that implement your Interactive..

  Methods

Assignment describe the basic working of methods. How to write a method in java and how to call a method.

  Compare and contrast the treatment of war

Compare and contrast the treatment of war in O'Brien's "The Things They Carried" and Frank O'Connor's "Guest of the Nation." 3-5 page MLA Format

  Case study - greenhouse humidity control

The control system that will respond to sensor information to turn on/off a misting device, turn on/off a watering system and open/close ventilation windows.

  Deadlock and starvation

What is the difference between deadlock and starvation.Explain in a sentence or two how you prevented deadlock in your implementation.

  Mutant bacterium-synthesize the amino acid tyrosine

Consider a mutant bacterium you have isolated which is unable to synthesize the amino acid tyrosine. You grow it in the presence of a chemical mutagen and isolate a single revertant, which is now able to grow in the absence of tyrosine

  One-dimensional array to solve the

In C#, Use a one-dimensional array to solve the following problem. A company pays its salespeople on a commission basis. The salespeople each receive $200 per week plus 9 percent of their gross sales for that week. For example, a salesperson who gros..

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