Learning the basics... Some help plz!
I am currently attending IT class about Java Programming, and coming from the nooblet point of view... this is kinda crazy... i like this though... but i need some help to get this point through...
I am doing something wrong... i know... but I got no clue what it is... logically to me, it seems correct... and I would code it more or less the same way in php... but for some reason, it is not behaving accordingly in here with JAVA...
I am taking the employeeName declaration outside the loop and using it as the loop breaker... I am declaring it as String employeeName = ""; then comes the do-while loop and the while expression states that employeeName != "stop" so it continues to loop until employeeName equals stop.
It IS looping... HOWEVER, it is jumping one of the input.nextLine(); i got for the name input... at the very top of the do-while... I have tried many things and I am yet to see a change in this... i dont know what is going on with it either... I have read all the text, but i cannot find the same kind of application i am putting in here because I have a string variable check situation... nothing in the text uses that ... there was one case that they used the end-of-file command to break the loop... but the assignment is asking for stop INPUT to break the loop... so I am trying hard to find a way of making this happen... Still... i got no clue what is going on with it... here is my code up to this point:
package payrollpart1;
import java.util.Scanner;
publicclass Main{
publicstaticvoid main(String[] args){
Scanner input =new Scanner(System.in);
String employeeName ="";
do{
System.out.println("\n\nWhat is the name of the Employee?\n(Enter stop to quit)");
employeeName = input.nextLine();
System.out.println("\n\nWhat is the hourly rate of the employee?");
double Hrate = input.nextDouble();
System.out.println("\n\nHow many hours did this employee work?\n(State fractions of hours as decimals. an hour and a half like 1.5)");
double Hamount = input.nextDouble();
double salary = Hrate * Hamount;
System.out.printf("\n\n\n+-+\n"+
"|Payroll Report for: %s\n"+
"Hourly Rate: $%.2f\n"+
"|Total Hours this Week: %.2f\n"+
"|Gross Salary: $%.2f\n"+
"+-+\n\n"
,employeeName,Hrate,Hamount,salary);
}while(employeeName !="stop");
}
}
}
This is my code more or less... i ommited the comments, but i am sure some of you wont be needing them anyway... I hope someone can help me out with this thing... Thanks in advance!

