Modify your inventory management system created in
previous assignment (assignments 2) to use dynamic memory
allocation (instead of the fixed size array) and files to store the
inventory information, so that there is no limitation on how much
items your application could support and user doesn’t need to input
the data over and over again.
assignment2
Your application shall maintain the following information regarding
an item.
Item ID – unsigned long
Item name – string
Item cost – float
Quantity - int
Following are the list of administrative functionalities your
application shall support:
1. Add new item to the inventory. This function will be used to add
a single new item into the inventory management system.
2. Print all item information in the store - This function will be
used to display all items in the inventory. When this option is
selected system shall print Item ID, Item name, Item cost and
quantity.
3. Find item by ID – This function will be used to search item
using an ID. If item exist print item information. If not display
an error indicating item not found.
4. Find item by name – This function will be used to search item
using name. If item exist print item information. If not display an
error indicating item not found.
5. Sort item by Name – This function will be used to sort all the
items in the store by name.
Write a menu driven application in C++. Here is a sample
menu.
Inventory Management System Menu
1. Add new item
2. Print item list
3. Find item by ID
4. Find item by name
5. Sort by name
6. Quit
Select: _
Note:
Menu should be repeatedly prompted to the user until the Quit
option is selected.
Use the class construct to define an item. Keep the item
properties as private member of the class and expose public
accessor methods.
Submit the source file (.cpp).
//C++ program
#include<iostream>
using namespace std;
class Item{
private:
unsigned long Item_ID ;
string ItemName;
float ItemCost;
int Quantity ;
public:
Item(){}
Item(unsigned long id , string
name,float cost,int quant){
Item_ID =
id;
ItemName =
name;
ItemCost =
cost;
Quantity =
quant;
}
void setID(unsigned long id){
Item_ID =
id;
}
void setName(string name){
ItemName =
name;
}
void setCost(float cost){
ItemCost =
cost;
}
void setQuantity(int quant){
Quantity =
quant;
}
unsigned long getID(){
return Item_ID
;
}
string getName(){
return ItemName
;
}
float getCost(){
return
ItemCost;
}
int getQuantity(){
return Quantity
;
}
};
class inventory{
private:
Item *arr;
int capacity;
int noOfItem;
public:
inventory(int size){
arr = new
Item[size];
capacity =
size;
noOfItem=0;
}
void addItem(Item item){
if(noOfItem==capacity){
cout<<"Inventory Full\n";
return;
}
arr[noOfItem++]
= item;
}
void print(){
for(int
i=0;i<noOfItem;i++){
cout<<"Item"<<i+1<<"\n";
cout<<arr[i].getID()<<"\n";
cout<<arr[i].getName()<<"\n";
cout<<arr[i].getCost()<<"\n";
cout<<arr[i].getQuantity()<<"\n\n";
}
}
void findById(unsigned long
id){
int i;
for(i=0;i<noOfItem;i++)
if(arr[i].getID()==id)break;
if(i==noOfItem){
cout<<"item not found.\n";
return;
}
cout<<arr[i].getID()<<"\n";
cout<<arr[i].getName()<<"\n";
cout<<arr[i].getCost()<<"\n";
cout<<arr[i].getQuantity()<<"\n\n";
}
void findByName(string name){
int i;
for(i=0;i<noOfItem;i++)
if(arr[i].getName()==name)break;
if(i==noOfItem){
cout<<"item not found.\n";
return;
}
cout<<arr[i].getID()<<"\n";
cout<<arr[i].getName()<<"\n";
cout<<arr[i].getCost()<<"\n";
cout<<arr[i].getQuantity()<<"\n\n";
}
void sortByName(){
for(int
i=noOfItem-1;i>=0;i--){
for(int j=0;j<i;j++){
if(arr[j].getName()>arr[j+1].getName()){
Item temp=arr[j];
arr[j]=arr[j+1];
arr[j+1]=temp;
}
}
}
}
};
int main(){
int choice;
unsigned long id ;
string name;
float cost;
int quant ;
inventory in(20);
do{
cout<<"1. Add new item\n2. Print item list\n3.
Find item by ID\n4. Find item by name\n5. Sort by name\n6.
Quit\nSelect:";
cin>>choice;
switch(choice){
case 1:{
cout<<"Enter Id : ";
cin>>id;
cout<<"Enter name : ";
cin.get();
getline(cin,name);
cout<<"Enter cost : ";
cin>>cost;
cout<<"Enter Quantity : ";
cin>>quant;
in.addItem(*(new
Item(id,name,cost,quant)));
break;
}
case 2:{
in.print();
break;
}
case 3:{
cout<<"Enter Id : ";
cin>>id;
in.findById(id);
break;
}
case 4:{
cout<<"Enter name : ";
cin.get();
getline(cin,name);
in.findByName(name);
break;
}
case 5:{
in.sortByName();
break;
}
default:{
cout<<"Invalid input\n";
break;
}
}
}while(choice!=6);
return 0;
}
Modify your inventory management system created in previous assignment (assignments 2) to use dynamic memory allocation...
Inventory ManagementObjectives:Use inheritance to create base and child classesUtilize multiple classes in the same programPerform standard input validationImplement a solution that uses polymorphismProblem:A small electronics company has hired you to write an application to manage their inventory. The company requested a role-based access control (RBAC) to increase the security around using the new application. The company also requested that the application menu must be flexible enough to allow adding new menu items to the menu with minimal changes. This includes...
Review structures, pointers and dynamic memory allocation from CSIT 839. Also, review pointers and dynamic memory allocation posted here under Pages. For sorting, you can refer to the textbook for Co Sci 839 or google "C++ sort functions". I've also included under files, a sample C++ source file named sort_binsearch.cpp which gives an example of both sorting and binary search. The Bubble sort is the simplest. For binary search too, you can refer to Co Sci 839 or google: "binary...
Write the following program in C++. Review structures, pointers and dynamic memory allocation from CSIT 839. Also, review pointers and dynamic memory allocation posted here under Pages. For sorting, you can refer to the textbook for Co Sci 839 or google "C++ sort functions". I've also included under files, a sample C++ source file named sort_binsearch.cpp which gives an example of both sorting and binary search. The Bubble sort is the simplest. For binary search too, you can refer to...
Hw08FinalProjectStudentList.txt
1,Simon,Jefferson,gy3085,4.0,2019
2,John,Johnson,xy1242,3.9,2019
3,Kayla,Anderson,as1324,3.8,2019
4,David,Kidman,re5423,3.8,2017
5,Mary,Coleman,ze7698,3.8,2018
Description: This assignment is going to evaluate your overall knowledge of the Java Programming. You shall implement a program which can store and retrieve student list. The program has a menu that you can take input from console, and the user can choose between the items. The program data is in the HwO8FinalProjectStudentList.txt file. Required Items: 1. The program must show a menu to user and ask the user can either choose between the...
Create a JAVA program for a Kiosk management system. A local kiosk in your neighborhood has been heavily challenged by the manual system currently used to manage the kiosk’s day to day operations. The kiosk management have been informed of your newly acquired knowledge in application development and have approached you to create an electronic management system. The system is meant to help the Kiosk in managing its stock and finances; with this in mind your application should then offer...
Problem:A small electronics company has hired you to write an application to manage their inventory. The company requested a role-based access control (RBAC) to increase the security around using the new application. The company also requested that the application menu must be flexible enough to allow adding new menu items to the menu with minimal changes. This includes re-ordering the menu items and making changes to the description of a menu item without having to change the code.Security:The company has...
Hw08FinalProjectStudentList.txt: (Data structure is
Array List)
1,Simon,Jefferson,gy3085,4.0,2019
2,John,Johnson,xy1242,3.9,2019
3,Kayla,Anderson,as1324,3.8,2019
4,David,Kidman,re5423,3.8,2017
5,Mary,Coleman,ze7698,3.8,2018
Description: This assignment is going to evaluate your overall knowledge of the Java Programming. You shall implement a program which can store and retrieve student list. The program has a menu that you can take input from console, and the user can choose between the items. The program data is in the HwO8FinalProjectStudentList.txt file. Required Items: 1. The program must show a menu to user and ask the user...
Use your Car class from the previous Programming Assignment. For this assignment, create a new class that represents a Used Car Dealership. Your Java program will simulate an inventory system for the dealership, where the employees can manage the car information. Start by creating an array of 10 cars, with an "ID" of 0 through 9, and use the default constructor to create each car. For example, the third car in an array called cars would have ID 2. You...
C++ program
Write a C++ program to manage a hospital system, the system mainly uses file handling to perform basic operations like how to add, edit, search, and delete record. Write the following functions: 1. hospital_menu: This function will display the following menu and prompt the user to enter her/his option. The system will keep showing the menu repeatedly until the user selects option 'e' from the menu. Arkansas Children Hospital a. Add new patient record b. Search record c....
Note: You must write this program in Python. General Requirements The program should display a menu and allow the user to perform one of the following tasks. Add an item to the list Delete an item from the list Print the list Print the list in reverse Quit the program The program should run until the user chooses to quit. In Python, programmatically quitting the application is achieved with the exit() procedure. You should use a List to store the...