Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

instuction 1)flowchart During the tax season, every Friday, A&N accounting firm provides assistance to people who prepare their own e-filing (income tax). Their charges are

instuction

1)flowchart

During the tax season, every Friday, A&N accounting firm provides assistance to people who prepare their own e-filing (income tax). Their charges are as follows.

  1. If a person has low income (<= 25,000) and the consulting time is less than or equal to 30 minutes, there are no charges; otherwise, the service charges are 40% of the regular hourly rate for the time over 30 minutes.
  2. For others, if the consulting time is less than or equal to 20 minutes, there are no service charges; otherwise, service charges are 70% of the regular hourly rate for the time over 20 minutes.

(For example, suppose that a persons income is 24000 and spent 1 hour and 15 minutes, and the hourly rate is RM70.00. Then the billing amount is ((45/60) * 70.00 * 0.40) = RM21.00.)

Note: How to get (45/60) * 70

1 hour 15 minutes = 75 minutes, but charges only apply for the time after 30 minutes, thus we calculate the charges for 45 minutes (75 30 = 45).

Since, 1 hour (60 minutes) charges are 70.00, thus

45 minutes - (45/60) * 70

Write a program that prompts the user to enter the hourly rate, the total consulting time (should be input in the form of hour and minutes), and the persons yearly income. The program should output the billing amount. Your program must contain a method that takes as input the hourly rate, the total consulting time, and the persons income. The method should return the billing amount. Your program should continually prompt the user to enter the input until there is no more tax services to process.

import java.util.Scanner;

public class ReturnTeax {

public static void main(String args[]) {

Scanner sc = new Scanner(System.in);

double theIncome;

double rateHourly;

int consultingTime;

double theCharges;

int timediff;

while(true) {

System.out.println(" ");

theIncome = getYearlytheIncome(sc);

if(theIncome == -999)

break;

rateHourly = getrateHourly(sc);

consultingTime = getConsultingTime(sc);

if(theIncome < 0 || rateHourly <0 || consultingTime < 0) {

System.out.println("Invalid input, tryagain.");

continue;

}

System.out.println(" The billing amount is: "+gettheCharges(consultingTime, rateHourly, istheIncomeLess(theIncome)));

}

}

public static double getrateHourly(Scanner sc) {

System.out.println("Enter rate(hourly): ");

return sc.nextDouble();

}

public static double getYearlytheIncome(Scanner sc) {

System.out.println("Enter the income, yearly (-999 to end): ");

return sc.nextDouble();

}

public static int getConsultingTime(Scanner sc) {

System.out.println("Enter consulting time: ");

return sc.nextInt();

}

public static boolean istheIncomeLess(double theIncome) {

return theIncome <= 25000;

}

public static double gettheCharges(int totalConsultingTime, double rateHourly, boolean islowertheIncome) {

double theCharges=0;

if(islowertheIncome) {

if(totalConsultingTime <=30)

theCharges = 0;

else {

totalConsultingTime = totalConsultingTime - 30;

rateHourly = 0.4*rateHourly;

theCharges = rateHourly * totalConsultingTime / 60;

}

}

else {

if(totalConsultingTime <= 20) {

theCharges = 0;

}

else {

totalConsultingTime = totalConsultingTime - 20;

rateHourly = rateHourly * 0.7;

theCharges = rateHourly * totalConsultingTime / 60;

}

}

return theCharges;

}

}

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

Practical Database Programming With Visual Basic.NET

Authors: Ying Bai

1st Edition

0521712351, 978-0521712354

More Books

Students also viewed these Databases questions

Question

2. What recommendations will you make to the city council?

Answered: 1 week ago

Question

3. The group answers the questions.

Answered: 1 week ago