Calculation of tax in Uzapia

The United Nations have just recognised a new country called Uzapia. Uzapia has
a currency called Zubies (ZB). The Uzapian tax system is highly simplified and
meant to be fair. They have system where all their income is converted to one
single value and then the tax is applied according to the following rule(s):
For non business tax payers
1. If a person earns less than ZB10,000.00 then they pay 10% tax on all
income, and ,
2. If they earn >= ZB10,000.00, then they pay 10% on the first ZB 10,000
Zubies and 30% tax on the rest of the income.
For business tax payers, only profit is taxed (i.e. overhead expenses are deducted
from gross sales/income, overheads are things like electricity, company car
expense, advertising, stationary etc.)
1. If a business makes less than ZB50,000.00 Gross then they pay 25% tax on
profit, and ,
2. If they earn >= ZB50,000.00, then they pay 35% on the first ZB 10,000
Zubies and 30% tax on the rest of the income.
The user should provide as input
1. Full name of the person ( or Business),
2. Indication with a string input whether you are “Business” or “Employee”
3. ALL their income sources and amounts ,
4. Any and All overheads for businesses
(a) Write a pseudo-code for the tax calculation in Uzapia
(b) Convert your pseudo-code in (a) into an equivalent flow chart
(c) Write a program in Java, that calculates and prints as output the following tableAll
numbers must be rounded to 2 Decimal places
********************************************************
Income Item Overhead Item ( If applicable)
********************************************************
Item (s) Items(s)
********************************************************
Total Income
Total Overhead
Total Profit(if applicable)
********************************************************
Total Taxes(ZB)
*********************************************************

(a) Pseudo-code for the tax calculation in Uzapia:

1. Prompt the user for their full name.
2. Prompt the user to indicate whether they are a "Business" or "Employee".
3. If the user is an "Employee":
a. Prompt the user for their income.
b. Check if the income is less than ZB10,000.00.
c. If the income is less than ZB10,000.00, calculate the tax as 10% of the income.
d. If the income is greater than or equal to ZB10,000.00, calculate the tax as 10% of ZB10,000.00 plus 30% of the remaining income.
4. If the user is a "Business":
a. Prompt the user for their gross income and overhead expenses.
b. Check if the gross income is less than ZB50,000.00.
c. If the gross income is less than ZB50,000.00, calculate the tax as 25% of the profit (gross income minus overhead expenses).
d. If the gross income is greater than or equal to ZB50,000.00, calculate the tax as 35% of ZB10,000.00 plus 30% of the remaining profit (gross income minus overhead expenses).
5. Print the calculated tax amount.

(b) Flowchart:

```
start
|
|--- Prompt for full name
|
|--- Prompt for "Business" or "Employee"
|
|--- If "Employee" branch
| |
| |--- Prompt for income
| |
| |--- If income < ZB10,000.00
| | |
| | |--- Calculate tax as 10% of income
| | |
| |--- Else
| | |
| | |--- Calculate tax as 10% of ZB10,000.00 + 30% of (income - ZB10,000.00)
|
|--- If "Business" branch
| |
| |--- Prompt for gross income
| |
| |--- Prompt for overhead expenses
| |
| |--- If gross income < ZB50,000.00
| | |
| | |--- Calculate tax as 25% of (gross income - overhead expenses)
| | |
| |--- Else
| | |
| | |--- Calculate tax as 35% of ZB10,000.00 + 30% of (gross income - overhead expenses - ZB10,000.00)
|
|--- Print tax amount
|
end
```

(c) Java program:

```java
import java.text.DecimalFormat;
import java.util.Scanner;

public class UzapiaTaxCalculator {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
DecimalFormat decimalFormat = new DecimalFormat("0.00");

// Prompt for full name
System.out.print("Enter full name: ");
String fullName = scanner.nextLine();

// Prompt for "Business" or "Employee"
System.out.print("Are you a Business or Employee? ");
String taxPayerType = scanner.nextLine();

double income = 0.0;
double grossIncome = 0.0;
double overheadExpenses = 0.0;

// If "Employee" branch
if (taxPayerType.equalsIgnoreCase("Employee")) {
// Prompt for income
System.out.print("Enter income: ");
income = scanner.nextDouble();

// If income < ZB10,000.00
if (income < 10000.00) {
// Calculate tax as 10% of income
double tax = income * 0.10;
System.out.println("Tax: ZB" + decimalFormat.format(tax));
} else {
// Calculate tax as 10% of ZB10,000.00 + 30% of (income - ZB10,000.00)
double tax = (10000.00 * 0.10) + ((income - 10000.00) * 0.30);
System.out.println("Tax: ZB" + decimalFormat.format(tax));
}
}
// If "Business" branch
else if (taxPayerType.equalsIgnoreCase("Business")) {
// Prompt for gross income
System.out.print("Enter gross income: ");
grossIncome = scanner.nextDouble();

// Prompt for overhead expenses
System.out.print("Enter overhead expenses: ");
overheadExpenses = scanner.nextDouble();

// If gross income < ZB50,000.00
if (grossIncome < 50000.00) {
// Calculate tax as 25% of (gross income - overhead expenses)
double tax = (grossIncome - overheadExpenses) * 0.25;
System.out.println("Tax: ZB" + decimalFormat.format(tax));
} else {
// Calculate tax as 35% of ZB10,000.00 + 30% of (gross income - overhead expenses - ZB10,000.00)
double tax = (10000.00 * 0.35) + ((grossIncome - overheadExpenses - 10000.00) * 0.30);
System.out.println("Tax: ZB" + decimalFormat.format(tax));
}
}
}
}
```