By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,789 Members | 1,190 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,789 IT Pros & Developers. It's quick & easy.

Planning a Program

P: 2
How do I get this program to run properly? I ran it multiple times, but can't seem to get it to work. I keep getting errors on the 'else' part of the programm

Effective March 1, 2012 the individual social security tax rate will increase from 4.2% to 6.2%. Code a program that calculates what you will be paying based on your gross monthly income. Social security is taxed on no more than $110,100 in 2012 and no more than $106,800 in 2011 up through the end of February 2012. Display the amount of social security to be deducted and the amount of the increase.

Prompt 1:

Please enter your name:

Prompt 2:

Please enter your gross monthly income:

Output specification: Where the Xs is the user’s name. Use JOptionPane to display the output.

Xxxxxxx, your monthly social security tax will be $ZZ,ZZ9.99.
This is an increase of $Z,ZZ9.99.
Feb 11 '12 #1
Share this Question
Share on Google+
1 Reply

P: 2
This is what I done so far. Am I going about this wrong?

import java.util.Scanner;

import javax.swing.JOptionPane;

public class HernandezJLE23 {

public static void main(String[] args) {
Scanner input = new Scanner( );

String name =
JOptionPane.showInputDialog( "Please enter your name" );

String name2 =
JOptionPane.showInputDialog( "Please enter your gross monthly income" );

int taxPercent1; // first tax percentage to compare
int taxPercent2; // second tax percentage to compare
float monthlyGross1; // first gross income to compare
float monthlyGross2; // second gross income to compare

System.out.println( "Monthly gross income 1: " );
monthlyGross1 = input.nextFloat();

System.out.println( "Tax percentage 1" );
taxPercent1 = input.nextInt();

System.out.println( "Monthly gross income 2: " );
monthlyGross2 = input.nextFloat();

System.out.println( "Tax percentage 2" );
taxPercent2 = input.nextFloat();

if (monthlyIncome >= 110100.00);
newSocSecTax = 110100.00*.062;
oldSocSecTax = 106800.00*.042;
System.out.println( "newSocSecTax" );


if (monthlyIncome >= 106800.00);
newSocSecTax = monthlyIncome*.062;
oldSocSecTax = 106800.00*.042;
System.out.println( "oldSocSecTax" );


newSocSecTax = monthlyIncome*.062;
oldSocSecTax = monthlyIncome*.042;

Feb 11 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.