Essay details:

  • Subject area(s): Science
  • Price: Free download
  • Published on: 15th October 2019
  • File format: Text
  • Number of pages: 2

Text preview of this essay:

This page is a preview - download the full version of this essay above.

1.) Introduction: The problem to be solved is to model a (European) Football game in Java. The main components of a football game is it is to be played on a field with 22 players (11 a side on each team) with a round ball which may not be handled (held) during play except for the goalkeeper. It is typically played inside a stadium with a crowd at each venue/stadium.

2.) The object for this framework are as follows. We will have one object (ball) which will have its own size/shape, position and velocity and will act upon a force applied to it by any one of the 22 players. The players will be another object and have similar characteristics as the ball since they will also have position and velocity. The only difference is their ability to move without a force acting on it and other important data they carry. The third object will be a vector object, used to calculate velocity, force and acceleration (essentially the physics) in the framework to model it closest to reality as possible. The final object is a stadium object that defined the environment the players will play in.

2.1 Ball: The instance variables involved in defining the object are as follows.

● The initial position and velocity of each movement object

● The radius of the ball and of the player (space occupied)

● Boolean for whether movement is player

● Gravity and force doubles (to be used by vector for movement)

 Instance methods involved in defining the object include:

● Pass move(only when a player decides to pass)

● Shoot move (much more force involved, therefore different method)

● Drawing the ball with specified radius

2.2 Player: The instance variables involved in defining the object are as follows.

● Initial position and velocity vector for the player

● String for the team the player is in

● Boolean for whether or not player has ball

● String for position of player (attacker/defender)

Instance Methods involved in defining the object include:

● Move (across the pitch according to velocity vector)

● Pass the ball

● Shoot the ball

● Draw the player with specified radius

● Set team: to show what team the player is part of

● Rotate direction to shoot/pass (helper method)

2.3 Vector: The instance variables involved in defining the object are as follows:

● Two doubles that define the vector

Instance Methods involved in defining the object include:

● Adding (to create velocity) and subtracting (inversely)

● Force method: For given magnitude and direction, how should vector change?

2.4 Stadium: The instance variables involved in defining the object:

● String name

● Integer capacity

Instance Methods involved in defining object:

● Get capacity (to show us capacity of stadium)

3.) The game would first start with choosing a stadium and displaying the capacity of the stadium. Then it would load two random teams (two arrays of player objects with length=11 defined by “team” string method assigned). Then the game would begin with their respective starting positions and the ball in the center. The players would be able to interact with the ball and vice versa (cannot occupy the same position but if it comes close enough, the ball will react based on velocity of player). If player has ball and exerts force by passing, ball moves based on direction of player (constant velocity) and if player shoots it also moves according to direction (constant velocity). The ball moves according to force when player runs with ball (then velocity based on force which is defined by velocity of player interacting with ball). The player and ball objects are interacting with each other on a constant basis throughout the game. After a set time limit, the game will end (time limit would be user input in this case).

4.) The problem we sought out to solve was to create a very simple framework for a football game one player could see in a 2D environment. This involved a player, a ball, a stadium and a vector (mainly for physical interactions i.e. movement, velocity, acceleration, gravity effect). The problem of how the players would move would be solved by linking many of the player object instance methods to keystrokes made by the user.

2.) Project Proposal

The project I would like to propose is a virtual stock trading simulator. It would first start with a graph of a particular stock (object) randomly generated based on parameters (i.e. weighted geometric brownian motions with drift). The user would have a starting amount that the program would keep track of in the portfolio and has the ability to buy/sell the stock at a particular price for a fixed amount defined by the program (GUI with two buttons to buy/sell fixed amount of stock according to portfolio size). It would also be able to keep track of the investor's portfolio over time (and would update as the price of the stock also updates) in the top left of the screen. The game would move in increments and pause after a certain number have passed to allow the player to choose buy, sell or continue.

The file I/O involved would be the storage of stock price data for a certain period. The file would have various lists of company names and stock price information (for a given interval period such as minutes or days). The program would take command line argument of file and store it in object called stock.

A few objects to be used is the stock object (that has information about ticker and methods to read file and use numbers in list, convert to int, and store in array to then later graph stochastically (as time progresses/pauses in the game)), the portfolio object (keeps track of current portfolio, how stock price changing the positions you’ve held, displays in the GUI so we can keep track of it and updates every time the game pauses). The button/user interaction object that would keep track of all the buttons that are to be pressed during the simulation and passed on portfolio object to keep track of stock price. There would also have to be an object for the purpose of timekeeping such as a date for the stock which could also be from file I/O.

...(download the rest of the essay above)

About this essay:

This essay was submitted to us by a student in order to help you with your studies.

If you use part of this page in your own work, you need to provide a citation, as follows:

Essay Sauce, . Available from:< > [Accessed 05.06.20].