public class Program1
public static void main(String args)
//This asks user to enter their name.
System.out.println("Please enter your name: ");
name = SavitchIn.readLine();
//This asks the user to input the hours worked in integers.
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("Total hours worked " + sum);
Yes, Next time you post wrap your code inside
[/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.:)
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?
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.