5. Calculation of tax in Ruritania

In a fictitious country of Ruritania, which is in a fictitious continent called Afrisia, the tax system is highly simplified. They have system where all taxes are converted to one single value and then the tax is applied according to the following rule(s): if a person earns less than ZB10,000.00 then you pay 10% tax on all income, and if it is >= ZB10,000.00, then you pay 10% on the first ZB 10,000 zubies ( ZB, the unit of currency in Ruritania, and 30% tax on the rest of your income.
(a) Write a pseudo-code for the tax calculation in Ruritania
(b) Convert your pseudo-code in (a) into an equivalent flow chart
(c) Write a program in Java, that calculates and prints how many million zubies to be paid in taxes.

Nedd help

Sure, I can help you with that. Let's break down the problem into smaller steps to calculate the tax in Ruritania.

(a) Pseudo-code for tax calculation in Ruritania:

```
// Step 1: Input the person's income
income = input("Enter your income in ZB(zubies): ")

// Step 2: Calculate the tax
if income < 10000:
tax = income * 0.1 // 10% tax on all income
else:
tax = (10000 * 0.1) + (income - 10000) * 0.3 // 10% tax on first 10000 zubies, and 30% tax on the rest

// Step 3: Output the tax amount
output("Tax amount in ZB(zubies): ", tax)
```

(b) Flowchart for tax calculation in Ruritania:

```
START
├─ Input income
├─ Check if income < 10000
│ ├─ YES
│ │ ├─ Calculate tax = income * 0.1 (10% tax on all income)
│ │ └─ Output tax
│ └─ NO
│ ├─ Calculate tax = (10000 * 0.1) + (income - 10000) * 0.3 (10% tax on first 10000 zubies, and 30% tax on the rest)
│ └─ Output tax
END
```

(c) Here's an implementation of the program in Java:

```java
import java.util.Scanner;

public class TaxCalculator {
public static void main(String[] args) {
// Step 1: Input the person's income
Scanner scanner = new Scanner(System.in);
System.out.print("Enter your income in ZB(zubies): ");
double income = scanner.nextDouble();

// Step 2: Calculate the tax
double tax;
if (income < 10000) {
tax = income * 0.1; // 10% tax on all income
} else {
tax = (10000 * 0.1) + (income - 10000) * 0.3; // 10% tax on first 10000 zubies, and 30% tax on the rest
}

// Step 3: Output the tax amount
System.out.println("Tax amount in ZB(zubies): " + tax);
}
}
```

You can run this Java program, enter the income when prompted, and it will calculate and print the tax amount in million zubies.