Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

c# program With this assignment you will start to learn how to write a practical

ID: 3820483 • Letter: C

Question

c# program

With this assignment you will start to learn how to write a practical menu driven program that manages a list of data. You will use an array of structs to organize the data and you will save the information in a text file.

Choose one of the following program types: The assignment is to write a menu driven program that manages a small business inventory, collection or list. You pick the topic!!! The focus of your program is up to you.

The Menu commands must include:

P....Display all records (on the screen/monitor)

S....Create a current report (save it to a file)

A....Add a new entry

D....Delete an item from the list (inventory)

C....Clear all records

Q...Quit You must add (1) additional menu option that you choose. It may be a menu option that allows the inventory to be modified. i.e. add inventory quantities, change price/cost, change dates, etc.

You will use structs and an array to organize the data in the program. Your struct must contain at least the following kinds of information: o Minimum of 2 strings (character arrays)

Suggestions include: item name, manufacturer, etc o Minimum of 2 integers – 1 must be product id

Product id, qty in stock o Minimum of 2 double values Suggestions include: cost, price, average inventory:

When you add new item the program will ask the user for each of the fields on a separate line.

When you delete an item from inventory the program will ask you for the integer id of the entry to be deleted, locate the entry in the array and remove all of the data for that entry. – The list does not need to be sorted – to remove an entry, you may move the last item in the list to the location of the deleted entry

When you display the records on the screen, all of the information stored for each entry will be labeled and displayed.

Creating a current inventory report copies the current entries in the array to an output file. This must include labeling all of the information so that it is clear what information is being provided. Clearing the records deletes all of the information in the array.

When you add new item the program will ask the user for each of the fields on a separate line.

When you delete a question from the list, the program will ask you for the question id of the entry to be deleted, locate the entry in the array and remove all of the data for that entry. – The list does not need to be sorted – to remove an entry, you may move the last item in the list to the location of the deleted entry

When you play the game, you must display the question, the possible answers and the point value. If the player answers correctly the point value will be added to the game total. If answered incorrectly, the correct answer will be displayed.

Creating a current report copies the current content of the question array to an output file. This must include labeling all of the information so that it is clear what information is being provided. Clearing all questions deletes all of the information in the array. Instructions:

You should use at least 10 user-defined functions (plus main) to appropriately break the problem up into smaller pieces.

Your program must start up with at least 5 valid records or questions. These records must be “hard coded” in your program file. (This can be done in one of your user-defined functions)

You need to begin the program with general instructions on your program, an outline of the data fields and the format needed to enter the data You should use function prototypes and NO global variables.

You should use a #define to set the upper bound of the list to at least 50 entries.

Your code should be well designed, well commented and written with good style. Other Important Hints and Reminders:

Sample output:

Hello and welcome.

This program helps you create an inventory for skate shoes.

To get you started, 5 shoes have already been entered.

******************************************

Please select from the options below:

A - ADD a new entry

D - DELETE an entry

P - PRINT entire catalog

S - SAVE the current catalog

C - CLEAR entire catalog

U – Optional Item

Q - QUIT What would you like to do: p

----Catalog Entry 1----

BRAND: Globe

NAME: Sabaton

I.D.#: 101

QTY: 45

COST: $30.00

PRICE: $65.99

----Catalog Entry 2----

BRAND: Vans

NAME: Authentic

I.D.#: 102

QTY: 3

COST: $30.00

PRICE: $65.99

----Catalog Entry 3----

BRAND: Globe

NAME: Ease

I.D.#: 103

QTY: 14

COST: $20.00

PRICE: $35.99

----Catalog Entry 4----

BRAND: Vans

NAME: Classic

I.D.#: 104

QTY: 61

COST: $10.00

PRICE: $15.99

----Catalog Entry 5----

BRAND: Globe

NAME: Focus

I.D.#: 105

QTY: 6

COST: $40.00

PRICE: $85.99

******************************************

Please select from the options below:

A - ADD a new entry

D - DELETE an entry

P - PRINT entire catalog

S - SAVE the current catalog

C - CLEAR entire catalog

U – Optional Item

Q - QUIT

What would you like to do: u

Enter the I.D.# of the entry you would like to update: 104

----Catalog Entry ----

BRAND: Vans

NAME: Classic

I.D.#: 104

QTY: 61

COST: $10.00

PRICE: $15.99

Please enter the new price: 9.99

******************************************

Please select from the options below:

A - ADD a new entry

D - DELETE an entry

P - PRINT entire catalog

S - SAVE the current catalog

C - CLEAR entire catalog

U – Optional Item

Q - QUIT What would you like to do: p

----Catalog Entry 1----

NAME: Sabaton

I.D.#: 101

QTY: 45

COST: $30.00

PRICE: $65.99

----Catalog Entry 2----

NAME: Nomad

I.D.#: 102

QTY: 3

COST: $30.00

PRICE: $65.99

