Write a program that shows Game sales. The program should use a structure to store the following data about the Game sale: Game company Type of Game (Action, Adventure, Sports etc.) Year of Sale Sale Price The program should use an array of at least 3 structures (3 variables of the same structure). It should let the user enter data into the array, change the contents of any element and display the data stored in the array. The program should have a menu driven interface.  Input Validation: When the data for a new game sale is entered, be sure the user enters data for all the fields. No negative amounts should be entered for a “Sale Price” of the Game An example: You will use 1 structure only and then manipulate that for working with the information. The program should use an array of at least 3 structures (3 variables of the same structure).  An example of the structure: struct Game { string name; string type; int year; double price; };

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a program that shows Game sales. The program should use a structure to store the following data about the Game sale:

Game company

Type of Game (Action, Adventure, Sports etc.)

Year of Sale

Sale Price

The program should use an array of at least 3 structures (3 variables of the same structure). It should let the user enter data into the array, change the contents of any element and display the data stored in the array. The program should have a menu driven interface.

 Input Validation: When the data for a new game sale is entered, be sure the user enters data for all the fields. No negative amounts should be entered for a “Sale Price” of the Game

An example:

You will use 1 structure only and then manipulate that for working with the information.

The program should use an array of at least 3 structures (3 variables of the same structure). 


An example of the structure:
struct Game
{
string name;
string type;
int year;
double price;
};

 

So far I have written that ...

File
Edit
View
Project
Build
Debug
Test
Analyze
Tools
Extensions
Window
Help
Search (Ctrl+Q)
ConsoleApplication23
BM
Debug
x86
> Local Windows Debugger - Auto
IA Live Share
AT
ConsoleApplication23.cpp* + X
E ConsoleApplication23
(Global Scope)
O main)
43
for (int i = 0; i < sz; i++)
{
cout << "\nGame name:
44
« arr[i].name <« endl;
cout <« "Game type" <« arr[i].type <« endl;
cout <« "Game Year" << arr[i].year << endl;
cout <« "Game Price" <« arr[i].price << endl;
45
" «
46
47
48
49
50
cin.ignore();
cout <« "\nPress enter to continue..." << endl;
51
52
53
54
55
int main()
{
56
57
58
int ch = 0;
int i = 0, f = 0;
59
60
61
int num = 0;
62
Game cus_acc_arr[3];
menuInterface(();
cout <« "Please enter a choice: ";
cin >> ch;
63
64
65
66
67
68
if (ch == 1)
{ NewGame (cus_acc_arr, i);
i++;}|
69
70
71
72
else if (ch == 2)
{(cus_acc_arr, num, i); }
73
74
75
100 %
2
Ln: 71
Ch: 18
SPC
CRLF
Output
Show output from: Debug
12:41 PM
P Type here to search
11/20/2020
Diagnostic Tools
近
Transcribed Image Text:File Edit View Project Build Debug Test Analyze Tools Extensions Window Help Search (Ctrl+Q) ConsoleApplication23 BM Debug x86 > Local Windows Debugger - Auto IA Live Share AT ConsoleApplication23.cpp* + X E ConsoleApplication23 (Global Scope) O main) 43 for (int i = 0; i < sz; i++) { cout << "\nGame name: 44 « arr[i].name <« endl; cout <« "Game type" <« arr[i].type <« endl; cout <« "Game Year" << arr[i].year << endl; cout <« "Game Price" <« arr[i].price << endl; 45 " « 46 47 48 49 50 cin.ignore(); cout <« "\nPress enter to continue..." << endl; 51 52 53 54 55 int main() { 56 57 58 int ch = 0; int i = 0, f = 0; 59 60 61 int num = 0; 62 Game cus_acc_arr[3]; menuInterface((); cout <« "Please enter a choice: "; cin >> ch; 63 64 65 66 67 68 if (ch == 1) { NewGame (cus_acc_arr, i); i++;}| 69 70 71 72 else if (ch == 2) {(cus_acc_arr, num, i); } 73 74 75 100 % 2 Ln: 71 Ch: 18 SPC CRLF Output Show output from: Debug 12:41 PM P Type here to search 11/20/2020 Diagnostic Tools 近
File
Edit
View
Project
Build
Debug
Test
Analyze
Tools
Extensions
Window
Help
Search (Ctrl+Q)
ConsoleApplication23
BM
7 2 - S - Debug
> Local Windows Debugger - Auto
x86
IA Live Share
T
ConsoleApplication23.cpp* + x
A ConsoleApplication23
(Global Scope)
O main)
10
double price;
11
12
13
Evoid menuInterface ()
14
15
cout « "Hello please choose one of the following options" <« endl;
cout <« "1. Enter Game Information" << endl:
cout <« "2. Change Game Information" << endl;
cout <« "3. Show All Games" << endl:
16
17
18
19
cout << "4. Exit" << endl;
20
21
22
Evoid NewGame (struct Game arr[], int ind)
{
cout <« "\nPlease Enter Game Name: ";
cin.ignore();
getline(cin, arr[ind].name);
cout <« "Enter Game Type ";
23
24
25
26
27
getline(cin, arr[ind].type);
cout <« "Enter Year Game Was Sold";
cin >> arr[ind].year;
cout <« "Enter Price Of Game";
cin >> arr[ind].price;
28
29
30
31
32
33
34
35
Evoid EditGame (struct Game arr[], int ind)
{
36
37
38
cout
39
40
Evoid GameInfo(struct Game arr[], int sz)
{
41
42
100 %
01
A
2
Ln: 71
Ch: 18
SPC
CRLF
Output
Show output from: Debug
12:41 PM
P Type here to search
11/20/2020
Diagnostic Tools
近
Transcribed Image Text:File Edit View Project Build Debug Test Analyze Tools Extensions Window Help Search (Ctrl+Q) ConsoleApplication23 BM 7 2 - S - Debug > Local Windows Debugger - Auto x86 IA Live Share T ConsoleApplication23.cpp* + x A ConsoleApplication23 (Global Scope) O main) 10 double price; 11 12 13 Evoid menuInterface () 14 15 cout « "Hello please choose one of the following options" <« endl; cout <« "1. Enter Game Information" << endl: cout <« "2. Change Game Information" << endl; cout <« "3. Show All Games" << endl: 16 17 18 19 cout << "4. Exit" << endl; 20 21 22 Evoid NewGame (struct Game arr[], int ind) { cout <« "\nPlease Enter Game Name: "; cin.ignore(); getline(cin, arr[ind].name); cout <« "Enter Game Type "; 23 24 25 26 27 getline(cin, arr[ind].type); cout <« "Enter Year Game Was Sold"; cin >> arr[ind].year; cout <« "Enter Price Of Game"; cin >> arr[ind].price; 28 29 30 31 32 33 34 35 Evoid EditGame (struct Game arr[], int ind) { 36 37 38 cout 39 40 Evoid GameInfo(struct Game arr[], int sz) { 41 42 100 % 01 A 2 Ln: 71 Ch: 18 SPC CRLF Output Show output from: Debug 12:41 PM P Type here to search 11/20/2020 Diagnostic Tools 近
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 6 images

Blurred answer
Knowledge Booster
Graphical User 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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education