Answer to Question #280266 in Java | JSP | JSF for Benny

Question #280266

Businesses are categorized as small, medium, & large based on their turnover profit. If up to $5,000 profit is realized in a month, business should be classified as small, $5,000 but up to $10,000 is realized in a month, business should be classified as medium, when more than $10,000, the business should be considered as large. Your application should:

 

a) Request for a company's profit to be entered. Categorize the company into small, medium, and large scale based on the profit made.

 

b) Create a method to compute the following taxes:

1. Small scale, first $2500 tax of 3.5% and 6.7% for any other profit made

2. Medium scale, first $7800 tax of 6.6% and 9.2% for any other profit

3. Large scale, first $16000, tax of 9.3% and 13% for any other profit. NB. Percentage profit is per month

 

c) Program should calculate 2% extra tax on the calculated tax for refuse collection and display the following result:

1. Category, tax and refuse tax

2. Total tax which is the sum of the tax and refuse tax.


1
Expert's answer
2021-12-16T04:45:46-0500


import java.util.Scanner;


public class App {


	/**
	 * The start point of the program
	 * 
	 * @param args
	 * 
	 */
	public static void main(String[] args) {


		Scanner keyBoard = new Scanner(System.in);
		System.out.print("Ente a company's profit: ");
		double companyProfit = keyBoard.nextDouble();
		String category = "";
		if (companyProfit < 5000) {
			category = "small";
		}
		if (companyProfit >= 5000 && companyProfit < 10000) {
			category = "medium";
		}
		if (companyProfit >= 10000) {
			category = "large";
		}


		double tax = calculateTax(companyProfit, category);
		double refuseTax = companyProfit * 0.02;
		// Total tax which is the sum of the tax and refuse tax.
		double totalTax = tax + refuseTax;


		System.out.printf("\nCategory is: %s\n", category);
		System.out.printf("Tax is: %.2f\n", tax);
		System.out.printf("Refuse tax is: %.2f\n", refuseTax);
		System.out.printf("Total tax is: %.2f\n", totalTax);


		keyBoard.close();
	}


	private static double calculateTax(double companyProfit, String category) {
		// 1. Small scale, first $2500 tax of 3.5% and 6.7% for any other profit made
		if (category == "small") {
			if (companyProfit <= 2500) {
				return companyProfit * 0.035;
			}
			return 2500 * 0.035 + (companyProfit - 2500) * 0.067;
		}
		// 2. Medium scale, first $7800 tax of 6.6% and 9.2% for any other profit
		if (category == "medium") {
			if (companyProfit <= 7800) {
				return companyProfit * 0.066;
			}
			return 7800 * 0.066 + (companyProfit - 7800) * 0.092;
		}
		// 3. Large scale, first $16000, tax of 9.3% and 13% for any other profit. NB.
		if (companyProfit <= 16000) {
			return companyProfit * 0.093;
		}
		return 7800 * 0.093 + (companyProfit - 16000) * 0.13;
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog