Question

In: Computer Science

JAVA! Methods void read_data() Description: It handles the reading from the input and the storage of...

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.

Solutions

Expert Solution

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


Related Solutions

Code in Java Create a stack class to store integers and implement following methods: 1) void...
Code in Java Create a stack class to store integers and implement following methods: 1) void push(int num): This method will push an integer to the top of the stack. 2) int pop(): This method will return the value stored in the top of the stack. If the stack is empty this method will return -1. 3) void display(): This method will display all numbers in the stack from top to bottom (First item displayed will be the top value)....
Program in Java Create a stack class to store integers and implement following methods: 1- void...
Program in Java Create a stack class to store integers and implement following methods: 1- void push(int num): This method will push an integer to the top of the stack. 2- int pop(): This method will return the value stored in the top of the stack. If the stack is empty this method will return -1. 3- void display(): This method will display all numbers in the stack from top to bottom (First item displayed will be the top value)....
Program in Java Create a queue class to store integers and implement following methods: 1- void...
Program in Java Create a queue class to store integers and implement following methods: 1- void enqueue(int num): This method will add an integer to the queue (end of the queue). 2- int dequeue(): This method will return the first item in the queue (First In First Out). 3- void display(): This method will display all items in the queue (First item will be displayed first). 4- Boolean isEmpty(): This method will check the queue and if it is empty,...
Write a JAVA program that contains the following 4 void methods whic will print all subtrings...
Write a JAVA program that contains the following 4 void methods whic will print all subtrings of s in specific orders: printSub1(String s), printSub2(String s), printSub3(String s), and printSub4(String s) For example, if S = "abcd": printSub1 will print "a", "ab", "abc", "abcd", "b", "bc", "bcd", "c", "cd", "d" printSub2 will print "a", "ab", "b", "abc", "bc", "c", "abcd", "bcd", "cd", "d" printSub3 will print "d", "c", "b", "a", "cd", "bc", "ab", "bcd", "abc", "abcd" printSub4 will print "abcd", "bcd",...
Create in Java Create a stack class to store integers and implement following methods: 1- void...
Create in Java Create a stack class to store integers and implement following methods: 1- void push(int num): This method will push an integer to the top of the stack. 2- int pop(): This method will return the value stored in the top of the stack. If the stack is empty this method will return -1. 3- void display(): This method will display all numbers in the stack from top to bottom (First item displayed will be the top value)....
Write a program in java that uses methods to input data for calculation, calculate, and display...
Write a program in java that uses methods to input data for calculation, calculate, and display the results of the calculations. That is, there are at least three methods. The problem is to write a program that calculates the area of a rectangle. This action should be repeatable.
Complete the following methods in java: Consult the rest of the methods of BigInteger from its...
Complete the following methods in java: Consult the rest of the methods of BigInteger from its API documentation as needed to solve the following problems. public static List<BigInteger> fibonacciSum(BigInteger n) The unique breakdown into Fibonacci numbers can be constructed with a greedy algorithm that simply finds the largest Fibonacci number f that is less than or equal to n. Add this f to the result list, and break down the rest of the number given by the expression n-f the...
Write a JAVA program called Convertor that has two methods. The first one converts an input...
Write a JAVA program called Convertor that has two methods. The first one converts an input binary into its equivalent decimal number. The second method converts a decimal number into its equivalent binary.​ binary2Decimal, decimal2Binary are the names for those methods.​ binary2Decimal receives a binary number as a string and returns a decimal number as an integer. And vice versa for the decimal2Binary method.​
JAVA PROGRAMMING Objectives JAVA Practice incremental development. Practice getting input from and printing output for the...
JAVA PROGRAMMING Objectives JAVA Practice incremental development. Practice getting input from and printing output for the user. Write a program with conditional statements. Write a program with loops. Specifications Think of three countries you’d like to travel to and look up the conversion rate between dollars and the money used in those countries. (See http://www.ratesfx.com/ rates/rate-converter.html for conversion rates.) Write a program that will convert money from dollars into each of those three types of currency, or from one of...
This is a Java program Problem Description Write an application that inputs five digits from the...
This is a Java program Problem Description Write an application that inputs five digits from the user, assembles the individual digits into a five-digit integer number (the first digit is for one’s place, the second digit is for the ten’s place, etc.) using arithmetic calculations and prints the number. Assume that the user enters enough digits. Sample Output Enter five digits: 1 2 3 4 5 The number is 54321 Problem-Solving Tips The input digits are integer, so you will...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT