Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Tax Return Program tax season, every Friday. Jaj ac irm provide to people who pr

ID: 3738762 • Letter: T

Question

Tax Return Program tax season, every Friday. Jaj ac irm provide to people who prepare their own tax rcturns Their charges are as follow If a person has low income (ce 25,000) and the consalting time is les thase equal to 30 minutes, there are no changes, otherwise the service are 40% ofthe regular hourly tate forthe time over 30 minutes. For others, if the consalting time is lew than or oqual to 20 minutes, there ane service charges, otherwise, service charges are 70% of the regular hourly rate for the time over 20 minutes (For example, suppose that a penon has low income. spent 1 hour and 15 minutes, and the hourly rate is $70.00. Then the billing amount is 70.00 x 0 x (45760)$21.00) rite a program that prompt the user to enter the hourly rate, the toral Wr nsulting time, and if the person has low income. The program should utput the billing amount. Your program must contain a method that takes as input the hourly rate, the total consulting time, and a value indicating if the person has low income. The method should return the billing amount Your the user to enter the time in Additional requirements: . User input should be validated. The program should repeatedly accept user input and calculate the billing amount until the user choose not to. Do not use global variables for this program!! Sample run: Enter yearly incone 1-999 to end): 24000 Enter the hour ly rate Enter consulting tine in minutess The b:1ling anount 11 0.00 Enter yearly income 1-999 to end):24000 Enter the hourly rate Enter consulting time in minutess The billing anount is: $12-50 Enter yearly incone -999 to end50 Enter the hourly rate: Enter consulting tine in minutess The b:11ing anount iss s0.0 Enter yearly incone -999 to end) 00 Enter the hour 1y rate: Enter consulting time in minutess The billing anount is: 530-63 Enter yearly incone -999 to end 30 Enter the hourly rates- Enter consulting tine in minutess nvalid input, try again Enter yearly incone -999 to end)-999

Explanation / Answer

// Class TaxReturnProg solves the above problem.

import java.util.Scanner;

public class TaxReturnProg {

public static void main(String[] args) {

// TODO Auto-generated method stub

Scanner scan = new Scanner(System.in);

while (true) {

// Infinite input loop

System.out.println("Enter yearly Income (-999 to end): ");

int income = scan.nextInt();

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

int Hrate = scan.nextInt();

//The below if condition is for negative input.

if (Hrate < 0) {

System.out.println("Invalid input, try again");

continue;

}

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

int CTime = scan.nextInt();

// Methods lowIncome and highIncome which returns output.

if (income <= 25000) {

System.out.println("The billing amount is: " + lowIncome(Hrate, CTime));

} else {

System.out.println("The billing amount is: " + highIncome(Hrate, CTime));

}

}

}

private static double highIncome(int hrate, int cTime) {

// TODO Auto-generated method stub

double result;

if (cTime <= 30) {

result = 0.0;

} else {

result = hrate * 0.40 * (((double)cTime - 30) / 60);

}

return result;

}

private static double lowIncome(int hrate, int cTime) {

// TODO Auto-generated method stub

double result;

if (cTime <= 20) {

result = 0.0;

} else {

result = hrate * 0.70 * (((double)cTime - 20) / 60);

}

return result;

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote