Results 1 to 6 of 6
- 11-19-2008, 07:21 PM #1
Member
- Join Date
- Nov 2008
- Location
- London
- Posts
- 39
- Rep Power
- 0
I couldn’t figure out how to do this please help!
Java Code:import javax.swing.JOptionPane; public class PayCheckWeek7 { public static void main(String[] args) { String input = JOptionPane.showInputDialog("What's your name?"); String input1 = JOptionPane.showInputDialog("What's your hourly wage?"); double n = Double.parseDouble(input1); String input2 = JOptionPane.showInputDialog("how many hours you worked in the past week?"); double m = Double.parseDouble(input2); if (m > 40) { JOptionPane.showMessageDialog (null,"your wage this week is: " + ((n*m)*1.5)); } else { JOptionPane.showMessageDialog (null,"your wage this week is: " + (n*m)); } } }
I need to modify the above program. The functionality of the new program should be exactly the same. However, write a method called
calculatePay, which calculates the total amount of pay. Call this method
from within the main method, and display its return value.
-
Let's see a decent try by you towards a solution first. I've found that usually the more thought and effort posters put into creating and solving their questions, the better their chances are of a volunteer here taking the time and effort to consider it and give a helpful answer. Much luck.
- 11-19-2008, 07:52 PM #3
Member
- Join Date
- Nov 2008
- Location
- London
- Posts
- 39
- Rep Power
- 0
ok!
Thanks, but I think if you can’t help you should just watch , there is no need of what you have said <wrote> because you are in the wrong place i guess.
i am not a lazy person who needs some one to write codes for him i just needs some help and guide lines.
I have written this program from scratch and i am just finding it hard to do the 2nd part of the exercise which I have explained above...
-
Please lighten up. Know that we are all volunteers here and I would think that any suggestion that could help you get more help would be appreciated. It's up to you.
Regardless please answer this question: how will anyone here know what precisely you are confused with if we don't first see your attempt and how exactly it is not working?Last edited by Fubarable; 11-19-2008 at 08:16 PM.
- 11-19-2008, 08:11 PM #5
Well first things first. Do you know how to create a method? If so do that and label it calculatePay. Then calculate the answer using the values you were given and return it.
Also your logic is flawed. You have over time as being paid 150% for each hour worked regardless if its overtime. It needs to be ((totalHoursWorked - 40) * 1.5) + (40*regularWages))
- 11-19-2008, 08:21 PM #6
Member
- Join Date
- Nov 2008
- Location
- London
- Posts
- 39
- Rep Power
- 0
Similar Threads
-
Cannot figure out min and max, without using arrays. if possible.
By loddog2002 in forum New To JavaReplies: 2Last Post: 11-08-2008, 04:58 AM -
Please Help, can't figure out what I'm doing wrong.
By tamik0 in forum New To JavaReplies: 2Last Post: 07-11-2008, 09:41 AM -
How can I figure out all the IPs on my network devices
By coco in forum NetworkingReplies: 3Last Post: 12-25-2007, 04:10 AM -
Seems so simple yet I can't figure it out!
By adamhaviland in forum New To JavaReplies: 1Last Post: 11-03-2007, 06:26 PM -
I can't figure this out
By silvia in forum New To JavaReplies: 3Last Post: 07-20-2007, 04:38 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks