Question: You are to write some basic classes in Java. You are to implement Game.java and MainTest.java classes. Each Game object will represent information about a

You are to write some basic classes in Java. You are to implement Game.java and MainTest.java classes. Each Game object will represent information about a specific game that is for sale. Essential data should include:

  • Platform
  • Name
  • Release Date
  • Developer
  • Genre
  • Retail Price
  • Rating

You must implement the complete class, including data members and methods. You must implement:

  • Constructors
  • Getters and Setters
  • printGame() To print out any game object. Example output:
PC Cyberpunk 2077 12/10/2020 CD Projekt Red Studio Action RPG, Role-Playing $59.99 M 

In a test method in file MainTest.java, test your program by doing the following:

  • Create an array (or a list) of Game objects.
  • Create a few Game objects, set their values, and save them to the array (or list).
  • Loop through the array (or list) and output the games.

Create a new class called Inventory.java that will keep track of all the Game inventory. The Inventory class will maintain a list of games that are available for sale. Available operations are as below.

  • Constructor
  • void add(Game)
  • void remove(Game)
  • Game findCheapestGame()
  • Game findMostHighlyRatedGame()
  • void printAveragePriceOfAllGames()

You can use the List provided by the Java API: List Interface and ArrayList class (implements List) Take a look at the provided methods and decide which ones could be of use to you.

Write JUnit tests to test the Inventory.java class. Follow the guidelines as discussed in class:

  • Use AAA (Arrange-Act-Assert) style of testing
  • Have good code coverage (test at the minimum every method excluding simple getters and setters, every branches inside a method, test with boundary values, etc)
  • Have happy cases (at a minimum), and failure cases when a failure can happen

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!