Check out example codes for "Write a class that accepts a user’s hourly rate of pay and the number of hours worked. Display the user’s gross pay, the withholding tax (15% of gross pay), and the net pay (gross pay – withholding). Save the class as Payroll.cs. As illustrated below.". It will help you in understanding the concepts better.

Code Example 1

System.out.println("You worked " + hours + "at $ + rate");

Code Example 2

import java.util.Scanner;public class Payroll{	public static void main(String[] args)	{		int hours;		int rate;		int tax;		int grosspay;		int netpay;		int fedtax;		Scanner keyBoard = new Scanner(System.in);		System.out.print("Enter hourly pay rate: ");		rate = keyBoard.nextInt();		System.out.print("Enter hours worked: ");		hours = keyBoard.nextInt();		System.out.println("You worked " + hours + "at $ + rate");		System.out.println("Gross pay: + grosspay");		grosspay = (hours * rate);		System.out.println("Withholding tax: $ + withholdingtax");		tax = .15;		withholdingtax = (grosspay * tax);		System.out.println("Net pay: + netpay");		netpay = (grosspay - withholdingtax);	}}

Code Example 3

double tax = 0.15;		double withholdingtax = (grosspay * tax);System.out.println("Withholding tax: $"+ withholdingtax);

Code Example 4

System.out.println("Withholding tax: $ + withholdingtax");		tax = .15;		withholdingtax = (grosspay * tax);

Code Example 5

System.out.println("You worked " + hours + "at $" + rate);

Learn ReactJs, React Native from akashmittal.com