Forums Register Login

Newbie attempt at Method That Returns Non-Numeric Values switch statement

+Pie Number of slices to send: Send
Hello Again. To reiterate, I am a newbie attempting to learn Java through iTunes Stanford CS106a and Eric Roberts' "Art and Science of Java." I am not a student nor am I enrolled in any class. I am trying to write out a program that takes numerical input from the user and converts it to a date using the English month name. I am experimenting with the method of a "switch" statement without using the "break" clause. However, I seem to be missing something, as Eclipse is telling me I have a syntax error with my block. My curly braces seem properly placed. So, any feedback would be appreciated. Also, I made sure to follow guidelines to make my code fit on the screen and remain easy to read. Thank you for helping me.


1
+Pie Number of slices to send: Send
 

Jb Anderson wrote:My curly braces seem properly placed...


They do? They don't to me; and neither does your indenting.

For one thing, your methods don't line up; for seconds: that last println() statement isn't inside any method.

PS: I corrected your code tag placement. Click on the 'Edit' button to see what I did - but don't forget to back out before you do anything else; otherwise you might overwrite your post.

Winston
+Pie Number of slices to send: Send
Hello again, Winston. Thank you again for taking the time to read my post and to provide feedback.

I don't understand what I'm doing wrong when I POST my code to this site--as you could see and as you mentioned-- all my indentation went away and makes me look like a fool! I "copy" the code directly from Eclipse, I click "code" in the JavaRanch window, I "paste" my code in the window, and poof, all my indentation is gone. Thanks for cleaning up the code appearance. Please let me know what I need to do to prevent this from happening in the future.
1
+Pie Number of slices to send: Send
 

Jb Anderson wrote:Please let me know what I need to do to prevent this from happening in the future.



After you post the code, select it with the mouse or keyboard and then press the "Code" button which you'll see in that long row of buttons above the box you pasted into.
+Pie Number of slices to send: Send
Paul,
Ahhhhhhh!! Brilliant. Now I understand I was only clicking the "code" button prior to pasting. Thanks very much for the tutorial! I appreciate your assistance.
It sure was nice of your sister to lend us her car. Let's show our appreciation by sharing this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 547 times.
Similar Threads
Cannot Convert String to Int. Clock question.
Need help putting comments in
Finding number of days in a month confusion
Changing the date format
object class help
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 15:52:02.