Question

In: Computer Science

Shopping Cart App (C#) Please create a C# Console (.NET Framework) application which reads from the...

Shopping Cart App (C#)

Please create a C# Console (.NET Framework) application which reads from the user, the price of items in their shopping "cart". Be sure to tell the user how to stop (or ask them if they want to stop) entering prices.

Items can be priced any positive number greater than zero.

When the user has entered the prices for all items in their "cart", calculate the subtotal (the sum of all item prices).

Next, check if the user is a member of our Frequent Shopping Club. If so, take 10% off the subtotal price.

Finally, calculate the tax owed (the tax RATE is 4.5%), and then the total (subtotal + tax OWED = total).

Display the subtotal, discount (will be zero if not a member of the Frequent Shopping Club), tax owed, and total.

You should use While loops, IF statements, and TryParse statements to ensure all input is correctly entered.

Solutions

Expert Solution

If you have any doubts, please give me comment...

using System;

public class ShoppingCart{

    public static void Main(){

        char choice = 'Y';

        char isFSCMember;

        double price, discount=0, sub_total = 0, tax_owed, total;

        while(choice=='Y' || choice=='y'){

            Console.Write("Enter price of item: ");

            Double.TryParse(Console.ReadLine(), out price);

            if(price<0)

                Console.WriteLine("Price can't be negative");

            else

                sub_total += price;

            Console.Write("Do you want to continue(Y/N): ");

            choice = Console.ReadKey().KeyChar;

            Console.WriteLine();

        }

        Console.Write("Are you member of our Frequent Shopping Club(Y/N)? ");

        isFSCMember = Console.ReadKey().KeyChar;

        Console.WriteLine();

        if(isFSCMember=='Y' || isFSCMember=='y')

            discount = sub_total*0.10;

        sub_total -= discount;

        tax_owed = sub_total*(4.5/100);

        total = sub_total + tax_owed;

        Console.WriteLine("Subtotal: ${0}", sub_total.ToString("0.00"));

        Console.WriteLine("Discount: ${0}", discount.ToString("0.00"));

        Console.WriteLine("Tax Owed: ${0}", tax_owed.ToString("0.00"));

        Console.WriteLine("Total: ${0}", total.ToString("0.00"));

    }

}


Related Solutions

write a c# console application app that reads all the services in the task manager and...
write a c# console application app that reads all the services in the task manager and automatically saves what was read in a Notepad txt file.  Please make sure that this program runs, also add some comments
1-Create a new Visual C# Console App (.NET Framework). Name the solution "GPA Calculation". 2-Zip and...
1-Create a new Visual C# Console App (.NET Framework). Name the solution "GPA Calculation". 2-Zip and Submit your entire project with the solution file GPA Ask the user to input their grade percentage (e.g. the use will enter 98 if they had an overall grade of 98% in their course) for their Accounting, Marketing, Economics and MIS courses. Assume each course is worth 3 credit hours. Once you have all of their grades output what letter grade they earned for...
Create a C# console application (do not create a .NET CORE project) and name the project....
Create a C# console application (do not create a .NET CORE project) and name the project. Generate two random integers, each between 1 and 50, that you will be adding together to test the user's ability to perform the addition operator. Display the numbers in the console, such as:             7 + 22 = ? Once the user provides their answer, check to see if it is correct and if not, tell them sorry, please try again. If their answer...
Create a C# console application (do not create a .NET CORE project) and name the project...
Create a C# console application (do not create a .NET CORE project) and name the project TuitionIncrease. The college charges a full-time student $12,000 in tuition per semester. It has been announced that there will be a tuition increase by 5% each year for the next 7 years. Your application should display the projected semester tuition amount for the next 7 years in the console window in the following format:             The tuition after year 1 will be $12,600. Note:...
Create a C# console application (do not create a .NET CORE project) and name the project...
Create a C# console application (do not create a .NET CORE project) and name the project TimeToBurn. Running on a particular treadmill, you burn 3.9 calories per minute. Ask the user how many calories they wish to burn in this workout session (this is their goal). Once they tell you, output on the console after each minute, how many calories they have burned (e.g. After 1 minute, you have burned 3.9 calories). Keep outputting the total amount of calories they...
Make a Program in Visual Studio / Console App (.NET Framework) # language Visual Basic You...
Make a Program in Visual Studio / Console App (.NET Framework) # language Visual Basic You will be simulating an ATM machine as much as possible Pretend you have an initial deposit of 1000.00. You will Prompt the user with a Main menu: Enter 1 to deposit Enter 2 to Withdraw Enter 3 to Print Balance Enter 4 to quit When the user enters 1 in the main menu, your program will prompt the user to enter the deposit amount....
Create a simple shopping cart application. Ask the user to input an item number and quantity....
Create a simple shopping cart application. Ask the user to input an item number and quantity. Update the shopping cart. Display the updated cart. Include the following when displaying cart: item number, name, quantity and total price. Ask for another update or end the program. Design Requires 2 classes: the main class and the cartItem class In the main class: Need one array named cartArray of type cartItem. Size = ? Need a loop that asks the user for input....
Create a simple shopping cart application. Ask the user to input an item number and quantity....
Create a simple shopping cart application. Ask the user to input an item number and quantity. Update the shopping cart. Display the updated cart. Include the following when displaying cart: item number, name, quantity and total price. Ask for another update or end the program. Design Requires 2 classes: the main class and the cartItem class In the main class: Need one array named cartArray of type cartItem. Size = ? Need a loop that asks the user for input....
IN C# lang Write a console app (review Module 5 for console app) that stores 3...
IN C# lang Write a console app (review Module 5 for console app) that stores 3 students test stores in 3 separate arrays as integers. Some did not not take all the tests, so they each have a their own length and we use separate arrays. Declare and initialize each array. Use meaningful names. Print each array as follows: Morgan 98, 72, 65 Bowie 15, 47, 35, 92, 94 Ananya 91, 68, 87, 75 Extra credit: Compute the average for...
C# Create a console application that prompts the user to enter a regular expression, and then...
C# Create a console application that prompts the user to enter a regular expression, and then prompts the user to enter some input and compare the two for a match until the user presses Esc: The default regular expression checks for at least one digit. Enter a regular expression (or press ENTER to use the default): ^[a- z]+$ Enter some input: apples apples matches ^[a-z]+$? True Press ESC to end or any key to try again. Enter a regular expression...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT