954,545 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Writing a program in java.Help!!!

Can anyone help me write a program in java that:

Has a user enter their name
then enter their last 4 weeks hours worked

Then have it display the:
-total hours worked
-average hours per week
-full time equivalent:
2 weeks
3 days
7 hours

This would help me out a bunch. I hope someone can help me with this. I will appreciate any positive feedback!

nandomendoza
Newbie Poster
16 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

This is the code i have so far. Any suggestions
public class Program1
{
public static void main(String[] args)
{
//This asks user to enter their name.


String name;
System.out.println("Please enter your name: ");
name = SavitchIn.readLine();

//This asks the user to input the hours worked in integers.

int hours1;
int hours2;
int hours3;
int hours4;

System.out.println("Please enter the last 4 week's hours worked (integers): ");
hours1 = SavitchIn.readInt();
hours2 = SavitchIn.readInt();
hours3 = SavitchIn.readInt();
hours4 = SavitchIn.readInt();

int sum = hours1 + hours2 + hours3 + hours4;

System.out.println(name);
System.out.println("Total hours worked " + sum);

}
}

nandomendoza
Newbie Poster
16 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

Yes, Next time you post wrap your code inside
[code=java] and [/code] tags. Also what do you need help for ? Tell us the problem (compile errors,logic problems etc etc) you are facing and this time please do not give the reason "I am a beginner" for not attempting something.:)

stephen84s
Nearly a Posting Virtuoso
1,443 posts since Jul 2007
Reputation Points: 668
Solved Threads: 154
 

This is the code i have for the beginning of this program. I now need to take the hours that have been worked and have them result in an average of hours worked. I know mathematically how to figure it our but how do I place it in code?

nandomendoza
Newbie Poster
16 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 
how do I place it in code?

Thats what I meant by try it. Trust yourself a little and take the jump. At most you will get a compile error or a wrong output, the world will not end with that.
The help offered here is more like if your car has a problem we will help you sort it out, but we will not push / drive the car for you.

stephen84s
Nearly a Posting Virtuoso
1,443 posts since Jul 2007
Reputation Points: 668
Solved Threads: 154
 

How do I tab section. by that i mean when they show up in the program?

nandomendoza
Newbie Poster
16 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You