I've been trying to get this written for days, and cannot seem to get this written. I keep restarting, but cannot get it to do the math I'm needing or to have a main menu with the list.
//Int32 price;
//double tax;
Int32 intTime = 3000;
Boolean varIsValid = true;
object price = null;
//double tax = .08 * Convert.ToDouble(price) / 100;
while (varIsValid)
{
Console.WriteLine("Welcome to CIS 120");
Console.WriteLine("Shopping List Project");
Console.WriteLine("Please Enter Price");
//if (Console.ReadLine() != "exit") ;
Console.ReadKey();
double tax = .08 * Convert.ToDouble(price) / 100;
}
{
{
}
}
System.Threading.Thread.Sleep(intTime);
Environment.Exit(0); //Exit the program
C# Function Project Assignment
A function processes a block of code when the function is called. In this assignment, you are required to use functions within the program. As a programmer for a small local business, they need a tool that will keep track of a user’s shopping list and calculate the total with tax. All of this is being done while the users are shopping within the store from a mobile device. The user should know what the grand total is before the user checks out with a cashier. Follow the program requirements below, you have the flexibility to be as creative as needed. This program can be time-consuming and there will be no other flowchart or pseudocode assignments this week.
Shopping List Program Requirements:
Dear Student ,
As per the requirement submitted above , kindly find the below solution.
Here a new Console Application in C# is created using Visual Studio 2017 with name "Demo_ShoppingList".This application contains a class with name "Program.cs".Below are the details of thus class.
Program.cs :
//namespace
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//application namespace
namespace Demo_ShoppingList
{
class Program //class
{
static int ij = 0;
//declaring variables
const double TAX = 0.08;
static double totalAmount = 0;
static double tax = 0;
static bool flag = true;
//creating two dimensional array to store product for shopping and
their price
static string[,] products = new string[,]
{
{"Smartphone","Laptop","Digital Watch","Smart
Band","Calculator","Tab","Head set","PC","Hair Oil","Hair Dryer"
},
{"8000","18000","2000","1200","780","7000","700","12000","200","600"
}
};
//array to hold current shopping list
static string[,] currentProducts = new string[10, 10];
static void Main(string[] args)
{
Console.WriteLine("============Welcome to CIS
120===============");
Console.WriteLine("============Shopping List
Project=============");
//using while loop to display menus
while (flag)
{
Console.WriteLine("----Select Menu ------");
Console.WriteLine("1.Display Products for Shopping.\n2.Add product
to Cart.\n3.Remove product from Cart.\n4.Display Current Shopping
List\n5.Displat Total and Tax Amount\n6.Exit");
Console.WriteLine("===============================================");
//asking user to enter choice
Console.Write("Enter Choice : ");
//read choice
int choice = int.Parse(Console.ReadLine());
//using switch for choice processing
switch (choice)
{
case 1://calling method to display shopping List
displayShoppingList();
break;
case 2://calling method to add items in shopping list
addProduct();
break;
case 3://calling method to remove product
removeProduct();
break;
case 4://calling method to display current shopping list
currentShoppingList();
break;
case 5://display total and Tax
displayTotalTax();
break;
case 6://setting flag to false
flag = false;
break;
default://for any invalid choice
Console.WriteLine("Enter valid choice");
break;
}
}
}
//method to displayShoppingList()
public static void displayShoppingList()
{
Console.WriteLine("{0,-5} {1,-15}
{2,2}","No.","Name","Price");
//using for loop display items
for (int i = 0; i < products.GetLength(1); i++)
{
//display products
Console.WriteLine("{0,2} {1,-15}
{2,2}",i+1,products[0,i],products[1,i]);
}
Console.WriteLine("************************************************");
}
//method to add product to shopping List
public static void addProduct()
{
//variable for while to continue
bool counter = true;
while (counter)
{
//asking user to enter product choice
Console.WriteLine("Enter product number to ADD");
//READING number
int no = int.Parse(Console.ReadLine());
if (no < 0 && no > 10)
{
Console.WriteLine("Enter valid choice");
}
else
{
currentProducts[0, ij] = products[0, no-1];//adding product current
product
currentProducts[1, ij] = products[1, no-1];//adding price in
current product
totalAmount = totalAmount + double.Parse(products[1,
no-1]);//calculate total amount
tax = tax + (totalAmount * 0.08);//calculate tax on amount
//display total amount and tax
Console.WriteLine("Total Amount : {0} , Tax :
{1}",totalAmount.ToString("0.00"),tax.ToString("0.00"));
Console.WriteLine("************************************************");
ij++;//increment value
counter = false;
}
}
}
//method to remove product from shopping List
public static void removeProduct()
{
//asking user to enter product choice to remove
Console.WriteLine("Enter product number to remove");
//READING number
int no = int.Parse(Console.ReadLine());
currentProducts[0, no - 1] = "0"; //removing price in current
product
currentProducts[1, no-1]="0";//removing price in current
product
totalAmount = totalAmount - double.Parse(currentProducts[1, no -
1]);//calculate total amount
tax = tax - double.Parse(currentProducts[1, no - 1]) * 0.08;
//display total amount and tax
Console.WriteLine("Total Amount : {0} , Tax : {1}",
totalAmount.ToString("0.00"), tax.ToString("0.00"));
Console.WriteLine("************************************************");
ij--;//increment value
}
//method to display current shopping List
public static void currentShoppingList()
{
Console.WriteLine("-----------------CURRENT SHOPPING
LIST--------------------------");
Console.WriteLine("{0,-5} {1,-15} {2,2}", "No.", "Name",
"Price");
//using for loop display items
for (int i = 0; i < currentProducts.GetLength(1); i++)
{
if (currentProducts[0, i] != null && currentProducts[1, i]
!= null && currentProducts[0, i] !="0" &&
currentProducts[1, i] !="0")
{
//display products
Console.WriteLine("{0,-5} {1,-15} {2,2}", i + 1, currentProducts[0,
i], currentProducts[1, i]);
}
}
Console.WriteLine("************************************************");
}
//method to display total and tax
public static void displayTotalTax()
{
Console.WriteLine("************************************************");
Console.WriteLine("Total Amount : {0} , Tax : {1}",
totalAmount.ToString("0.00"), tax.ToString("0.00"));
Console.WriteLine("************************************************");
}
}
}
======================================================
Output : Run application using F5 and will get the screen as shown below
Screen 1 :Screen showing menus

Screen 2 :Screen showing shopping list

Screen 3 :Adding product into the list

Screen 4 :Screen showing current shopping list

Screen 5 :Screen removing product from the list

Screen 6 :Screen showing total amount and tax

NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.
I've been trying to get this written for days, and cannot seem to get this written....
Fix program errors and improve code Visual Studio C# Console App (.NET Framework) Task The program must allow for the teacher to either enter a predetermined number of scores (e.g. 10 exam scores), to keep allowing them to enter in scores until they are finished. You will need to convert these scores to a percentage then store these in a list. You will perform some calculations on these results and also display the contents of the list (percentage values) back...
So I did an assignment for c# and I was wondering if there is a better way to get it done? here are my directions also my code is at the bottom. In this assignment you're going to Prompt the user for a double for the radius of a circle. You will convert their input to a double and calculate the area based on Pi * radius * radius or Pi r squared. Use Double.TryParse to attempt the conversion from...
I'm trying to do this in a C# Console App.(NET Framework).I've attached the Code that will be required to complete. Any Guidance will be appreciated. C# Console File I/O Project Assignment Working with files and being able to process data in and out of a file is critical to the programmer’s role. Almost every organization will have to deal with files one way or another. For example, it is very common for accountants to use spreadsheets for calculations and sometimes...
Drivers are concerned with the mileage their automobiles get. One driver has kept track of several tankfuls of gasoline by recording the miles driven and gallons used for each tankful. Develop a C# app that will input the miles driven and gallons used (both as integers) for each tankful. The app should calculate and display the miles per gallon obtained for each tankful and display the combined miles per gallon obtained for all tankfuls up to this point. All averaging...
What I need: Write a program named Averages that includes a method named Average that accepts any number of numeric parameters, displays them, and displays their average. For example, if 7 and 4 were passed to the method, the ouput would be: 7 4 -- Average is 5.5 Test your function in your Main(). Tests will be run against Average() to determine that it works correctly when passed one, two, or three numbers, or an array of numbers. What I...
The purpose of this assignment is to get experience with an
array, do while loop and read and write file operations.
Your goal is to create a program that reads the exam.txt file
with 10 scores. After that, the user can select from a 4 choice
menu that handles the user’s choices as described in the details
below. The program should display the menu until the user selects
the menu option quit.
The project requirements:
It is an important part...
Language: C# In this assignment we are going to convert weight and height. So, the user will have the ability to convert either weight or height and as many times as they want. There conversions will only be one way. By that I mean that you will only convert Pounds to Kilograms and Feet and Inches to Centimeters. NOT the other direction (i.e. to Pounds). There will be 3 options that do the conversion, one for each type of loop....
Add a menu to the existing code already written to contain the following options Change Input voltage Add a single resistor Delete resistor Edit resistor Group add a series of resistors Display network Quit program Each item in the menu will probably end up being a function. A do-while loop and switch/case statement is probably best way to implement a menu. You need to create at least 4 functions. Existing code #include <iostream> #include <string> #include <vector> using namespace std;...
Simple python assignment Write a menu-driven program for Food Court. (You need to use functions!) Display the food menu to a user (Just show the 5 options' names and prices - No need to show the Combos or the details!) Ask the user what he/she wants and how many of it. (Check the user inputs) AND Use strip() function to strip your inputs. Keep asking the user until he/she chooses the end order option. (You can pass quantity1, quantity2, quantity3,...
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...