help me solve this in the Java language. The Game class is part 1, but I need you guys to help me with part 2 only. I've already know part 1. Here is my Game Class of part 1. Based on that help me with part 2. public class Test1 { class Game { private String gameName; private String releaseDate; private double cost; private boolean isMultiplayer; public Game () { cost = 0.0; isMultiplayer = false; gameName = "";
*** Please help me solve this in the Java language. The Game class is part 1, but I need you guys to help me with part 2 only. I've already know part 1. Here is my Game Class of part 1. Based on that help me with part 2.
public class Test1 {
class Game {
private String gameName;
private String releaseDate;
private double cost;
private boolean isMultiplayer;
public Game () {
cost = 0.0;
isMultiplayer = false;
gameName = "";
releaseDate = "";
}
public Game (double cost, boolean isMultiplayer, String gameName, String releaseDate) {
if (cost < 0) {
this.cost = 0.0;
}
else {
this.cost = cost;
this.isMultiplayer = isMultiplayer;
this.gameName = gameName;
this.releaseDate = releaseDate;
}
}
public void setgameName (String gameName) {
this.gameName = gameName;
}
public void setreleaseDate (String releaseDate) {
this.releaseDate = releaseDate;
}
public void setisMultiplayer (boolean isMultiplayer){
this.isMultiplayer = isMultiplayer;
}
public void setCost (double cost) {
if (cost < 0) {
this.cost = 0.0;
}
else {
this.cost = cost;
}
}
String getgameName() {
return this.gameName;
}
String getreleaseDate() {
return this.releaseDate;
}
boolean getisMultiplayer() {
return this.isMultiplayer;
}
// Method to calculate the cost
public double CalculateCost (double taxPercentage, double discountPercentage) {
if (cost > 0) {
return (cost + (cost * taxPercentage / 100) - (cost * discountPercentage / 100));
}
else
return 0;
}
}
}
![Part 1:
You have been hired by a retro
game shop to develop a digital inventory system for
their stock. This program will bring their business into
the 21st century! Your first task is simple – develop a
class that models an individual game in inventory. You
will use this class to create objects in the next two
parts of this test.
Create a Game class. It should have the following
attributes (with appropriate data types):
gameName
releaseDate
cost
isMultiplayer
The attributes should be designed with proper
encapsulation in mind.
It should also have the following public methods:
Default constructor that initializes cost to 0.0,
isMultiplayer to false, and gameName and releaseDate
to null or empty.
An overloaded constructor that takes in four values as
parameters and assigns them to the correct data
attribute in the Game object. If the cost parameter is
less than 0.0, assign cost to 0.0.
Getter and setter methods for gameName,
releaseDate, and isMultiplayer data attributes.
Setter method for cost.
A calculateCost() method that takes in a
"taxPercentage" and "discountPercentage" parameter.
It should return the cost of the item plus the tax, minus
any discount if that parameter is greater than 0.0. The
object's cost variable should not be changed by this
operation – it should only be used as part of the
equation to return the final price.
There is no need to create a driver class for Part 1; you
will do this in Part 2 and Part 3.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F9e4bcf82-2d8b-4d97-9bca-b14a409e8c50%2F4bcf5be7-e051-4303-ac4a-e58b8eae6359%2Fao8dvie_processed.jpeg&w=3840&q=75)
![will do this in Part 2 and Part 3.
Part 2:
Customers often ask if a particular
game is in stock, and if they can afford to buy it.
Employees sometimes have trouble finding this
information, or calculating the cost (including applying
the 6% sales tax and any discounts the customer has
earned). Now that you have developed a Game class,
you can use it to create an inventory system that will
help employees answer these questions more
efficiently.
Create an Inventory file in the same
package/namespace as the Game class from Part 1.
The Inventory file will be a driver class. In it, you will
create a one dimensional array (size 4) of datatype
Game. you will prompt the user to enter the required
information to create all four Game objects, and then
add them to the array.
Once the array has been initialized and filled with
Game objects, prompt the user to enter a game name,
how much they can afford to pay, and whether or not
they are a Retro Shop Member TM. Based on their
responses, search the array using Linear Search and
do the following:
If the game does not exist, inform the user that it's out
of stock
If the game does exist:
If the cost (plus a 6% sales tax) is less than or equal to
the user's maximum price limit, tell the user that they
can purchase the game
If the cost (plus a 6% sales tax) is greater than the
user's maximum price limit:
If the user is not a Retro Shop Member, inform them of
the game's price and encourage them to become a
Retro Shop Member.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F9e4bcf82-2d8b-4d97-9bca-b14a409e8c50%2F4bcf5be7-e051-4303-ac4a-e58b8eae6359%2Fyo174rt_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)