DodgeIntrepid.Net Forums banner

1 - 8 of 8 Posts

·
MU Alum in da House
Joined
·
284 Posts
Discussion Starter #1
I know there are some programmers in here. I am starting my core classes and one of them is intro programming class with Java.

I am starting to get the hang of what does what, but I really would like some more help with just the basics. The book I have isn't too much help if you ask me and the professors are good but I just don't have a lot of time in class and their office hours are not feasible because of my other classes.

So, is there anyone here that can help me out with this or point me somewhere besides another forum to get advise and stuff like that?

Thanks a lot again.
 

·
MU Alum in da House
Joined
·
284 Posts
Discussion Starter #3
OK. As I said I am in an intro Java class and I am having trouble typing some code.

/**
* Write a description of class Month here.
*
* @author (your name)
* @version (a version number or a date)
*/
import java.util.Scanner;
public class Month
{
public static void main (String[] args)
{
String monthString = "JanFebMarAprMayJunJulAugSepOctNovDec";
Scanner myScanner = new Scanner (System.in);
System.out.print ("Enter a month: ");
int mon = myScanner.nextInt();
System.out.println ("The month is " + monthString.subset (start, end));
start = end - 1;
end = start * 3;

System.exit(0);
}
}


This is the code I am using. What I am doing is trying to get the month to display whenever you enter a number for the month in. Like entering 1 will give you an output of Jan and so on for the other months. I get an error message when I compile it on this line here:
System.out.println ("The month is " + monthString.subset (start, end)); and it says error on the variable start. Maybe something else in the code is wrong, I dunno. I do know that the start and end variables are wrong, I was trying to do this in the morning so I know I need to fix that but I need to get the above fixed first.
Maybe you can help me out like this. I just need to know how I can tell what I need to type out.
Thanks for helping.
 

·
MU Alum in da House
Joined
·
284 Posts
Discussion Starter #5
Thanks for the help. I was suppose to go to my professors office this morning but there was a 2 hour delay so there went that plan.

Good news though. I finally managed to get to to run with out errors. The bad part is that it will not display what I want it to. I am probably just thinking aout it all wrong. Tomorrow I will see if I can get some help. Thanks again.
 

·
MU Alum in da House
Joined
·
284 Posts
Discussion Starter #7
Thanks....I was trying to figure out exactly how to do this yesterday. I spent the better part of an hour before class and was getting there. I had the end correct but was having a lil trouble with the start.

You are now my new best friend. + Rep for you!!!!!!
 
1 - 8 of 8 Posts
Top