Question
Use C# to solve this. Program Overview The program simulates a shopping cart by managing information about products. The application should prompt the user to
Use C# to solve this.
Program Overview The program simulates a shopping cart by managing information about products. The application should prompt the user to enter the following three pieces of information for 5 items. It should record/save all three pieces of information for each of the 5 items.
Information to be recorded- Description- Valid Values
Product Name- The name of the product. This could be any term or phrase.- Any valid combination of letters and numbers
Product Category- The category describes the type of the product. There can be only 3 possible values of category. - Tech or Grocery or Office
Price- The price of the item in dollars. -Any positive Dollar value
After the user has entered information for all 5 items, the program should present a list of all items in the shopping cart sorted by category, i.e. all Tech items first, all Grocery items second, and all office items third. All items with an invalid category should be listed under Other. Each category listing should also provide a category total.
The output of the program should list all the items sorted by category as well as the average dollars spent on each category.
Sample Output
Requirements:
Name your class: ShoppingCart.cs
You must use arrays to store the information that the user enters for the products.
The program should recognize the product category even if the user enters it in improper casing, i.e. the program should recognize the category regardless of whether the input is in upper case, lower case, or mixed case.
You cannot use any other data structure for any purpose including storing, sorting, and calculation.
You must use for loops to traverse arrays.
The program must present a list of all items in each category. Items in invalid categories should be presented under one heading, i.e. Other.
The program must present an average of the dollar values for each category
Your program must calculate the average manually, i.e. no built-in functionality, methods, functions, etc. can be used to automate the calculation of the average. The set of statements which calculate the average should be visible in the program.
In case there are zero products in a category, the program should display an average of 0.
Dollar values should be formatted using Currency format specifier.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started