Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assume that you've started a business that sells sporting goods equipment online. You currently have operations in Arizona and California. As such, you only need

Assume that you've started a business that sells sporting goods equipment online. You currently have operations in Arizona and California. As such, you only need to charge tax if the order comes from one of these states. Assume the tax rate is 10% for California and 5% for Arizona. You also need to charge for shipping. You charge a flat rate of $12.99 for orders less than $50 and a rate of $4.99 for orders between $50 and $100. You do not charge shipping for orders $100 and over.

Create a program that allows employees to calculate the tax and shipping charges. The program should do the following:

Note: Your results should be output to decimal places, and they should use the appropriate format specifiers.

Allow the user to enter the total amount of the order (subtotal).

Allow the user to enter the state (CA for California and AZ for Arizona).

Store the information entered by the user into a separate class, and create instance methods to calculate the tax and the shipping amount.

Output the subtotal, tax amount, shipping amount, and grand total (i.e., order amount plus the tax and shipping amount).

So far I have

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

namespace lesson_6 { class Program { static void Main(string[] args) { double shippingAmount; double tax; string stateAbbrev; double grandTotal;

//enter order amount Console.WriteLine("enter order amount"); Console.WriteLine(); double orderTotal = Convert.ToDouble(Console.ReadLine()); Console.ReadLine();

//enter state Console.WriteLine("enter the state abbreviation AZ or CA."); Console.WriteLine("its full name will" + " be displayed."); Console.WriteLine(); stateAbbrev = Console.ReadLine(); switch (stateAbbrev) { //AZ sales tax case "AZ": Console.WriteLine("Arizona tax is 5%."); tax = 1.05; break;

//California sales tax case "CA": Console.WriteLine("California tax is 10%"); tax = 1.10; break; //error message default: Console.WriteLine("No match"); break;

} //Calculate shipping if (orderTotal < 50) shippingAmount = 12.99;

else if (orderTotal >= 50 &&orderTotal < 100) shippingAmount = 4.99;

else if (orderTotal >= 100) shippingAmount = 0; Console.WriteLine("your total is " + "{0:0.00}", orderTotal);

Console.ReadKey(); } } }

as my code but i cant get for the life of me to figure how to have the code add up the grandtotal which should = shipping abmount(based on ordertotal) + tax (based on state)

this is C#

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions