473,320 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Planning a Program

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
1 2307
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( System.in );

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" );

else

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

else

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


endIf
endIf;
Feb 11 '12 #2

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

Similar topics

33
by: Nick Evans | last post by:
Hello there, I have been on and off learning to code (with python being the second language I have worked on after a bit of BASIC). What I really want to know is, if you are going to actually...
17
by: los | last post by:
Hi, I'm trying to create a program similar to that of Google's desktop that will crawl through the hard drive and index files. I have written the program and as of now I just put the thread to...
8
by: Rahul | last post by:
Hi. I am part of a group in my univ where we organize a programming contest. In this contest we have a UDP based server. The server simulates a game and each contestant is to develop a team of...
5
by: A P | last post by:
I am planning to migrate my exisiting MS Access program that uses yes/no fields (checkbox). Can ASP identifies checkbox field of ms access? I am planning to use the same database and use msacess...
11
by: christopher diggins | last post by:
I am wondering if any can point me to any open-source library with program objects for C++ like there is in Java? I would like to be able to write things like MyProgram1 >> MyProgram2 >>...
0
by: Nithya Sampathkumar | last post by:
Hi, We are planning what features /improvements need to go in the next release for XSLT. We are making these decisions based on customer input and feedback. So I would like to hear your views on...
1
by: Ruth | last post by:
Alison, You are going to find this a real coincidence! To begin with, I am Roberta Laird's husband. I think you know Roberta. We also are friends with Laura McConnell. Anyway, I am in business...
1
by: Hugh Janus | last post by:
Hi all, I have the following problem on a project I am working on. Right now, I am in the planning stage, which is where I want the help. I have to calculate a route between two different...
23
by: JoeC | last post by:
I am a self taught programmer and I have figured out most syntax but desigining my programs is a challenge. I realize that there are many ways to design a program but what are some good rules to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.