473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Help with a while loop

Hi

i know a while loop isn't much of a problem but when i run the program it just dosn't work can any one help me please :D

Here is the code:

Expand|Select|Wrap|Line Numbers
  1. System.out.println("Please enter the room type as below: ");
  2. System.out.print("| bed | study | conference | :");
  3. roomType = inVar();
  4.  
  5. while (!roomType.equals("bed") || !roomType.equals("study")
  6.         || !roomType.equals("conference")
  7.         || !roomType.equals("Bed") || !roomType.equals("Study")
  8.         || !roomType.equals("Conference")) {
  9.  
  10. System.out.println("Please enter the room type as below: ");
  11. System.out.print("| bed | study | conference | :");
  12. roomType = inVar();
  13. }
The code just runs through the loop all he time.
Jun 7 '07 #1
6 1093
JosAH
11,448 Expert 8TB
Hi

i know a while loop isn't much of a problem but when i run the program it just dosn't work can any one help me please :D

Here is the code:

Expand|Select|Wrap|Line Numbers
  1. System.out.println("Please enter the room type as below: ");
  2. System.out.print("| bed | study | conference | :");
  3. roomType = inVar();
  4.  
  5. while (!roomType.equals("bed") || !roomType.equals("study")
  6.         || !roomType.equals("conference")
  7.         || !roomType.equals("Bed") || !roomType.equals("Study")
  8.         || !roomType.equals("Conference")) {
  9.  
  10. System.out.println("Please enter the room type as below: ");
  11. System.out.print("| bed | study | conference | :");
  12. roomType = inVar();
  13. }
The code just runs through the loop all he time.
Whatever you type, at least one of the parts of that or '||' expression will be true.
Better make that a logical and '&&' operation.

kind regards,

Jos
Jun 7 '07 #2
the speed that you answered is crazy and it worked thanks man :D
Jun 7 '07 #3
r035198x
13,262 8TB
the speed that you answered is crazy and it worked thanks man :D
Oh he can get crazier than that ...
Jun 7 '07 #4
JosAH
11,448 Expert 8TB
Oh he can get crazier than that ...
I command you to step outside Sir and pick your weapons! I picked my pink
inflatable axe that goes *beep!*

kind regards,

Jos ;-)
Jun 7 '07 #5
r035198x
13,262 8TB
I command you to step outside Sir and pick your weapons! I picked my pink
inflatable axe that goes *beep!*

kind regards,

Jos ;-)
Lo, behold! A duel?

I will be with you shortly,
and then you wont be with me.
Jun 7 '07 #6
JosAH
11,448 Expert 8TB
Lo, behold! A duel?

I will be with you shortly,
and then you wont be with me.
Lo and behold indeed Sir; I'd suggest you pick a fish and then we'll do a
Fish Slapping Dance.

kind regards,

Jos
Jun 7 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: William Buchanan | last post by:
Hi I have the following stored proc in interbase (which might contain errors - i'm doing it off the top of my head), which I would like to convert into oracle. Can you help? What I want back is...
1
by: nightsaber | last post by:
<script language="JavaScript"> <!-- hide me var the_number = prompt("how many words (3-5 is good)?", "4"); var the_string = ""; var a_word; for (loop = 0; loop < the_number; loop++) {...
23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
1
by: al2004 | last post by:
Write a program that reads information about youth soccer teams from a file, calculates the average score for each team and prints the averages in a neatly formatted table along with the team name....
1
by: trunxnirvana007 | last post by:
'UPGRADE_WARNING: Array has a new behavior. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"' 'UPGRADE_WARNING: Couldn't resolve...
9
by: TF | last post by:
Hello all, I made a ASP.NET 2.0 site that shows possible "recipes" for paint colors stored in an access dbase. Basically, 1000 colors are stored with specific RGB values in separate columns. A...
6
by: jenipriya | last post by:
Hi all... its very urgent.. please........i m a beginner in oracle.... Anyone please help me wit dese codes i hv tried... and correct the errors... The table structures i hav Employee (EmpID,...
0
by: shrik | last post by:
I have following error : Total giant files in replay configuration file are : File name : /new_file/prob1.rec Given file /new_file/prob1.rec is successfully verified. Splitting for giant file...
41
by: c | last post by:
Hi every one, Me and my Cousin were talking about C and C#, I love C and he loves C#..and were talking C is ...blah blah...C# is Blah Blah ...etc and then we decided to write a program that...
1
by: mshroom12 | last post by:
Hello to all. I am having difficulty trying to do this Java project using Eclipse. The following is what I have to do. Election Day It's almost election day and the election officials need a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.