You are maintaining an inventory for a store. What type of store is up to you. S
ID: 3612949 • Letter: Y
Question
You are maintaining an inventory for a store. What type of store is up to you. Some ideas: bookstore, music store, pet store, etc... You need a system that will let you enter your inventory (and store it in a file). You also should be able to soil it, and update it. For the items in your inventory, you will be keeping track of its basic information (i.e. for books: name, publisher, year, author, pages, price). Your system will allow you to keep track of who purchases the items from your store (name, address, telephone, what they bought, how much they paid). This information is also to be stored in a file (separate from the inventory file). Your program should open with a menu that allows me to see your inventory (provide at least 3 ways of looking at your inventory - unsorted, and 2 soiled views - the sorted views are up to you). You could use a sorted view for the bookstore such as sorted by title or author, for example. Your program should let me search your inventory using any 3 methods (of your choice - for books, could be by title, author, year). Your program should let me then enter a customer's data and what they bought. I should then also be able to see the list of customer's (sorted and unsorted) and also search the customer list based upon any 3 methods (of your choice - for example, by name, city, .and phone). Finally, I should be able to delete inventory or customers as well. Your program should be fault tolerant, allowing for possible user error. Your program should also be as user friendly as you can make it. Your program should consist of more than 1 .c file. For example, you could group your inventory functions into one c file, and then your customer functions into another. Also, please include sufficient amounts of comments to make your code more readable for me. Your information should be read from files at the start of your program and stored into lists (arrays or linked lists - your choice). When the program ends, you write that data back out. While the program is running, you should of course write out any changes made to data; that way, if the program crashes you will not have lost all the changes made before the crash. Of course, if you make your program fault tolerant, crashes won't occur that often.Explanation / Answer
I'm stuck with input --should be gets not scanf in enteritem andenterbuyer, but I don't know how to do it in C, no problem if itwas C++ at least it should get you started please rate this-thanks #include #include struct inventory{ char title[20]; char pub[20]; char isbn[13]; char author[20]; float price; } items[50],temp[50]; struct purchasers{ char name[20]; char address[20]; char phone[12]; char bought[20]; float paid; }buy[50]; void enteritem(inventory[],int*); void enterbuyer(purchasers[], int*); void view(inventory[],int,int); void sort(inventory[],inventory[],int); void search(inventory[],int,int); void deleteitem(inventory[],int*); void deletebuyer(purchasers[], int*); int subview(); int subsearch(); int main() {int num=0,type,i; char c,choice; float total; for(;;) {printf(" What do you want to do (choose the correctnumber)? "); printf("1. Enter Inventory item "); printf("2. Delete Inventory item "); printf("3. Enter buyer information "); printf("4. Delete buyer information. "); printf("5. View inventory. "); printf("6. Search inventory. "); printf("7. End Program Run "); scanf("%c",&choice); c = getchar(); while (c != ' ' && c != EOF) c = getchar(); switch(choice) {case '1': enteritem(items,&num); printf("%d",num);break; case '2': deleteitem(items,&num);break; case '3': enterbuyer(buy, &num);break; case '4': deletebuyer(buy, &num); case '5': type=subview(); view(items,num,type);break; case '6': type=subsearch(); search(items,num,type);break; case '7': return 0; default: printf("Invalid entry-try again "); } printf(" "); } } void enteritem(inventory in[],int*n) {printf("enter title: "); scanf("%s",&in[*n].title); printf("enter publisher : "); scanf("%s",&in[*n].pub); printf("enter isbn: "); scanf("%s",&in[*n].isbn); printf("enter author : "); scanf("%s",&in[*n].author); printf("enter price: "); scanf("%f",&in[*n].price); *n=*n+1; char c = getchar(); while (c != ' ' && c != EOF) c = getchar(); } void enterbuyer(purchasers p[], int*n) {printf("enter name: "); scanf("%s",&p[*n].name); printf("enter address : "); scanf("%s",&p[*n].address); printf("enter phone: "); scanf("%s",&p[*n].phone); printf("enter title bought: "); scanf("%s",&p[*n].bought); printf("enter amount paid: "); scanf("%f",&p[*n].paid); *n=*n+1; char c = getchar(); while (c != ' ' && c != EOF) c = getchar(); } void view(inventory in[],int n,int t) { } void sort(inventory in[],inventory[],int n) { } void search(inventory in[],int n,int t) { } void deleteitem(inventory in[],int* n) { } void deletebuyer(purchasers p[], int* n) { } int subview() {char choice,c; for(;;) {printf(" What type of view(choose the correct number)? "); printf("1. unsorted "); printf("2. sorted by author "); printf("3. sorted by isbn "); scanf("%c",&choice); c = getchar(); while (c != ' ' && c != EOF) c = getchar(); printf(" "); switch(choice) {case '1': return 1;break; case '2': return 2;break; case '3': return 3;break; default: printf("Invalid entry-try again "); } printf(" "); } } int subsearch() {char choice,c; for(;;) {printf(" What type of search(choose the correct number)? "); printf("1. name "); printf("2. city "); printf("3. phone "); scanf("%c",&choice); c = getchar(); while (c != ' ' && c != EOF) c = getchar(); printf(" "); switch(choice) {case '1': return 1;break; case '2': return 2;break; case '3': return 3;break; default: printf("Invalid entry-try again "); } printf(" "); } }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.