Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ please In this assignment, you will create a program that stores a representation of each item in a collection. You decide what kind of

c++ please

image text in transcribed

image text in transcribed

image text in transcribed

In this assignment, you will create a program that stores a representation of each item in a collection. You decide what kind of items will be stored in your treasure chest: books, DVDs, knitting needles, model cars, wine corks, etc. Pick something that interests you. Next, decide what attributes each item will have: weight, color, number of pages, length, runtime in minutes, number of wheels, etc. You should pick at least 4 attributes, one of which is the item's value (in units of your choice). The objects are stored in a treasure chest that your program will represent with a dynamically allocated two-dimensional array. The program begins by prompting the user for the desired size of the treasure chest. The program will provide a menu that allows the user to: 1. Add an item: prompt the user for a row and column, then prompt the user for the value of each attribute for the item. Store the item's data at the appropriate place in the array. 2. Remove an item: prompt the user for a row and column; if an item is present, remove it (reset attributes to initial/empty values). 3. Generate a random item: prompt the user for a row and column and create a new item with randomly chosen values for its attributes. 4. Show an individual item: prompt the user for a row and column, then output the data stored for that item (its attributes). 5. : give the user something else they can do to an item (Modify an attribute in a particular way? Copy an item from one location to another?). Your choice! Example run: Here, the menu is displayed in a compact way; you choose how to display your menu. Here, each item is displayed with the first letter of its name; you choose how to display items and the treasure chest as part of your design Here, the "terraform planet" option would change the color of a planet to "green." Welcome to the Planet Treasure Chest! Enter number of rows: 3 Enter number of columns : 3 |_1_1_1 |_ _ _ |_l__1 Total value of 0 items: $0 1) Add planet, 2) Remove planet, 3) Add random planet, 4) Show planet, 5) Terraform planet, 6) Quit Please make your choice: 1 Enter row: 2 Enter col: 1 Enter name (string): Tweedle Enter value ($, float): 100 Enter radius (float): 17256.3 Enter color (string): brown |_1_1_1 |_1_1_1 IT 1 Total value of 1 item: $100 1) Add planet, 2) Remove planet, 3) Add random planet, 4) Show planet, 5) Terraform planet, 6) Quit Please make your choice: 3 Enter row: 1 Enter col: Random planet: name: "Dee", value: $27, radius: 243.3 km, color: orange |___1 LID |_TU_1 Total value of 2 items: $127 1) Add planet, 2) Remove planet, 3) Add random planet, 4) Show planet, 5) Terraform planet, 6) Quit Please make your choice: 4 Enter row: 2 Enter col: 1 Planet: name: "Tweedle", value: $100, radius: 17256.3 km, color: brown |_1_1_1 |_DI_1 TITUT Total value of 2 items: $127 1) Add planet, 2) Remove planet, 3) Add random planet, 4) Show planet, 5) Terraform planet, 6) Quit Please make your choice: 6 Implementation don'ts: o No use of global variables, goto, or recursion. o No use of classes, only structs. o Don't try to solve the whole program at once. Start with adding support for one menu option at a time. Get that option working (and tested), then move on to the next one. Use your design as a guide

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

Step: 3

blur-text-image

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

Introduction To Database And Knowledge Base Systems

Authors: S Krishna

1st Edition

9810206208, 978-9810206208

More Books

Students also viewed these Databases questions