Question

In: Computer Science

Must be in C# Create an application that determines the total due on purchases including sales...

Must be in C#

Create an application that determines the total due on purchases including sales tax and shipping charges. Allow the user to input any number of item prices. Use a do-while loop such that in the first iteration, you ask the user to enter the price for an item. Keep a counter variable to track the number of items the user has entered by incrementing its value at every iteration. As the last statement for the do{} construct, ask the user if they wish to enter more item prices. Re-execute the do-while loop if the user enters “yes”.

Shipping charges are determined based on the number of items purchased using the following chart (if necessary, use if/else statements for making this decision).

Fewer than 3 items $3.50

3 to 6 items $5.00

7 to 10 items $7.00

11 to 15 items $9.00

More than 15 items $10.00

In addition to the above, if the total purchase (before adding sales tax) is $100.00 or more, then provide free shipping. If the user is $10.00 or less away from reaching a total purchase of $100.00, then display a message prompting the user that they are “that many” dollars away from free shipping. This should be implemented in a way that allows the user to continue entering items if they are close to free shipping.

Sales tax of 7.75% is charged against the total purchase. Display an itemized summary to the user with the following information. Total purchase charge, number of items purchased, sales tax amount, shipping charge, and the grand total. Use proper format specifiers if necessary.

Solutions

Expert Solution

SOLUTION-
I have solve the problem in c# code with comments and screenshot for easy understanding :)

CODE-

//C# CODE

using System;

class ItemSales {
  
public static double Price {get; set;}
public static double ShippingCharges {get; set;}
public static double GrandTotal {get;set;}
public static double SalesTax {get; set;}
  
  
public static void Main (string[] args) {
string choice = null;
int counter = 0;
Price = 0.0;
input:
do
{
Console.WriteLine("Enter price of item");
string num = Console.ReadLine();
Price =Price + Convert.ToDouble(num);
  
Console.WriteLine("Want to enter price of more item");
choice = Console.ReadLine();
counter++;
} while (choice.Equals("yes"));
  
if(Price <=90)
{
double diff = 100.0 - Price;
Console.WriteLine("You are $"+diff.ToString() +" away to get free shipping");
Console.WriteLine();
goto input;
}
else if(Price >=100)
{
  
Console.WriteLine();
Console.WriteLine("Congratulations!!!, You got free shipping");
Console.WriteLine();
}
if(counter < 3 )
{
ShippingCharges = 3.50;
}
else if(counter >=3 && counter <=6)
{
ShippingCharges= 5.00;
}
else if(counter >=7 && counter <=10)
{
ShippingCharges= 7.00;
}
else if(counter >=11 && counter <=15)
{
ShippingCharges= 9.00;
}
else if(counter >15)
{
ShippingCharges= 10.00;
}
SalesTax = (7.75 * Price)/100.0;
GrandTotal = SalesTax + Price;
//Total purchase charge, number of items purchased, sales tax amount, shipping charge, and the grand total
Console.WriteLine("Total purchase charge is $"+Price.ToString());
Console.WriteLine();
Console.WriteLine("Number of items purchased is "+counter.ToString());
Console.WriteLine();
Console.WriteLine("Total Sales Tax amount is $"+SalesTax.ToString());
Console.WriteLine();
Console.WriteLine("Shipping Charge is $"+ShippingCharges.ToString());
Console.WriteLine();
Console.WriteLine("Grand Total amount is is $"+GrandTotal.ToString());
}
}

Output:


IF YOU HAVE ANY DOUBT PLEASE COMMENT DOWN BELOW I WILL SOLVE IT FOR YOU:)
----------------PLEASE RATE THE ANSWER-----------THANK YOU!!!!!!!!----------


Related Solutions

