Question
I have struggle with this assignment. Please help question : Annual Pay Suppose an employee get paid every two weeks. In a year the employee
I have struggle with this assignment. Please help
question: Annual Pay
Suppose an employee get paid every two weeks. In a year the employee get s paid 26 times. Write a Java program that defines the following variables:
payAmount: This variable will hold the amount of the pay the employee earns each pay period. Your program will ask the user to enter the amount of the pay the employee earn each pay period. (Assume that the employee get the same amount for all pay periods.)
payPeriods: This variable will hold the number of pay periods in a year. Initialize the variable to 26.
annualPay: This variable will hold the employee's total annual pay, which will be calculated.
bonusPay: This variable will hold the employee's bonus based on the total annual pay. Each employee get 5% of the annual pay as his/her bonus pay. This item will be calculated.
totalPay: This variable will hold the total amount of pay the employee earns for the year, which is the sum of the annual pay and the bonus pay.
The program should ask the user to enter the amount of pay the employee earns each pay period. Then the program will calculate the annual pay by multiplying the employee's pay amount by the number of pay periods in a year and store the result in the annualPay variable. The program will then calculate the amount of the bonus by multiplying the annual pay with 5% and store the result in the bonusPay variable. Finally the program will calculate the total pay by adding the annual pay and bonus pay. Display each calculation result.
Requirements:
1. well-documented
2. you can use Scanner class or JOptionPane to gather input
3. You can use System.out or JOptionPane to display output
4. Attach .java file when submitting the program
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started