Question

C++ programming am inventory system: The software needs to do the following: -Load the inventory from...

C++ programming am inventory system:

The software needs to do the following:

-Load the inventory from and save the inventory to a file.

-Keep track of bolts at 1/8" diameter intervals from 1/4" to 1" and lengths at 1" intervals from 1" to 6"

-Keep track of nuts at the same diameter intervals and range as bolt diameters.

-Be able to add and remove nuts and bolts to and from the system during runtime

Sample Menus:

Weclome to NaBISCo!!!

1. View bolt Inventory
2. View nut inventory
3. Add nuts/bolts to inventory
4. Remove nuts/bolts from inventory
5. Quit

(N)uts or (B)olts: N

Please pick a diameter:
1. 1/4"
2. 3/8"
3. 1/2"
4. 5/8"
5. 3/4"
6. 7/8"
7. 1"
Choice: 3

What is the length (1 to 6): 5

There are 20 Nuts of that type in the system.
How many do you wish to add: 30

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Implemented Source Code:-
======================
#include<iostream>
#include<iomanip>
#include<string.h>
#include<stdlib.h>
#include<fstream>
using namespace std;
struct Inventary
{
char boltsDiameter[10];
int boltslength;
char nutsdiameter[10];
int nutslength;
struct Inventary *next;
};//Structure Maintaining list of Home Records
struct Inventary *first=NULL,*last=NULL,*swapping ,*temp1=NULL,*head;
class InventaryBoltsandNuts
{
public:
void ReadFile()
{
ifstream myfile;
myfile.open("InventaryNutsandBolts.txt");//read Inventary of Books from the file.
for(int i=1;i<=7;i++)
{
head=(struct Inventary*)malloc(sizeof(struct Inventary));
myfile>>head->boltsDiameter;
myfile>>head->boltslength;
myfile>>head->nutsdiameter;
myfile>>head->nutslength;
head->next=swapping;
swapping=head;
}
myfile.close();
reverse(&head);
}
public:
void Print_BoltsInventary()
{
struct Inventary *temp;
temp=head;
if(temp!=NULL)
{
cout<<"\nBoltsDiameter\t\tLength"<<endl;
cout<<"---------------------------------------------------"<<endl;
while(temp!=NULL)
{
cout<<temp->boltsDiameter<<"\t\t"<<temp->boltslength<<endl;
temp=temp->next;
}
}
else
{
cout<<"The list is Empty:\n"<<endl;
}
}
public:
void Print_NutsInventary()
{
struct Inventary *temp;
temp=head;
if(temp!=NULL)
{
cout<<"\nNutsDiameter\t\tLength"<<endl;
cout<<"---------------------------------------------------"<<endl;
while(temp!=NULL)
{
cout<<temp->nutsdiameter<<"\t\t"<<temp->nutslength<<endl;
temp=temp->next;
}
}
else
{
cout<<"The list is Empty:\n"<<endl;
}
}
public:
void reverse(struct Inventary** head)
{
struct Inventary* prev = NULL;
struct Inventary* current = *head;
struct Inventary* next = NULL;
while (current != NULL)
{
next=current->next;  
current->next = prev;
prev = current;
current = next;
}
*head = prev;
}
public:
void RemoveBoltsNuts(struct Inventary **head, int position)
{
if (*head == NULL)
return;
struct Inventary* temp = *head;
if (position == 0)
{
*head = temp->next;
free(temp);
return;
}
for(int i=0; temp!=NULL && i<position-1; i++)
temp = temp->next;
if(temp == NULL || temp->next == NULL)
return;
last = temp->next->next;
free(temp->next);
temp->next = last;
cout<<"\nThe Bolts/Nuts Removed Successfully"<<endl;
}
public:
int Boltsearch(char Diameter[])
{
int index=0;
struct Inventary *temp=head;
while(temp!=NULL)
{
if(!(strcmp(Diameter,temp->boltsDiameter)))
{
cout<<"\nRecords Available"<<endl;
return index;
}
temp=temp->next;
index++;   
}
return -1;
}
public:
int Nutsearch(char Diameter[])
{
int index=0;
struct Inventary *temp=head;
while(temp!=NULL)
{
if(!(strcmp(Diameter,temp->nutsdiameter)))
{
cout<<"\nRecords Available"<<endl;
return index;
}
temp=temp->next;
index++;   
}
return -1;
}
public:
void AddNuts(int length,char Diameter[])
{
head=(struct Inventary*)malloc(sizeof(struct Inventary));
strcpy(head->nutsdiameter,Diameter);
head->nutslength=length;
head->next=swapping;
swapping=head;
cout<<"\nNew Nuts are Added Successfully"<<endl;
}
public:
void AddBolts(int length,char Diameter[])
{
head=(struct Inventary*)malloc(sizeof(struct Inventary));
strcpy(head->boltsDiameter,Diameter);
head->boltslength=length;
head->next=swapping;
swapping=head;
cout<<"\nNew Bolts Record Added Successfully"<<endl;
}
};
int main()
{
InventaryBoltsandNuts obj;
obj.ReadFile();
int option,retval;
int length;
char BoltDiameter[100],NutsDiameter[100];
cout<<"\n----------------------------------------"<<endl;
cout<<"\n***The bolt Inventory records are ***"<<endl;
cout<<"\n--------------------------------------"<<endl;
obj.Print_BoltsInventary();
cout<<"\n----------------------------------------"<<endl;
cout<<"\n***The Nuts Inventory records are ***"<<endl;
cout<<"\n--------------------------------------"<<endl;
obj.Print_NutsInventary();
while(true)
{
cout<<"\n**** Weclome to NaBISCo!!! ****"<<endl;
cout<<"\n1. View bolt Inventory."<<endl;
cout<<"\n2. View nut inventory"<<endl;
cout<<"\n3. Add nuts/bolts to inventory "<<endl;
cout<<"\n4. Remove nuts/bolts from inventory"<<endl;
cout<<"\n5. Quit"<<endl;
cout<<"\nPlease select any Option: " <<endl;
cin>>option;
switch(option)
{
case 1:
obj.Print_BoltsInventary();
break;
case 2:
obj.Print_NutsInventary();
break;
case 3:
cout<<"\nPlease Enter Nerw Bolts diameterPlease pick a diameter:\n1. 1/4\n2. 3/8\n3. 1/2\n4. 5/8\n5. 3/4\n6. 7/8\n7. 1"<<endl;
cin>>BoltDiameter;
cout<<"\nPlease Enter Length from (1 to 7):"<<endl;
cin>>length;
obj.AddBolts(length,BoltDiameter);
obj.reverse(&head);
break;
case 4:
cout<<"\nPlease Enter BoltsDiameter:"<<endl;
cin>>BoltDiameter;
retval=obj.Boltsearch(BoltDiameter);
if(retval==-1)
cout<<"\nSorry Bolts Details are Not Found"<<endl;
else
obj.RemoveBoltsNuts(&head,retval);
break;
case 5:
cout<<"\nEnd"<<endl;
exit(0);
default:
cout<<"\nInvalid Option"<<endl;
}
}
}


Input File:-
============
1/4 1 1/4 1
3/8 2 3/8 2
1/2 3 1/2 3
5/8 4 5/8 4
3/4 5 3/4 5
7/8 6 7/8 6
1 7 1 7

Sample Output:-
=============
----------------------------------------
***The bolt Inventory records are ***
--------------------------------------
BoltsDiameter Length
---------------------------------------------------
1/4 1
3/8 2
1/2 3
5/8 4
3/4 5
7/8 6
1 7
----------------------------------------
***The Nuts Inventory records are ***
--------------------------------------
NutsDiameter Length
---------------------------------------------------
1/4 1
3/8 2
1/2 3
5/8 4
3/4 5
7/8 6
1 7
**** Weclome to NaBISCo!!! ****
1. View bolt Inventory.
2. View nut inventory
3. Add nuts/bolts to inventory
4. Remove nuts/bolts from inventory
5. Quit
Please select any Option:
1
BoltsDiameter Length
---------------------------------------------------
1/4 1
3/8 2
1/2 3
5/8 4
3/4 5
7/8 6
1 7
**** Weclome to NaBISCo!!! ****
1. View bolt Inventory.
2. View nut inventory
3. Add nuts/bolts to inventory
4. Remove nuts/bolts from inventory
5. Quit
Please select any Option:
2
NutsDiameter Length
---------------------------------------------------
1/4 1
3/8 2
1/2 3
5/8 4
3/4 5
7/8 6
1 7
**** Weclome to NaBISCo!!! ****
1. View bolt Inventory.
2. View nut inventory
3. Add nuts/bolts to inventory
4. Remove nuts/bolts from inventory
5. Quit
Please select any Option:
1
BoltsDiameter Length
---------------------------------------------------
1/4 1
3/8 2
1/2 3
5/8 4
3/4 5
7/8 6
1 7
**** Weclome to NaBISCo!!! ****
1. View bolt Inventory.
2. View nut inventory
3. Add nuts/bolts to inventory
4. Remove nuts/bolts from inventory
5. Quit
Please select any Option:
3
Please Enter Nerw Bolts diameterPlease pick a diameter:
1. 1/4
2. 3/8
3. 1/2
4. 5/8
5. 3/4
6. 7/8
7. 1
6/7
Please Enter Length from (1 to 7):
4
New Bolts Record Added Successfully
**** Weclome to NaBISCo!!! ****
1. View bolt Inventory.
2. View nut inventory
3. Add nuts/bolts to inventory
4. Remove nuts/bolts from inventory
5. Quit
Please select any Option:
2
NutsDiameter Length
---------------------------------------------------
1 7
2 3/ 841953546
**** Weclome to NaBISCo!!! ****
1. View bolt Inventory.
2. View nut inventory
3. Add nuts/bolts to inventory
4. Remove nuts/bolts from inventory
5. Quit
Please select any Option:
1
BoltsDiameter Length
---------------------------------------------------
1 7
6/7 4
**** Weclome to NaBISCo!!! ****
1. View bolt Inventory.
2. View nut inventory
3. Add nuts/bolts to inventory
4. Remove nuts/bolts from inventory
5. Quit
Please select any Option:
5
End
--------------------------------
Process exited after 79.23 seconds with return value 0
Press any key to continue . . .

