In: Computer Science
JAVA!
Methods
void read_data()
Description: It handles the reading from the input and the storage of the above class properties
void write_data()
Description: It handles the writing to the output of the final tax return result
float adjusted_gross_income(float income)
Description: It returns the adjusted gross income
Logic: Adjusted gross income is what remains in the income after subtracting the social security and medicare taxes. Social security rate is 12.4%. Medicare is 2.9% but it only applies to the first $100K of the income. Both social security and medicare taxes are split equally between employer and employee.
Note: Could you plz go this code and let me know if
u need any changes in this.Thank You
_________________
// Operations.java
import java.util.Scanner;
public class Operations {
private float gross_pay;
private final float MEDICARE=2.9F;
private final float SSN=12.4F;
private float tax;
public void read_data()
{
/*
* Creating an Scanner class object
which is used to get the inputs
* entered by the user
*/
Scanner sc = new
Scanner(System.in);
System.out.print("Enter Gross
Pay :$");
this.gross_pay=sc.nextFloat();
}
public void write_data()
{
System.out.println(" Gross
Pay:$"+gross_pay);
adjusted_gross_income(gross_pay);
System.out.println("
Tax:$"+tax);
System.out.println(" Net Pay
:$"+adjusted_gross_income(gross_pay));
}
public float adjusted_gross_income(float income)
{
this.tax=income*(SSN/100)/2-income*(MEDICARE/100)/2;
return income-tax;
}
}
______________________
//Test.java
public class Test {
public static void main(String[] args) {
Operations o = new
Operations();
o.read_data();
o.write_data();
}
}
________________________
Output:
Enter Gross Pay :$450000
Gross Pay:$450000.0
Tax:$21375.0
Net Pay :$428625.0
_______________Could you plz rate me well.Thank You