Arrays and function problem

An engineer keeps an inventory of car parts, but on paper. The usual operations on his ‘inventory

database’ include adding new parts, updating levels of current stock and producing different reports

based on the current stock levels. As the inventory is getting larger, this manual system is becoming

difficult to manage. The engineer decided to develop a computerized system to help him manage the

inventory. As he is not expert in database management systems, he decided to develop his own

application, based on the C++ knowledge he had during his early engineering education. The parts

data are printed as in the following table:

Requirements

Phase2: using arrays and funciton. :

You are required to help this engineer by developing the Inventory Control System. Your system

should perform the following operations:

 Add a new item that asks the user to input data of a new part and then add the data to the

parts file.

 List the current inventory in a tabular format (begin with the partNo followed by the

PartName). In the last column of this list show the total price of each item (i.e.

price*quantity).

 Produce lists of the following:
o To remove apart

o All items whose quantity field < 5.

o All items whose price is greater than a value provided by the user.

Please solve the whole code.I tried so hard ,but couldn't solve the problem
.

data for the parts file
MAKE MODEL. PARTNO. PRICE QUANTITY PARTNAME
camry NA123 1 3.65. 11. BLADE
I tried so hard

We can't see what you did. Therefore, we can't tell what was your mistake.
#include<iostream>
#include<iomanip>
#include<string>
#include <fstream>
using namespace std;

const int arraySize = 1000;
double price[arraySize];
int partNo[arraySize], quantity[arraySize];
string make[arraySize], partName[arraySize];

void menu();
void option(int);
void choice1();

int main()
{
int choice=0;
while (choice != 8)// condtion choice not equal 8
{

menu();//calling menu function
cin >> choice;// enter the choice
option (choice);// calling the switch funtion and send the choice
}

return 0;
}

void menu()// menu function the have the menu output only
{

cout <<"Inventory Control System \n \n"

<< "\t [1] Add part\n"
<< "\t [2] Update part \n"
<< "\t [3] Remove part\n"
<< "\t [4] List inventory \n"
<< "\t [5] Parts whose quantity < 5 \n"
<< "\t [6] Parts above a given price \n"
<< "\t [7] Parts above the average price \n"
<< "\t [8] Stock statistics \n \n"
<< "\t [9] Exit \n \n"

<< "Enter your choice: ";
}

void option(int x)
{
switch(x)
{
case 1 :
choice1();
break;
case 2 :
choice2();
break;
case 3 :
choice3();
break;
case 4 :
choice4();
break;
case 5 :
choice5();
break;
case 6 :
choice6();
break;
case 7 :
choice7();
break;
case 8 :
choice8();
break;
case 9 :
choice9();
break;
default :
cout<<"Wrong choice \n";// if the choice were wrong
}
}
The size of the array is not automatically transferred to the function, so if the size of the array is not specified in advance (at the compilation stage), you need to pass a parameter that contains the number of elements in the array, for example number_of_elements
Topic archived. No new replies allowed.