Results 1 to 9 of 9
Thread: hi can anyone help me with this?
- 06-19-2010, 04:29 AM #1
Member
- Join Date
- Jun 2010
- Posts
- 3
- Rep Power
- 0
-
Hello, and welcome to the forum.
So in essence what you've done is to give us your entire assignment without asking a question, and I'm afraid that in this situation there's not much that we can do for you other than to direct you to a tutorial or two.
I suggest that you post your best solution that you've created so far, and ask as specific questions as possible, and we'll be much better able to help. If you really have no idea how to begin here, then please have a look here: Starting Writing a Program. It's a well-written article that can help.
Much luck
- 06-19-2010, 04:33 AM #3
Member
- Join Date
- Jun 2010
- Posts
- 3
- Rep Power
- 0
thanks for replying. im really a newbie in making programs in java. here's what i made.
could you help me with this? :)Java Code:import java.io.*; import javax.swing.*; import java.util.*; class mp1test { public static void main(String args[])throws IOException { final String consonants = "bcdfghjklmnpqrstvwxz" + "BCDFGHJKLMNPQRSTVWXZ"; BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); num=Integer.parseInt(br.readLine()); char ch; char answer; String Vowels; String Consonants; System.out.println("Enter Full name of student"); System.in.read();System.in.read(); System.out.println("There are "+vowels +consonants); for (int i = 0; i < total; i++) { char ch = inputString.charAt(i); if ((ch == 'a') || (ch == 'A') || (ch == 'e') || (ch == 'E') || (ch == 'i') || (ch == 'I') || (ch == 'o') || (ch == 'O') || (ch == 'u') || (ch == 'U')) { numVowels++; { elseif(Character.isLetter(ch)); numCons++; } } } }
Moderator Edit: Code tags addedLast edited by Fubarable; 06-19-2010 at 05:00 AM. Reason: Moderator Edit: Code tags added
- 06-19-2010, 04:35 AM #4
Senior Member
- Join Date
- May 2010
- Posts
- 436
- Rep Power
- 4
As Fubarable posted, you first need to ask a question. This means that you need to tell us how your current code doesn't work or what specific aspect do you not understand?
- 06-19-2010, 04:40 AM #5
Member
- Join Date
- Jun 2010
- Posts
- 3
- Rep Power
- 0
mp1test.java:31: reached end of file while parsing
}→
^
1 error
-
Note, I added code tags in your post above to help make your code readable. To see how to do this yourself, please look at my signature.
Much luck!
- 06-19-2010, 05:04 AM #7
Senior Member
- Join Date
- May 2010
- Posts
- 436
- Rep Power
- 4
I'm not even able to compile your code due to many errors: num not declared, vowels not declared, total and inputString not declared. Is this the actual program that you have run and that generated the error you mention above? I'm sorry, but it just can't be. For better help, please post the compilable version of your program.
- 06-19-2010, 05:21 AM #8
Senior Member
- Join Date
- May 2010
- Posts
- 436
- Rep Power
- 4
Also (1): what is the purpose for this line?:
Again, num is never declared and also, it's never used, so why even have it in your code?Java Code:num=Integer.parseInt(br.readLine());
Also (2): If you're going to create a BufferedReader object, br, to get user input from the keyboard, you might as well use this to get the user input. So get rid of these statements:
as they serve no useful purpose here and instead use your br variable.Java Code:System.in.read();System.in.read();
Hm,... as I'm looking through your program, it appears almost as if you tried to cobble together a program using bits and pieces of code from other programs without knowing what the code does. This won't work ever. You'll need to go over your lesson notes, text and tutorials to understand what each bit of code does before you try to use it.
Suerte
- 08-20-2010, 11:15 AM #9
Member
- Join Date
- Jul 2010
- Posts
- 32
- Rep Power
- 0


LinkBack URL
About LinkBacks


Bookmarks