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

  Program that prompts the user to enter the year and display

Write a program that prompts the user to enter the the year and first day of the year and displays the calendar table for the year on the console. For example , if the user entered the year 2013, and 2 for tuesday, January 1, 2013, your program shoul..

  Program should assign a seat in the first class

If a person enters 1, your program should assign a seat in the first class (rows 1 - 3). If a person enters 2, your program should assign a seat in business class (rows 4 - 7). If a person enters 3, your program should assign a seat in economy class ..

  Class should have a method that returns the average

Write a class named TestScores. The class constructor should accept an array of test scores as its arguments. The class should have a method that returns the average of the test scores.

  Prepare a polynomial-time algorithm

Write a polynomial-time algorithm that, given an initial configuration (P_1, P_2, ..., P_k), decides if it is a winning configuration - Prepare a polynomial-time algorithm that decides if it is a winning configuration.

  Method called printpowersof2 that accepts a maximum number

Write a method called printPowersOf2 that accepts a maximum number as an argument and prints each power of 2 from 20 (1) up to that maximum power, inclusive. For example, consider the following calls: printPowersOf2(3); printPowersOf2(10)

  Tese 14 questions covers java class array link list

these 14 questions covers java class array link list generic class please read carfullynbspnbsp1. suppose we have a

  Web engineering principles

web application development, Web Engineering methodology, UML-based Web Engineering (UWE), models to the expansion of web applications, Object Oriented Web Solutions (OOWS),Web Modeling Language (WebML) methodology, Object-Oriented Hypermedia Design..

  Various ways of exception handling

Various ways of exception handling

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Write a script and verify an logi by reading a file from xl

write a script and verify an logi by reading a file from xl sheet, first time only give the password and get an error message, second time give the email only and get an error message and third time give both email and correct password and get "Signe..

  Create a console-based application named multiplication

Create a console-based application named Multiplication whose main() method asks the user to input and then calls a method named MultiplicationTable(), which displays the results of multiplying the integers by each of the number 2 through 10

  Write a java application that reads a file containing text

Write a Java application that reads a file containing text. Your program should read each line and display it on the console screen preceded by line numbers.

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