代写一个简易的游戏仓库,用于管理游戏。
Requirement
Please submit the following java programs in a zipped folder on Canvas:
- Video Game Inventory:
- Video Game Class (20 pts) - VideoGame.java
- Video game Collection (30 pts)- GameCollection.java
- Video Game Driver (10 pts)- VGDriver.java
Remember to include the pledge as a comment in every single file that you
submit, followed by your name and U number.
“I pledge my Honor that I have not cheated, and will not cheat, on this
assignment”
[insert name here], [insert U-number here]
Not including the pledge will result in a 50% deduction of points for every
file that does not have it. And no, putting one pledge as a comment on Canvas
does not count.
Video Game Inventory
On canvas, you received an Array of Objects example that shows you how to
manage a DVD collection. Modify that code so that it manages a Videogame
collection instead.
You will need to perform the following steps:
Using the DVD class as a template:
- Create a class called VideoGame that has the following private members:
* Game title (String)
* Game publisher (String)
* Year the game was released (int)
* Platform the game is played on (String)
* Price of the game (double)
* Completed status (boolean) - Modify the constructor so that it sets up a VideoGame object
- Modify the toString so that it displays the contents of the VideoGame object
* Modify the if statement so that if the status is true, add the string “Finished” to the data.
Using the DVDCollection class as a template: - Create a class called GameCollection that has the following private members:
* An array of VideoGame objects
* Amount of games (int)
* total cost of games (double) - Modify the constructor so that it creates a VideoGame array of size 100
* Keep the initial values of count and totalValues from the template - Modify the addDVD method (call it addGame) so that it accepts the 6 corresponding parameters for a video game to set up a VideoGame object
- Modify the toString method to Display information for the VideoGame collection
- Modify the increaseSize method so that it doubles the size of the VideoGame array if needed
Using the Movie class is as template: - Create a driver program called GameDriver, that tests your VideoGame Array object
- Use the addGame method to add at least three games to the array
- Check the contents of the array
- Add at least one more game to the array using the addGame method
- Check the updated contents of the array
A sample of the output is shown below:
——————————————-
My Video Game Collection
Number of Games: 3
Total cost: $60.97
Average cost: $20.32
Video Game List:
$15.99 1997 Final Fantasy VII Square Enix PlayStation Finished!
$19.99 2004 Ninja Gaiden Ubisoft Xbox
$24.99 2005 Kingdom Hearts II Square Enix PlayStation 2 Finished!
-------------------------------------------
My Video Game Collection
Number of Games: 4
Total cost: $82.92
Average cost: $20.73
Video Game List:
$15.99 1997 Final Fantasy VII Square Enix PlayStation Finished!
$19.99 2004 Ninja Gaiden Ubisoft Xbox
$24.99 2005 Kingdom Hearts II Square Enix PlayStation 2 Finished!
$21.95 2013 Tomb Raider Square Enix PlayStation 3
Tips:
- Keep in mind that the length of the string of your name can affect the formatting of the output (as it does in the sample), but it’s ok if this happens.