Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Software Development Software Development
Search Search
Search for:
Tech Support Guy > > >

Solved: "illegal start of expression" -- I've checked -- what am I missing?


(!)

Baronwyn's Avatar
Baronwyn Baronwyn is offline
Computer Specs
Member with 9 posts.
THREAD STARTER
 
Join Date: Jul 2012
Experience: Beginner
06-Jul-2012, 07:07 PM #1
Question Solved: "illegal start of expression" -- I've checked -- what am I missing?
System is PC Win 7 SP1 64-bit for what that's worth in this situation. I'm a rank beginner in Java, pretty new to programming in general. The following code (within a larger program) generates 4 "illegal start of expression" errors (lines marked).

I've matched my brackets for the entire program, there are no methods within methods. Notice that all four errors are on "if" statements with logical operators && and ||. The code lines with a simple > don't throw errors. Am I using the operators wrong?

Thank you!

if (gender == "f")
{
if (age >= 25 && <= 29) //error 1
System.out.println("The female renter is " + age + " years old. The rate class is: Rate 1 - $50.00 per day or $255.00 " +
"per week.");
else
if (age >=30 && <= 62) //error 2
System.out.println("The female renter is " + age + " years old. The rate class is: Best rate - 40.00 per day or " +
"$200.00 " + "per week.");
else
if (age > 62)
System.out.println("The female renter is " + age + " years old. The rate class is: Rate 3 - " + (40 + ((age-62) * 2)) +
" per day or " + (200 + ((age-62) * 5)) + " per week.");
else
System.out.println("Sorry, the renter is not 25 years of age or older.");
}
else
{
if (age >= 25 && <= 32) //error 3
System.out.println("The male renter is " + age + " years old. The rate class is: Rate 2 - $57.00 per day or $285.00 " +
"per week.");
else
if (age >= 33 || <= 65) //error 4
System.out.println("The male renter is " + age + " years old. The rate class is: Best rate - 40.00 per day or " +
"$200.00 per week.");
else
if (age > 65)
System.out.println("The male renter is " + age + " years old. The rate class is: Rate 3 - " + (40 + ((age-65) * 2)) +
" per day or " + (200 + ((age-65) * 5)) + " per week.");
else
System.out.println("Sorry, the renter is not 25 years of age or older.");
}
Baronwyn's Avatar
Baronwyn Baronwyn is offline
Computer Specs
Member with 9 posts.
THREAD STARTER
 
Join Date: Jul 2012
Experience: Beginner
06-Jul-2012, 08:36 PM #2
I figured out the problem. A noob syntax error. I cleared those all up and eagerly hit Compile only to be hit with a lot more errors. This program needs more work before a single Q&A will fix it. Thanks anyway and good luck to everyone.
ssye894's Avatar
ssye894 ssye894 is offline
Member with 7 posts.
 
Join Date: Jul 2012
07-Jul-2012, 12:28 AM #3
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


Tags
illegal start expression, java, logical operators

(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑

Content Relevant URLs by vBSEO 3.3.2