I have a program to write and keep getting syntax error but can't figure out what is the error, can somehelp me out here, any kind of help with it will be greatly appreciated. here is the program and what I have so far.
this is the program:
Write a program which, when run, works as follows:
Hi, whats your name ? Mr.Best
Welcome to our show, Mr Best
How old are you? 52
Hmmmm, you don’t look a day over 47
Tell me, Mr.Best , how many cars do you own? 0
Wow, come on now Mr Best, you are 52 and do not own a car! SMH!!
Note, if the user is less than 22 years then they should not be allowed to continue the game and should be forced to exit the game.
If the user owns a car or own multiple cars then the rest of the program will
work as follows:
Mr Best, what is the brand and model of your car? Nissan B14
Nissan B14 is a great choice for a car.
Mr. Best have a bless day. Good Bye!!
here is what I have so far.
Scanner read = new Scanner (System.in);
String user_name, model_of_car, cars, owner;
int age, fake_age;
System.out.println("Hi what is your name");
user_name = read.nextLine();
System.out.println("Welcome to our show");
System.out.println("How old are you");
age = read.nextInt();
fake_age = age -3;
System.out.println("Hmmm you dont't look a day over " + fake_age);
System.out.println("Tell me Mr Tan, how many cars do you own");
if(user_name<22) - am getting an error at this line, can't seem to figure what is the error
{
System.out.println("Print out the user exit the game");
}
else if (owner own multiple cars)- getting an error and can't figure out the error.
{
System.out.println("print the user should continue as follows");
}
I am onto the neste if. if, else if statement
as i said before anyhelp would be appreciated. thank u very much. and when I run the program this what I am getting:
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - bad operand types for binary operator '<'
first type: java.lang.String
second type: int
at fakename.Fakename.main(Fakename.java:33)
Java Result: 1
BUILD SUCCESSFUL (to