Add a comment
Know the answer?
Add Answer to:
C++ programming am inventory system: The software needs to do the following: -Load the inventory from...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Problem #1 (8 pts) Suppose a textbook with 4 the book. What is the probability that a particular ...

    Problem #1 (8 pts) Suppose a textbook with 4 the book. What is the probability that a particular page has 50 pages has 200 misprints which is distributed randomly throughout 3 or more misprints? Problem #2 (8 pts): A box contains 8 large, 5 medium, and 3 small bolts and another box contains 6 nuts which fits the large bolts, 4 nuts which fits the medium bolts and 2 nuts which fits the small bolts. If one bolt and one...

  • 8. You are given two boxes, one contains nuts and the other contains bolts. Below is...

    8. You are given two boxes, one contains nuts and the other contains bolts. Below is a picture of a bolt. The D indicates Below right is a side and overhead picture of a nut. The the diameter of the bolt D indicates the diameter of the hole INSIDE the nut. ATI RODI c ISO METRIC AND WASHERS A bolt is supposed to fit inside a nut. On the right is a picture of a bolt properly fitting inside a...

  • Standard design practice, as exhibited by the solutions to Probs. 8-66 to 8-70, is to assume that...

    Standard design practice, as exhibited by the solutions to Probs. 8-66 to 8-70, is to assume that the bolts, or rivets, share the shear equally. For many situations, such an assumption may lead to an unsafe design. Consider the yoke bracket of Prob. 8-61, for example. Suppose this bracket is bolted to a wide-flange column with the centerline through the two bolts in the vertical direction. A vertical load through the yoke-pin hole at distance B from the column flange...

  • Knowledge Check 01 A seller uses a perpetual inventory system, and on April 18, a customer...

    Knowledge Check 01 A seller uses a perpetual inventory system, and on April 18, a customer discovers that merchandise previously purchased is defective. The buyer decides to keep the defective merchandise and the seller allows a $15 price reduction, paid in cash to the buyer. Complete the journal entry to record the allowance granted to the buyer by selecting the account names from the drop-down menus and entering the dollar amounts in the debitor credit columns View transaction list Journal...

  • CH Required information A seller uses a perpetual inventory system, and on April 17, a customer...

    CH Required information A seller uses a perpetual inventory system, and on April 17, a customer returns $1,000 of merchandise previously purchased on credit on April 13. The seller's cost of the merchandise returned was $480. The merchandise is not defective and is restored to inventory. The seller has not yet received any cash from the customer. Complete the two Journal entries to record the return transaction by selecting the account names from the drop-down menus and entering the dollar...

  • r the following system at equilibrium. Complete the table showing how the system responds to the...

    r the following system at equilibrium. Complete the table showing how the system responds to the following changes (disturbances). Answers can be left, right, no shift, increase, decrease, or no change. N2(g) + H2(g) = NH3(g) + 92.0 kJ Stress Shift [N2] [Hz] (NH3) K 1. Add H2 gas 2. Add N2 gas 3. Add NH3 gas 4. Remove H2 gas 5. Remove N2 gas 6. Remove NH3 gas Decrease temperature 8. Increase temperature 9. Increase pressure by reducing volume...

  • ADDITIONAL INFORMATION TABLE 1 IS THE EXPERIMENT DATA. THE BOLT, THE DIMENSION OF THE BOLT. USING...

    ADDITIONAL INFORMATION TABLE 1 IS THE EXPERIMENT DATA. THE BOLT, THE DIMENSION OF THE BOLT. USING THE INFORMATION FROM TABLE 1 I'M SUPPOSED TO MAKE ANOTHER TABLE SHOWING make another table that reports tu, ty,tys both calculated from the data in table 1 using the equation from number 5 (torsional yield strength) and another column with the estimated calculations using section 7 equation and getting the information(torsional yield strength numbers from the bolt chart for each specimen) Next in the...

  • Pole and Arm Detail BLC Sele MECHANICAL DAMPENING DEVICE (SEE NOTE 16) POLE SHALL BE VERTICAL...

    Pole and Arm Detail BLC Sele MECHANICAL DAMPENING DEVICE (SEE NOTE 16) POLE SHALL BE VERTICAL WITH MAX OFFSET OF 3/3 ALONG CENTERLINE BRACKET ARM WHEN REQUIRED SE NOTE 6) RE MECHANICAL DAMPENING DEVICE (SEE NOTE 16) -HAND HOLE ARM САР ARM LENGTH VARIES (OVERLAP WHEN REQUIRED) SEE NOTE 5) Oool 000 000 TYP.) TI SIGNAL HEAD WITH BACKPLATE HANDHOLE F POLE 1/2" MIN. STAINLESS OR GALV STEEL HEX HEAD THROUGH BOLT WITH LOCK NUT, SNAG. HEIGH? E MAX ?...

  • The Program (Java) You will create a pet database program with the following operations incrementally as...

    The Program (Java) You will create a pet database program with the following operations incrementally as describe in the Milestones section. You are not required to save the pet data into a file. You must use appropriate design and make use of Object-Oriented Design. See milestones. • Add pets o Let the user add as many pets as they want. A pet is entered as a single line consisting of a name and an integer which represents the age of...

  • % Our Philpot, Mechanics of Materials: An Integrated Learning System, 4th Edition Part 1 flanges....

    % Our Philpot, Mechanics of Materials: An Integrated Learning System, 4th Edition Part 1 flanges. The beam supports a concentrated load of P 4000 Ib at the center of a span of n where hi-141n h2 3.0 in., b1-3sin and b2 = 0.75 n Bolts ⅜-in diameter connect the plywood webs and the lumber flanges at a spac ng of length L- 15 ft. The cross-section dimensions are s s- 10.0 in. along the span. Supports A and C can...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT