Hey can anyone help
I'm trying to print out the following using the code below:
The following bedrooms are occupied:
Room number 6 is occupied by evans, with payee private
Room number 7 is occupied by jones, with payee private
Room number 16 is occupied by smith, with payee uog hei
End of bedroom report
but ever time i compile it comes up all in one line. but if i use \n it gives me an error "Invalid escape character"
any ideas?
thanks
Code:public void bedroomReport() { String customerName = ""; String payeeName = ""; int roomNumber = 0; boolean occupied; int counter = 1; while (counter <= MAX_BEDROOMS) { if (bedrooms[counter].isOccupied()) { System.out.print("The following bedrooms are occupied:"); System.out.print("Room number " + bedrooms[counter].getRoomNumber() + " is occupied by " + bedrooms[counter].getCustomerName() + " , with payee " + bedrooms[counter].getPayeeName()); } counter++; }//end of while




Reply With Quote