in visual C# Total Sales This is the design of the application. This image shows the...
in visual C# Total Sales This is the design of the application. This image shows the application’s form when it starts running and processes the data in the file: You are tasked with creating an application that reads a file’s contents (File: Sales) into an array, displays the array’s contents in a ListBox control (Chapter 4), and calculates and displays the total of the array’s values. You will use a loop (Chapter 5) to read in the data from the...
In C# Create a GUI application that calculates and displays the total travel expenses of a...
In C# Create a GUI application that calculates and displays the total travel expenses of a business person on a trip. Here is the information that the user must provide: Number of days on the trip Amount of airfare, if any Amount of car rental fees, if any Number of miles driven, if a private vehicle was used Amount of parking fees, if any Amount of taxi charges, if any Conference or seminar registration fees, if any Lodging charges, per...
Create a GUI application in C# that calculates and displays the total travel expenses of a...
Create a GUI application in C# that calculates and displays the total travel expenses of a business person on a trip. Here is the information that the user must provide: • Number of days on the trip • Amount of airfare, if any • Amount of car rental fees, if any • Number of miles driven, if a private vehicle was used • Amount of parking fees, if any • Amount of taxi charges, if any • Conference or seminar...
C# Create an application that asks the user to enter their new password. The password must...
C# Create an application that asks the user to enter their new password. The password must be at least 6 characters long. Develop a custom exception handling case that checks for the password length. (hint: use " .Length " built-in method). If the new password is less than 6 characters long the custom exception should output an error message.
Must be in Visual C# using windows forms : Create an application that opens a specified...
Must be in Visual C# using windows forms : Create an application that opens a specified text file and then displays a list of all the unique words found in the file. Hint: Use a LINQ method to remove all duplicate words.
Must be in C#: 7. E-MAIL ADDRESS BOOK Create a Windows Forms Application with a class...
Must be in C#: 7. E-MAIL ADDRESS BOOK Create a Windows Forms Application with a class named PersonEntry. The PersonEntry class should have properties for a person’s name, e-mail address, and phone number. Also, create a text file that contains the names, e-mail addresses, and phone numbers for at least five people. When the application starts, it should read the data from the file and create a PersonEntry object for each person’s data. The PersonEntry objects should be added to...
designing a multithreaded application in C that determines whether the solution to a Sudoku puzzle is...
designing a multithreaded application in C that determines whether the solution to a Sudoku puzzle is valid A Sudoku puzzle uses a 9×9 grid in which each column and row, as well as each of the nine 3×3 subgrids, must contain all of the digits 1 to 9. main.c #include <stdio.h> #include <stdlib.h> #include <string.h> #include <pthread.h> int puzzle[PUZZLE_SIZE+1][PUZZLE_SIZE+1]; int status_map[NUMBER_OF_THREADS];    parameters* worker_params[NUMBER_OF_THREADS]; pthread_t workers[NUMBER_OF_THREADS]; int main(int argc, char** argv) {    //Read the sudoku solution from  the file specified...
Create a simple C++ application that will exhibit concurrencyconcepts. Your application should create two threads...
Create a simple C++ application that will exhibit concurrency concepts. Your application should create two threads that will act as counters. One thread should count up to 20. Once thread one reaches 20, then a second thread should be used to count down to 0. For your created code, provide a detailed analysis of appropriate concepts that could impact your application. Specifically, address:Performance issues with concurrencyVulnerabilities exhibited with use of stringsSecurity of the data types exhibited.
Create an application that allows the user to enter the total for an order and the...
Create an application that allows the user to enter the total for an order and the name of the customer. If the order is less than 500 dollars, the customer gets no discount. If the order is greater than or equal to 500 and less than 1000 dollars, the customer gets a 5 percent discount. If the order is greater than or equal to 1000 dollars, the customer gets a 10 percent discount. The application should display the name of...
Create in C Sharp : Create an application that predicts the approximate size of a population...
Create in C Sharp : Create an application that predicts the approximate size of a population of organisms. The application should use text boxes to allow the user to enter the starting number of organisms, the average daily population increase (as a percentage), and the number of days the organisms will be left to multiply. For example, assume the user enters the following values in text boxes: Starting number of organisms: 2 Average daily increase: 30% Number of days to...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT