Ok made the changes, made an 'int count = 10;' for loop changed to 'for (int i=0; i<count; i++)' tried 11, but it caused an error after pay number is entered the test you showed came with...
Type: Posts; User: madjavapuppy
Ok made the changes, made an 'int count = 10;' for loop changed to 'for (int i=0; i<count; i++)' tried 11, but it caused an error after pay number is entered the test you showed came with...
Im not sure if its working now actually, what i put in says its an invalid pay number, but lets me put the rest of the details in and says it a success, then asks if I want to put another one in,...
wow thank you so much that seems to have worked i replaced it with:
public static int findPayNum(int payNumber)
{
if (numStaff == 0)
{
System.out.println("\n\tError: No staff...
That's true, so how would i use the for loop in this situation?
looking at it guessed it would start with 'for (int i=payNumber; i<count-1; i++);' is that right?
i don't how im going to use a for loop in this, is there no way to make it work with a do{} while?
Sorry obviously i don't understand the questions, 'findPayNumber' is used to keep track of the number of pay numbers and to find a pay number added in the method initaliseArrays:
public...
public static int findPayNum(int payNumber)
{
if (numStaff == 0)
{
System.out.println("\n\tError: No staff members!");
return -1;
}
boolean found = false;
int count = 0;...
Well the value of count is equal to the number of pay numbers 'payNumber' and is changed when the user adds or removes a staff member, so no it shouldn't be 10 it should be 7 at first.
so would i do something like an if statement like
if(count == 10)
count -1;
would that stop it?
Oh... well i tried it that way and it came up as
Exception in thread "main" payNum.length=10, count=0
payNum.length=10, count=1
payNum.length=10, count=2
payNum.length=10, count=3...
Ok this is what I got after doing it i used 'System.out.println(payNum.length + count);' which i hope was right.
10
11
12
13
14
15
Many thanks for telling me how to format, I think I understand what your saying 'MAX_STAFF' is set to 10 and the 3 errors I have which are at
Exception in thread "main"...
Hi im fairly new to Java and im trying out this program that would be used for managing staff members.
However I have problems with options after you enter number while no errors come up it...