Question

Write a program that will compute the user annual salary. Prompt the user the enter (1)...

Write a program that will compute the user annual salary. Prompt the user the enter (1) the weekly salary. Store the information in a double variable. Prompt the user to enter the number of weeks worked in a year. Use an int variable for that.

Write code that will compute the user's Annual salary. Gross salary is salary before any deductions are taken.

Update the code and prompt the user to enter the federal tax rate and the state's tax rate which are deducted from the weekly salary. Enter these values as percentages, without the percentage sign. Use double variables to store them. Compute and output the total taxes taken from the user's annual salary and the Net annual salary, which is the salary minus all taxes.

Update the code and prompt the user for the social security amount deducted from the weekly salary. (Assume that is less than the weekly salary). Store this information in a double variable. Compute the total annual social security amount taken from the user's annual salary and output the new net annual salary after all deductions. (Taxes and Social Security)

Update the code to compute and output the Annual deduction rate. The deduction rate is the total annual deductions taken from the salary divided by the gross annual salary. Display it as a percentage in the output.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here is the code with screenshot

=======================================================================================

import java.util.Scanner;

public class AnnualSalaryCalculator {

    private static Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {

        System.out.print("Enter weekly salary: ");
        double weeklySalary = scanner.nextDouble();

        System.out.print("Enter the number of weeks worked in a year: ");
        int weeksWorked = scanner.nextInt();

        double grossSalary = weeklySalary * weeksWorked;

        System.out.print("Enter federal tax rate as percentage (without % sign): ");
        double federalTax = scanner.nextDouble();

        System.out.print("Enter state tax rate as percentage (without % sign): ");
        double stateTax = scanner.nextDouble();

        double totalTax = federalTax * 0.01 * grossSalary + stateTax * 0.01 * grossSalary;

        double netSalary = grossSalary - totalTax;

        System.out.print("Enter SSN amount deducted every week: ");
        double ssnAmount = scanner.nextDouble();

        double yearlySSNDeducted = ssnAmount * weeksWorked;

        System.out.println("Gross Salary           : $" + String.format("%20.2f", grossSalary));
        System.out.println("Annual Tax             : $" + String.format("%20.2f", totalTax));
        System.out.println("Net Salary (-Tax)      : $" + String.format("%20.2f", netSalary));
        System.out.println("Yearly SSN Deducted    : $" + String.format("%20.2f", yearlySSNDeducted));
        System.out.println("Net Salary (-Tax -SSN) : $" + String.format("%20.2f", netSalary - yearlySSNDeducted));

        double annualDeductionRate = 100.0 * (totalTax + yearlySSNDeducted) / grossSalary;
        System.out.println("Annual Deduction Rate  :  " + String.format("%19.2f", annualDeductionRate)+"%");


    }
}

=======================================================================================

Add a comment
Know the answer?
Add Answer to:
Write a program that will compute the user annual salary. Prompt the user the enter (1)...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Styles Program Description Write a C++ program that computes and displays employees' earnings. Prompt the user...

    Styles Program Description Write a C++ program that computes and displays employees' earnings. Prompt the user for type of employee (hourly ("h"or "H") or management ("'m" or "M") If the employee is management: . get the annual salary get the pay period (weekly ("w" or "W"), bi-weekly ("b" or "B") or monthly ("m" or e compute the gross salary for the pay period (Divide annual salary by 52 for weekly, 26 for bi-weekly, and 12 for monthly) deduct from gross...

  • Y F G Prompt and Store. 5. Prompt the user with "Enter your weight in pounds:...

    Y F G Prompt and Store. 5. Prompt the user with "Enter your weight in pounds: "message and store in the weight variable. 6. Initialize an int variable named heightIn Inches to feet OſHeight times 12 plus Inches OfHeight. 7. Initialize a double variable named BMI to weight * 703.0 heightIrinches El VB 8. Initialize a double variable named ratio to height In Inches? 703.0 9. Initialize a double variable named lower Normal to 18.5 times ratio. 10. Initialize a...

  • Write a java program to prompt the user to enter three doubles and compute the sum...

    Write a java program to prompt the user to enter three doubles and compute the sum and product. Print "The sum is 999 and the product is 999.", where 999 is replaced with the user sum and product.

  • c++ please (1) Write a program that prompts the user to enter an integer value N...

    c++ please (1) Write a program that prompts the user to enter an integer value N which will rpresent the parameter to be sent to a function. Use the format below. Then write a function named CubicRoot The function will receive the parameter N and return'its cubic value. In the main program print the message: (30 Points) Enter an integer N: [. ..1 The cubic root of I.. ] is 2 update the code om part and write another function...

  • ASAP Please. Python Program Description Create an object-oriented program that allows you to enter data for...

    ASAP Please. Python Program Description Create an object-oriented program that allows you to enter data for employees. Specifications Create an abstract Employee class that provides private attributes for the first name, last name, email address, and social security number. This class should provide functions that set and return the employee’s first name, last name, email address, and social security number. This class has a function: get_net_income which returns 0. Create a Manager class that inherits the Employee class. This class...

  • 1. Write a C++ program that will ask the user for their full name and calculate...

    1. Write a C++ program that will ask the user for their full name and calculate the user's weekly salary based on their hourly wage and the number of hours they worked, assuming no overtime at this point. Sample program run: Please enter first name: Elmer Please enter middle initial (Enter space if none): J Please enter last name: Fudd Enter hours worked: 37.5 Enter hourly rate: 10.35 Your name is: Elmer J. Fudd Your weekly salary is: $388.12 2....

  • Write a program in Java language to prompt the user to enter 3 integers (A, B,...

    Write a program in Java language to prompt the user to enter 3 integers (A, B, and C) then display these numbers from the lowest to the highest (sorted ascendingly) . Note that there are 6 different cases to handle proper order. As an example, a user entered 10 for A, 5 for B and 14 for C: the output of the program should look like this Enter number A? 10 Enter number B? 5 Enter number C? 14 Your...

  • You are to write a program IN C++ that asks the user to enter an item's...

    You are to write a program IN C++ that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: if the an item's wholesale cost is 5.00 and its markup percentage is 100%, then the item's retail price is 10.00 If an item's wholesale cost is 5.00 and its markup percentage is 50%, then the item's retail price is 7.50 Program design specs. You should have 5...

  • Write a Java application with a class name of Payroll, for the “Travel Agency”, that willCalculate...

    Write a Java application with a class name of Payroll, for the “Travel Agency”, that willCalculate the weekly paycheck for both Salaried and Hourly employees. Salaried employees will be paid 1/52 of their annual pay minus 18% withheld for federal and state taxes, as well as 4% for retirement pension. Salaried employees do not collect overtime pay. There are two types of Hourly employees; permanent employees and temporary weekly employees. •Permanent weekly employees will be paid their hourly rate minus...

  • Your program must prompt the user to enter a string. The program must then test the...

    Your program must prompt the user to enter a string. The program must then test the string entered by the user to determine whether it is a palindrome. A palindrome is a string that reads the same backwards and forwards, such as "radar", "racecar", and "able was I ere I saw elba". It is customary to ignore spaces, punctuation, and capitalization when looking for palindromes. For example, "A man, a plan, a canal. Panama!" is considered to be a palindrome....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT