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: Help with problem.

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

    Default Help with problem.

    I have these two problems that were given to me, and I am having THE hardest time even figuring out where to start :[

    The first one is..
    Write a method, public static boolean Language(String word), to recognize workds from the following language:
    {a^n|n is a prime number}
    If the input work is from the language the method returns true and false, otherwise.

    The second is..

    Relative gravities of most planets in the solar system, the Sun, the Moon, are shown below. They let us find what a given weight on Earth would weigh on each body.

    Sun: 27.94 Moon: .17 Saturn: 1.15 Mercury .37 Mars .38 Uranus 1.17 Venus .88 Jupiter 2.64 Neptune 1.18

    Write a java program that lets a user find her weight on any of these. It should ask her to enter her weight and the name of the planet or body she wants. A loop and a nested switch structure in your program are required. The loop will be used to etst many cases (for different planets) and should be terminated be letter End.

    Help!


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 287 Times in 225 Posts
    Blog Entries
    4

    Default Re: Help with problem.

    Hello.

    I have moved this thread to - Object Oriented Programming

    Have you attempted to code this yet? You need to take this one step at a time.

    You must know about the basics of creating a class right?

    Within your class you need to create this Language method:

        public static boolean Language(String word){    	
        	//code here
        	return true;    	
        }

    See what you can do from here and let us know when you get stuck..
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers