Question: Write an interface called Taxable. This interface should have one method called calculateTax which takes two float inputs named income and costs. Write
Write an interface called Taxable. This interface should have one method called calculateTax which takes two float inputs named income and costs.
Write a class called Individual that has one private field called name. This class should implement the Taxable interface. This class will obviously have to have calculateTax which will calculate the tax of an individual according to the following formula:
Income < 6000 -> Tax = 0
6000 <= Income <= 50000 -> Tax = (Income - 6000) * 0.2
50000 < Income - > Tax = 10000 + (Income - 50000) * 0.3
This class should also have a getName() method that returns the name.
Write a main function inside Individual that creates an object of Individual and calculates tax for an income of $65000. Then, it must print the tax computed.
Write a class called Business that implements the Taxable interface. This class will implement calculateTax which will calculate the tax of the business according to the following formula:
Tax = (Income - Costs) * 0.25
This class should also have a getCosts() method that returns the costs.
Write a main function inside Business that creates an object of Business and calculates tax for an income of $125000 and costs of $37000. Then, it must print the tax computed.
Step by Step Solution
There are 3 Steps involved in it
Taxable interface public interface Taxable float calculateTaxfloat income float c... View full answer
Get step-by-step solutions from verified subject matter experts
