Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Need some help on my HS Project

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need some help on my HS Project

    // import java.text.*;
    import java.util.*;
    public class charcount
    {
    	public static void main (String[] args)
    	{
    		Scanner keyboard = new Scanner(System.in);
    		String line = "";
    		String ch = "";
    		int numLetter, numVowel, numDigit, numBlank, numPunct, numOther, numLine, num;
    		boolean value = true;
     
    		System.out.println("Enter \" DONE \" when you are through.");
     
    		while (value = true)
    		{
    			System.out.print("Enter a Line of text or DONE: ");
    			line = keyboard.nextLine();
    			line = line.toUpperCase();
    			ch.equals(line.charAt(num));
     
    			if (line.equals("DONE"))
    				value = false;
    				break;
    			if ((ch >= 'A') && (ch <= 'Z'))
    				numLetter += 1;
    			if (ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'Y')
    				numVowel += 1;
     
    		}
    	}
    }
    public static void main(String[] args)
    {
    }

    I cannot get this program to run. It seems that I can not use the < or > sign with my variable char. I thought that ch was primitive and I could use those signs but I am very new to this language and I am sure I am doing something wrong. I am trying to get the first letter of a string and find out if it is a letter and a vowel. No rush not due until Friday plus I will ask my instructor tomorrow if no one responds.
    Thank You.


  2. #2
    Member
    Join Date
    Aug 2011
    Posts
    55
    Thanks
    5
    Thanked 3 Times in 3 Posts

    Default Re: Need some help on my HS Project

    The method charAt(); returns a char. You are trying to store it in a String variable. So your String ch is not of a compatible type with your charAt() method. You can use those two symbols one you fix your variable type that should right itself. Also get rid of your second main method.

Similar Threads

  1. need help in my project
    By flana in forum The Cafe
    Replies: 4
    Last Post: October 11th, 2011, 07:13 AM
  2. project
    By rafishaik999 in forum The Cafe
    Replies: 4
    Last Post: December 22nd, 2010, 12:45 PM
  3. Uni project - help please :)
    By sameer in forum Java Theory & Questions
    Replies: 0
    Last Post: November 6th, 2010, 11:54 AM
  4. Project
    By Mac in forum What's Wrong With My Code?
    Replies: 15
    Last Post: June 4th, 2010, 05:39 AM
  5. Need a project
    By helloworld922 in forum Project Collaboration
    Replies: 6
    Last Post: July 31st, 2009, 09:30 AM

Tags for this Thread