----Catalog Entry 3----

NAME: Ease

I.D.#: 103

QTY: 14

COST: $20.00

PRICE: $35.99

----Catalog Entry 4----

BRAND: Vans

NAME: Classic

I.D.#: 104

QTY: 61

COST: $10.00

PRICE: $9.99

----Catalog Entry 5----

NAME: Focus

I.D.#: 105

QTY: 6

COST: $40.00

PRICE: $85.99

******************************************

Please select from the options below:

A - ADD a new entry

D - DELETE an entry

P - PRINT entire catalog

S - SAVEthe current catalog

C - CLEAR entire catalog

U – Optional Item

Q - QUIT What would you like to do: c

Your catalog has been cleared of all entries.

******************************************

Please select from the options below:

A - ADD a new entry

D - DELETE an entry

P - PRINT entire catalog

S - SAVE the current catalog

C - CLEAR entire catalog

U – Optional Item

Q - QUIT

What would you like to do: p

***** Catalog is empty *****

******************************************

Please select from the options below:

A - ADD a new entry

D - DELETE an entry

P - PRINT entire catalog

S - SAVE the current catalog

C - CLEAR entire catalog

U – Optional Item

Q - QUIT

What would you like to do: a

Please enter the Brand of the shoe: Globe

Please enter the name of the shoe: Encore

What is this shoe's I.D. number: 110

What is this shoe's quantity: 33

How much does this shoe cost: 10.00

How much will you charge for this shoe: 19.99

Your entry has been added to the catalog.

******************************************

Please select from the options below:

A - ADD a new entry

D - DELETE an entry

P - PRINT entire catalog

S - SAVE the current catalog

C - CLEAR entire catalog

U – Optional Item

Q - QUIT What would you like to do: p

----Catalog Entry 1----

BRAND: Globe

NAME: Encore

I.D.#: 110

QTY: 33

COST: $10.00

PRICE: $19.99

******************************************

Please select from the options below:

A - ADD a new entr y

D - DELETE an entry

P - PRINT entire catalog

S - SAVE the current catalog

C - CLEAR entire catalog

U – Optional Item

Q - QUIT

What would you like to do: q

Goodbye.

Press any key to continue . . .

Explanation / Answer

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MenuDriven
{


class Program
{
struct Shoe
{


public string name;

public int id;

public string brand;

public int quantity;

public double price;

public double cost;

public override string ToString() {

String s = String.Format("Brand:%s Quantity:%d Id:%d Cost:%f Price:%f ",brand,quantity,id,cost,price);
return s;
}


}
static Shoe[] col = new Shoe[SIZE];
const int SIZE = 50;
static int count = 0;

public static void Main(string[] args)
{

char option;   
Boolean stop = false;
Console.WriteLine("Please select from the options below: A - ADD a new entry D - DELETE an entry P - PRINT entire catalog S - SAVE the current catalog C - CLEAR entire catalog U – Optional Item Q - QUIT");
option = Console.ReadKey().KeyChar;

while (stop == false)
{
switch (option)
{
case 'A':
add();
break;
case 'D':
delete();
break;
case 'P':
print();
break;
case 'S':
save();
break;
case 'C':
clear();
break;
case 'U':
update();
break;
case 'Q':
stop = true;
Console.WriteLine("Bye");

break;
default:
Console.WriteLine("Invalid option");
break;
}
}
  
}

private static void update()
{
throw new NotImplementedException();
}

private static void clear()
{
throw new NotImplementedException();
}

private static void save()
{
throw new NotImplementedException();
}

private static void print()
{
for(int i=0;i<count; i++)
{
Console.WriteLine(col[i]);
}

}

private static void delete()
{
int id;
Console.WriteLine("enter integer id: ");
Int32.TryParse(Console.ReadLine(), out id);
Boolean found = false;
for (int i = 0; i < count; i++)
{
if(id==col[i].id)
{
col[i] = col[count - 1];
count--;
found = true;
break;
}
}

if(!found)
{
Console.WriteLine("not found");
}


}

private static void add()
{
if (count == SIZE)
{
Console.WriteLine("full");
  
}
else
{
Shoe s;
Console.WriteLine("Please enter the Brand of the shoe: ");
s.brand = Console.ReadLine();
Console.WriteLine("Please enter the name of the shoe: ");
s.name = Console.ReadLine();

Console.WriteLine("What is this shoe's I.D. number");
Int32.TryParse(Console.ReadLine(),out s.id);

Console.WriteLine("What is this shoe's quantity:");
Int32.TryParse(Console.ReadLine(), out s.quantity);

Console.WriteLine("How much does this shoe cost: ");
Double.TryParse(Console.ReadLine(), out s.cost);

Console.WriteLine(" How much will you charge for this shoe: ");
Double.TryParse(Console.ReadLine(), out s.price);
count++;

Console.WriteLine("Your entry has been added to the catalog: ");
}
}
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote