Question

In: Computer Science

Write a java program that calculates the total amount of money a person has made over...

Write a java program that calculates the total amount of money a person has made over the last year. The program will prompt the user for dollar amounts showing how much the user has made per job. Some users will have had more than one job, make sure your program allows for this. The program will print out the total made (all jobs) and will print out the federal and state taxes based on the total made. For this program, the federal tax will be 8.5% and the state tax will be 14.5%.

  1. Use appropriate comments throughout the program. ***PLEASE BE AS DETAILED AS POSSIBLE TO UNDERSTAND CODE FORMAT***
  2. Create a header at the top showing the programmer, date of creation and class.
  3. Make sure you insert appropriate instructions for the user.

Solutions

Expert Solution

import java.util.Scanner;

public class Jobs {
   public static final double FEDERAL_TAX=8.5;
   public static final double STATE_TAX=14.5;
   public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
       int i=1;
       double n,gross=0;
       //reading the salaries for all jobs from user
       //adding to sum of the incomes
       while(true) {
           System.out.println("How much income you made through job "+i+"(-1 to quit)");
           n=sc.nextDouble();
           i++;
           if(n==-1)
               break;
           gross+=n;
          
       }
      
       double federalTax=getTax(gross,FEDERAL_TAX);
       double stateTax=getTax(gross, STATE_TAX);
       double net=gross-federalTax-stateTax;
       System.out.println("Gross : "+gross);
       System.out.println("Federal Tax : "+federalTax);
       System.out.println("State Tax: "+stateTax);
       System.out.println("Net : "+net);
      
   }
   //returns the tax on given amount with given percentage
   private static double getTax(double n, double tax) {
       return n * (tax/100);
   }
}

Note : Please comment below if you have concerns. I am here to help you

If you like my answer please rate and help me it is very Imp for me


Related Solutions

Design a c++ program that calculates the amount of money a person would earn over a...
Design a c++ program that calculates the amount of money a person would earn over a period of time if his salary is one penny the first day, two pennies second day, and continues to double each day. The program should ask the user for the number of days. Display a table showing what the salary was for each day, and then show total pay at the end of the period. the output should be displayed in a dollar amount,...
Write a program that calculates the amount a person would earn over a period of time...
Write a program that calculates the amount a person would earn over a period of time if his or her salary is one penny the first day, two pennies the second day, and continues to double each day. The program should display a table showing the salary for each day, and then show the total pay at the end of the period. The output should be displayed in a dollar amount, not the number of pennies. Input Validation: Do not...
Your task is to write a program in C or C++ that calculates the total amount...
Your task is to write a program in C or C++ that calculates the total amount of money a person has made over the last year. Your program will prompt the user for dollar amounts showing how much the user has made per job. Some users will have had more than one job, make sure your program allows for this. The program will print out the total made (all jobs) and will print out the federal and state taxes based...
Needs to be in JAVA. Write a Java program that accepts the total amount of cars...
Needs to be in JAVA. Write a Java program that accepts the total amount of cars sold and total sales amount of a car salesperson for a given month. The salesperson’s paycheck is computed as follows: a. Every sales person gets 10% (commission) of total sales b. Sales totals greater than $50,000 get 5% of total sales amount c. 8 or more cars sold earns the salesperson an extra 3% Please remove 30% (taxes) of the gross pay and list...
Write a program in java which calculates the total price of an item you purchased which...
Write a program in java which calculates the total price of an item you purchased which includes sales tax. Create a Scanner object to read information from keyboard, Display prompts and get input, perform the calculation and display the Result of the program.
Program in Java code Write a program with total change amount in pennies as an integer...
Program in Java code Write a program with total change amount in pennies as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies. .Ex1: If the input is: 0 the output is:    No change            Ex2: If the input is:    45   the output is:   1 Quarter 2 Dimes
a.Create the logic for a program using pseudocode that calculates and displays the amount of money...
a.Create the logic for a program using pseudocode that calculates and displays the amount of money you would have if you invested $5000 at 2 percent simple interest for one year. Create a separate method to do the calculation and return the result to be displayed. b.Modify the program in Exercise 2a so that the main program prompts the user for the amount of money and passes it to the interest-calculating method. c.Modify the program in Exercise 2b so that...
Please use Phyton to write a program: Write a program that calculates and displays the total...
Please use Phyton to write a program: Write a program that calculates and displays the total bill at a restaurant for a couple that is dining. The program should collect from the couple, cost of each meal, and the percentage of the final cost that they would like to tip. The sales tax in the state where the restaurant exists is 7.5%. Display to the user, line by line: Total Cost of Both Meals Sales Tax in dollars Tip in...
In the space provided below write a C program that computes the total amount of money...
In the space provided below write a C program that computes the total amount of money you have stored in your piggy bank. Your program does this by asking you for number of pennies, nickels, dimes, and quarters in the piggy bank and then displays how much money in total is in the piggy bank.
In JAVA • Write a program that calculates the average of a group of test scores,...
In JAVA • Write a program that calculates the average of a group of test scores, where the lowest score in the group is dropped. It should use the following methods: • int getScore() should ask the user for a test score, store it in a reference parameter variable, and validate it. This method should be called by main once for each of the five scores to be entered. • void calcAverage() should calculate and display the average of the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT