int Monthname = input.nextInt();
int Monthday = input.nextInt();
switch (Monthname) {
case 1: Monthname = "January";
Monthday = "31";
Monthday, Monthname are declared asint, at the beginning of your code. But then you do this:
Monthname = "January";
"January" is a String. You cannot put a String ("January") inside a variable declared asint.
Declare a different variable
int Monthname = input.nextInt();
int Monthday = input.nextInt();
String monthDescription = "";
String dayDescription = "";
switch (Monthname) {
case 1: monthDescription = "January";
dayDescription = "31";
javaAddict
Nearly a Senior Poster
3,329 posts since Dec 2007
Reputation Points: 1,014
Solved Threads: 448
Ok I made the changes but I still get incompatible types for
case 2 : MonthDescription = "February";
dayDescription = (Year % 4 == 0 && Year % 100 != 0) || (Year % 400 == 0) ? 28: 29;
You made the changes? What changes did you make? You need to post the changes.
VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711
This think:
dayDescription = (Year % 4 == 0 && Year % 100 != 0) || (Year % 400 == 0) ? <strong>28</strong>: <strong>29</strong>;
Returnsint. The bold ones 28, 29 at the above code are ints. so you need to store them in an int value or have the expression return then as String: "28", "29".
You need to be more careful with these errors and learn how to fix them yourself. You should be able to fix these yourself and not go running for help with every single glitch.
javaAddict
Nearly a Senior Poster
3,329 posts since Dec 2007
Reputation Points: 1,014
Solved Threads: 448
hi
i am working on my final year project i am facing same kind of problem any suggestion for me
My suggestion is search relevant threads or start your own.
javaAddict
Nearly a Senior Poster
3,329 posts since Dec 2007
Reputation Points: 1,014
Solved Threads: 448