Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Below is the code that will compile... But you need to correct logic.</p> <pre><code>import java.io.PrintWriter; import java.util.Scanner; public class Ch3_PrExercise6 { static Scanner console = new Scanner(System.in); public static void main() throws Exception { final double FEDERAL_TAX_RATE = 0.15; final double STATE_TAX_RATE = 0.035; final double SOCIAL_SECURITY_TAX_RATE = 0.575; final double MEDICARE_MEDICAID_TAX_RATE = 0.0275; final double PENSION_PLAN = 0.05; final double HEALTH_INSURANCE = 75; String name; double grossAmount; double federalTAx; double stateTax; double SocialSecurityTax; double MedicareMedicaidTax; double PensionPlan; double HealthInsurance; double NetPay; System.out.print("Bill Robinson"); name = console.nextLine(); System.out.println(); System.out.println(name); grossAmount = console.nextDouble(); federalTAx = grossAmount * FEDERAL_TAX_RATE; stateTax = grossAmount * STATE_TAX_RATE; SocialSecurityTax = grossAmount * SOCIAL_SECURITY_TAX_RATE; MedicareMedicaidTax = grossAmount * MEDICARE_MEDICAID_TAX_RATE; PensionPlan = grossAmount * PENSION_PLAN; HealthInsurance = 75; NetPay = grossAmount - federalTAx - stateTax - SocialSecurityTax - MedicareMedicaidTax - PensionPlan - HealthInsurance; PrintWriter outFile = new PrintWriter("Ch3_Ex6out.txt"); outFile.printf("Bill Robinson"); outFile.printf("%n grossAmounT: $%8.2F"); outFile.printf("%n federalTax $%8.2F"); outFile.printf("%n stateTax $%8.2F"); outFile.printf("%n SocialSecurityTax $%8.2F"); outFile.printf("%n MedicareMedicaidTax $%8.2F"); outFile.printf("%n Pension Plan $%8.2F"); outFile.printf("%n HealthInsurance $%8.2F"); outFile.printf("%n NetPay $%8.2F"); outFile.close(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload