Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In JAVA, this program is designed to print a paystub and if there is not hourly wage it should be overloaded, it does not seem

In JAVA, this program is designed to print a paystub and if there is not hourly wage it should be overloaded, it does not seem to run. Can I get some help please?

Here is what I have so far:

port java.util.Scanner; public class PayStub { public static void main(String[] args) { Scanner input = new Scanner(System.in); String name; double payRate; double workHours; double grossPay = 0; // Calculated pay before taxes double taxes = 0; // gross pay * rate of 25 pct double netPay = 0; // Calculate pay after taxes // boolean continue = true; // Loop variable System.out.print("Enter the employee name: "); name = input.nextLine(); System.out.print("Please enter hourly rate: $"); payRate = input.nextDouble(); System.out.print("Enter your hours worked: "); workHours = input.nextDouble(); System.out.println(name); System.out.println("Your gross pay is: $" + getGross(payRate, workHours)); // System.out.println("Rate of pay is " + getGross(payRate, workHours)); System.out.println("Your taxes are " + getTaxes(grossPay)); // System.out.println("Your net pay is " + getNet(grossPay, taxes)); } // public static double getGross(double workHours) { // double grossPay = workHours * 0; // return grossPay; // } public static double getGross(double payRate, double workHours) { double grossPay = workHours * payRate; return grossPay; } public static double getTaxes(double grossPay) { double taxes = grossPay * 0.25; return taxes; } public static double getNet(double grossPay, double taxes) { double netPay = grossPay - taxes; return netPay; } } 

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

More Books

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago