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 = "";

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 1CP: In previous chapters, you have created programs for the Greenville Idol competition. Now create a...
icon
Related questions
Question

*** 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.
Transcribed Image Text: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.
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.
Transcribed Image Text: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.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Developing computer interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage