• Post Reply Bookmark Topic Watch Topic
  • New Topic

Illegal start of expression  RSS feed

 
joe Barker
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I am new to the site and want to say thank you for any and all help!
I am trying to get this program to run but I cannot get it to work well when I move the methods out I have the problem of the main method getting screwy and with the methods in main they all give illegal start of expression!

Here is error messages
----jGRASP exec: javac -g RentalRate.java

RentalRate.java:111: error: illegal start of expression
public static String getGender(String gender, Scanner kb)
^
RentalRate.java:111: error: illegal start of expression
public static String getGender(String gender, Scanner kb)
^
RentalRate.java:111: error: ';' expected
public static String getGender(String gender, Scanner kb)
^
RentalRate.java:111: error: ')' expected
public static String getGender(String gender, Scanner kb)
^
RentalRate.java:111: error: illegal start of expression
public static String getGender(String gender, Scanner kb)
^
RentalRate.java:111: error: ';' expected
public static String getGender(String gender, Scanner kb)
^
RentalRate.java:111: error: not a statement
public static String getGender(String gender, Scanner kb)
^
RentalRate.java:111: error: ';' expected
public static String getGender(String gender, Scanner kb)
^
RentalRate.java:127: error: illegal start of expression
public static int calcAge( curMonth, curDay, curYear, birthMonth, birthDay, birthYear)
^
RentalRate.java:127: error: illegal start of expression
public static int calcAge( curMonth, curDay, curYear, birthMonth, birthDay, birthYear)
^
RentalRate.java:127: error: ';' expected
public static int calcAge( curMonth, curDay, curYear, birthMonth, birthDay, birthYear)
^
RentalRate.java:127: error: ';' expected
public static int calcAge( curMonth, curDay, curYear, birthMonth, birthDay, birthYear)
^
RentalRate.java:149: error: illegal start of expression
public static String calcRateClass(age, gender)
^
RentalRate.java:149: error: illegal start of expression
public static String calcRateClass(age, gender)
^
RentalRate.java:149: error: ';' expected
public static String calcRateClass(age, gender)
^
RentalRate.java:149: error: ';' expected
public static String calcRateClass(age, gender)
^
RentalRate.java:190: error: illegal start of expression
public static String displayResults(gender, age, rateResult)
^
RentalRate.java:190: error: illegal start of expression
public static String displayResults(gender, age, rateResult)
^
RentalRate.java:190: error: ';' expected
public static String displayResults(gender, age, rateResult)
^
RentalRate.java:190: error: ';' expected
public static String displayResults(gender, age, rateResult)
^
20 errors

----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.

here is link to my code
http://pastebin.com/trs0pz7k

and here is the code that the teacher gave us to start with
http://pastebin.com/P9CxGVxY
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are starting a new method in the middle of another method. That's a no-no.
 
Raghavendra Shockley
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:You are starting a new method in the middle of another method. That's a no-no.


He posted it "Today 8:13:15 PM" and you answered at " Today 8:20:17 PM" !!!
Wow ! I did not even read that code, let alone guess the reason for the error. How were you able to tell so quickly ???
 
Stephan van Hulst
Saloon Keeper
Posts: 7992
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because Bear probably looked at the code.
 
joe Barker
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://pastebin.com/kt1de6Dx
also i would love to just chat this out via skype or some other chat program thanks!
Now my gender wont read correctly it just disappears and makes my program have no output T-T. here is format of real output as well as link to code at top.

Welcome to the car renter's rate finder.
Please enter the renter’s gender (m/f): m
Please enter today's date (mm dd yyyy): 10 4 2011
Please enter the renter’s date of birth (mm dd yyyy): 1 22 1990
Thank you.
The male renter is 21 years old.
The rate class is: Sorry, the renter is not 25 years of age or
older.
Welcome to the car renter's rate finder.
Please enter the renter’s gender (m/f): f
Please enter today's data (mm dd yyyy): 10 4 2011
Please enter the renter’s date of birth (mm dd yyyy): 11 1 1980
Thank you.
The female renter is 30 years old.
The rate class is: Best rate - $40.00 per day or $200.00 per
week.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
joe Barker wrote:http://pastebin.com/kt1de6Dx

Just as a heads up. A lot of people won't follow links posted in forums (especially if they are by people new to the forum) - you will probably get more people looking at your problem if you copy the code into the post using code tags.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
joe Barker wrote:
also i would love to just chat this out via skype or some other chat program thanks!


That goes against the core purpose of a pulic forum like this one. That's why we ask you to UseTheForumNotEmail.(⇐click)
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
joe Barker wrote:. . . T-T. . . .
Please avoid such abbreviations. They are specially difficult for people who didn’t learn English as children.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:
joe Barker wrote:. . . T-T. . . .
Please avoid such abbreviations. They are specially difficult for people who didn’t learn English as children.


Also for us old people, even those of us who are native English speakers.
 
Stephan van Hulst
Saloon Keeper
Posts: 7992
143
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's actually a variation of the Asian crying emoticon.

: ^_^
: T_T
: o_0

etc.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!