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. 1 Create a Game class. It should have the following attributes (with appropriate data types): gameName release Date cost

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Code. 1

 

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
release Date
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 release Date
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,
release Date, and is Multiplayer 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.
T
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 release Date 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 release Date 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, release Date, and is Multiplayer 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. T
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY