Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question Create C++ application that simulates a numbered inventory slot system for weapons. The application will be split into two parts, the first of which

Question

Create C++ application that simulates a numbered inventory slot system

for weapons. The application will be split into two parts, the first of which will have the user populating their inventory slots with weapons they will 'buy' from a simple store with a few options. Once the player has their weapons, the second part will be a simulation on switching and using the weapons in the slots. The following criteria will help with the guidelines for this assignment: Inventory Guidelines 1) You can choose to have as many as 9 weapons, but if you choose a minimum, it should at least be 5. 2) The slots will be represented by the number keys 1-9. 3) It will be up to you to choose what weapons you want. It doesn't have to be violent weapons either and they could be something else of your choosing so long as the items can be used. 4) Since the second half of the course introduces abstract data types (classes), you are required to create simple class for your weapons or objects to build objects from. The name of the class should be generic like Weapon or ElderScroll or Wand, etc. Here are the attributes you should create: a. A Boolean flag to know if you own that weapon. b. A string for the weapon name. c. A string for the sound the weapon/item makes when it's used. d. For part of the bonus that is outlined later, an integer for the ammo/uses of each weapon/item. Part 1: The Store 5) The store is represented as a simple menu system with the following options: a. Buy Weapon b. Check Balance c. Exit Store 6) The player will start off with an amount of money that you specify, and the amount should be enough to buy the most expensive weapon the store offers, but not enough to buy ALL the weapons. The details of this is up to you. Some creativity is encouraged. 7) The 'Buy Weapon' interaction consists of asking the player which weapon they want to buy. The slot the weapon goes into should also be conveyed. d. You must check to see if there is already a weapon in that slot. COURSE CODE: GAME1001 - Intro. to Programming Page 2 of 4 e. You must check to see if the player has enough money to buy. f. Hint: If a buy is successful, flip the Boolean flag on the weapon object to true and store that object in your array of weapon objects. i. You can also use this array to ensure that the player doesn't have a weapon in that slot. Also deduct the weapon cost from the player money. 8) The 'Check Balance' option simply displays the amount of money the player has left. 9) The 'Exit Store' option will move the game onto the second stage. You MUST ensure that the player has at least bought one weapon before proceeding. Hint: Loop through the objects array to check if there's an element OR create simple bool variable that is set when the player purchases. Part 2: The Simulation 10)After the store menu loop, your game should go into another loop that represents using the weapons and being able to switch between them. You have lots of freedom to do how you choose but follow the criteria below. 11)During this simulation, you must be able to: a. Switch between weapons by entering an option from 1 to 9 or how many weapons (at least 5) you are using. b. Use a weapon by entering a key option of your choice. Like 'e' or 'f' or something. More details in item 4. 12)You can use simple cin for this as this is basic C++. The downside is you need to hit enter after your option. 13)When you use a weapon/item, output the string from the object attribute that stores a description of the sound when the weapon is used. Use your imagination for the strings but keep it clean. 14)Hint: for this part, you need to keep track of the weapon/item being selected so you should have an int variable that represents the index of the weapon/item. 15)Each weapon/item has a maximum number of uses. Use the attribute I mentioned in 4d to keep track of the ammo/uses. Setup these numbers as you see fit. 16)During the simulation stage, if the weapon/item is used, decrement the ammo/uses from the array. 17)If the weapon/item is spent, output a message that it is out of uses/ammo.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions