Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 24th, 2012, 11:35 PM
Shadoze Shadoze is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2012
Posts: 1 Shadoze User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 4 sec
Reputation Power: 0
Unhappy JOptionPane to show dialogue and output from an equation

I am completely new to using Java and programming in general, this is for an Intro to Java class. What I am trying to do is make it so the dialog boxes that appear and show the fedwith, statewith, totaldeductions, and net pay, to say, "Net Pay is:" and then have the Netpay in the dialog box as well. Can anyone help? Thanks!!





import javax.swing.JOptionPane;
public class assignment2 {
public static void main(String[] args){
String strName, strHours, strPayrate, strFedtax, strStatetax;
int hours;
double payrate;
double fedtax;
double statetax;
double fedwith;
double statewith;
double totaldeductions;
double grosspay;
double netpay;
strName = JOptionPane.showInputDialog("Enter employee's name");
strHours = JOptionPane.showInputDialog("Enter number of hours worked in a week");
strPayrate = JOptionPane.showInputDialog("Enter hourly pay rate");
strFedtax = JOptionPane.showInputDialog("Enter federal tax withholding rate");
strStatetax = JOptionPane.showInputDialog("Enter state tax withholding rate");
payrate = Double.parseDouble(strPayrate);
hours= Integer.parseInt(strHours);
grosspay= (payrate*hours);
fedtax= Double.parseDouble(strFedtax);
statetax= Double.parseDouble(strStatetax);
fedwith = grosspay*fedtax;
statewith=grosspay*statetax;
totaldeductions= fedwith + statewith;
netpay=grosspay-totaldeductions;
JOptionPane.showMessageDialog(null,fedwith);
JOptionPane.showMessageDialog(null,statewith);
JOptionPane.showMessageDialog(null,totaldeductions );
JOptionPane.showMessageDialog(null,netpay);

}
}

Reply With Quote
  #2  
Old July 31st, 2012, 12:00 PM
lukwes1 lukwes1 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 3 lukwes1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 11 m 50 sec
Reputation Power: 0
Re

JOptionPane.showMessageDialog(null,"Net Pay is: "+netpay);

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > JOptionPane to show dialogue and output from an equation


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap