java - How do I fix my code? -


hello working on project , trying figure out wrong code print correctly. write java program prompt user day , month (both integers) of or birthday, , prints appropriate astrological sign.

public class birthday {     public static void main(string args [] ) {         string birthday = system.console().readline("enter birthday, month day.");         float value = float.parsefloat(birthday);         if (month < 1 || month > 12) {             system.out.println("invalid month please try again.");         }          else if (day < 1 || day > 31) {             system.out.println("invalid day please try again.");         }          else if (month = 1 || month = 12) {          }          else if (day >= 22 || day <= 19); {             system.out.println(birthday + "capricorn");         }     } } 

these errors get:

birthday.java:3: readline(boolean) in java.io.console cannot applied (java.lang.string)     float birthday = system.console().readline("enter birthday, month day.");                                      ^ horoscopes.java:4: cannot find symbol symbol  : variable month location: class birthday         if (month < 1 || month > 12) {               ^ horoscopes.java:4: cannot find symbol symbol  : variable month location: class birthday         if (month < 1 || month > 12) {                            ^ horoscopes.java:8: cannot find symbol symbol  : variable day location: class birthday     else if (day < 1 || day > 31) {              ^ horoscopes.java:8: cannot find symbol symbol  : variable day location: class birthday     else if (day < 1 || day > 31) {                         ^ horoscopes.java:12: cannot find symbol symbol  : variable month location: class birthday     else if (month = 1 || month = 12) {              ^ horoscopes.java:12: cannot find symbol symbol  : variable month location: class birthday     else if (month = 1 || month = 12) {                           ^ horoscopes.java:16: cannot find symbol symbol  : variable day location: class birthday     else if (day >= 22 || day <= 19); {              ^ horoscopes.java:16: cannot find symbol symbol  : variable day location: class birthday     else if (day >= 22 || day <= 19); {                           ^ 9 errors 

from first glance, did not define month day.

also, doing float.parsefloat(birthday) give float looks this:

if input 20150713 get

float value = 20150713.00

this doesn't separate them months , days.

what recommend is, instead of turning string birthday float, convert in date structure.

once have date structure, let's date or localdate, can compare month , day.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -