Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.JOptionPane;
- public class SalaryCalculator
- {
- public static void main ( String args [] )
- {
- int counter = 1;
- String name;
- double hours;
- double rate;
- double pay;
- int salary;
- while (counter <=3)
- {
- name = JOptionPane.showInputDialog( "Enter name");
- hours = Double.parseDouble(JOptionPane.showInputDialog( "Enter hours"));
- rate = Double.parseDouble(JOptionPane.showInputDialog( "Enter rate"));
- if ( hours>40 )
- pay = (40 * rate) + (hours - 40) *rate * 1.5;
- else
- pay = hours * rate;
- counter = counter +1;
- }
- //this needs a message type argument:
- //JOptionPane.showMessageDialog(Component parentComponent , String string, int messageType}
- JOptionPane.showMessageDialog(null, name);
- //this should give you a centered information dialog
- JOptionPane.showMessageDialog(null, name, JOptionPane.INFORMATION_MESSAGE);
- System.exit(0);
- }
- }
Add Comment
Please, Sign In to add comment