Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. Create a new class that calculates the sales tax on a purchase. (This should be similar to the BankAccount class) a. Create a class

image text in transcribed

image text in transcribed

2. Create a new class that calculates the sales tax on a purchase. (This should be similar to the BankAccount class) a. Create a class named SalesTax. b. You will need 4 instance variables: tax, purchasePrice, taxDue, and totalCost. The variable tax will hold the sales tax rate (as a percent value); purchasePrice will hold the price of the item purchased; taxDue wil hold the amount of tax for the purchased item calculated based on the sales tax rate, and totalCost will hold the purchase price plus the tax due. Think about what kind of data each variable will hold to determine what type the variables should be Create 2 constructors. The constructors should be patterned after BankAccount with a default constructor with the tax set to 0 and another constructor that sets the tax equal to the explicit parameter (argument) Create a method called calculateSalesTax. (This method should also be similar to deposit in the Bankaccount class) c. d. i. This method should accept as input the price of the purchase (a parameter variable called purchase)

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

Next Generation Databases NoSQLand Big Data

Authors: Guy Harrison

1st Edition

1484213300, 978-1484213308

More Books

Students also viewed these Databases questions

Question

Ty e2y Evaluate the integral dy

Answered: 1 week ago

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago