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 8 of 8

Thread: Anyone help me about JAVA ?

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

    Default Anyone help me about JAVA ?

    I have some JAVA assignment , and It's really hard with me , please anyone help me out about this ,Thanks

    File PDF :
    http://www.mediafire.com/?0grtieipgc9crro

    Note:
    Material Covered
     if statements
     loops
     using String charAt(), equals() and length() methods.

    Notes:

     Name your files as follows: <LastName><FirstName>A2Q1.java and <LastName><FirstName>A2Q2.java. For example, LiJaneA2Q1.java is a valid name. If you wish to add a version number to your file, you may add it to the end of the file name. For example, SmithRobA2Q2V2.java is a valid name.
     Follow the programming standards to avoid losing marks.
     To submit the assignment you will upload your .java files using the course website. You will also copy and paste your output into a text box in the online assignment submission form. Do NOT manipulate your output in any way.

    ----------------------------Question 1:Question 1—Esperanto

    Esperanto is a language invented in the 1880s by L. L. Zamenhof. It was invented to "create an easy-to-learn and politically neutral language that would serve as a universal second language to foster peace and international understanding."1

    One of the benefits of designing your own language is that you can impose strict rules on the language. In this question, you will use the rules of Esperanto to identify the parts of speech of different words. The rules for identifying parts of speech in Esperanto are2:

    If the word ends in .. it is a(n)...
    a adjective
    o or on singular noun
    oj or ojn plural noun
    e adverb

    This means there are no exceptions in Esperanto, like how in English the plural of goose is geese and while you usually add 'ly' to the end of an adjective to make it an adverb, 'goodly' isn't an adverb.

    Write a program that accepts words in Esperanto, and identifies whether each is an adjective, singular noun, plural noun or adverb.

    Input: Use Scanner to accept input in this question. Prompt the user to input a word. If the user types in "cesi" ("quit" in Esperanto), the program should quit. Otherwise, it should accept the input and process it as a word in Esperanto. After processing the word, the user should be prompted to enter another word. Assume the user inputs the words entirely in lowercase and that all words are at least three letters long.

    Calculate and Output: Use System.out. for all output. Use the charAt() and length() methods to find the last (one or possibly two) characters and determine which part of speech (adverb, singular noun, plural noun or adverb) the word is. If the word is in none of the four categories, print out an error message telling the user that the part of speech cannot be identified. An execution of your program would look like this:

    Enter a word in Esperanto: komputilo
    komputilo is a singular noun.
    Enter a word in Esperanto: sciencon
    sciencon is a singular noun.
    Enter a word in Esperanto: cesi
    Programmed by [your name here].
    End of processing.


    Hand-in: Save your file using the naming conventions described in the beginning of the assignment. Upload your file using the web-based hand-in tool. Also, submit the output for the following input:

    komputilo
    sciencon
    bonege
    Javo
    programi
    cesi


    Question 2—Binary Numbers
    As you may know, computers work on the binary system. In this system, numbers are written using only 0s and 1s. In this question, you’ll write a program to convert binary numbers to normal (decimal) numbers.
    How are all numbers represented in 0s and 1s?
     Instead of having digits 0,1,...,9, in binary, we only have digits 0 and 1.
     So zero is 0, and the next number is represented by 1, but after that, we have no digit 2, so we have to represent the next number in the same way we do after we go past 9 in the decimal system: by 10.
     We continue in this way: 3 in binary is 11.
     Now what about 4? We can’t write 4 as 12 (because we only have 1 and 0 to work with, not 2). So we put a zero in the last position, and carry the 1. This would give 20, but again, we don’t have a digit 2, so we again carry the 1 and get 100 as the binary representation of 4.
    Here are the first few numbers written in both decimal (normal) notation and binary:


    decimal
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11

    binary
    1
    10
    11
    100
    101
    110
    111
    1000
    1001
    1010
    1011

    Suppose we have a binary number (a sequence of zeroes and ones) and we
    want to convert it to a decimal number. To do this, we multiply the digit (0 or 1) in each position of the number by an increasing power of two
    the further we move left. So the value of the binary number 1011001 is

    1*26+0*25+1*24+1*23+0*22+0*21+1*20= 89

    Program Specifications:
     Write a program that takes input as an integer, interprets it as a binary number, and prints out its value of the decimal number.
     Get input using Scanner.
     Use integer division and remainder to extract digits from the input binary number.
     Assume the user only inputs numbers with digits 0 and 1.
     Use a loop so the user can continue to input binary numbers until they input -1 , then exit.
     Here is a sample run of the program:

    Enter a binary number:1001010
    1001010 in decimal is 74.
    Enter a binary number:1001111
    1001111 in decimal is 79.
    Enter a binary number:10000111
    10000111 in decimal is 135.
    Enter a binary number:-1
    Programmed by [your name here].
    End of processing.

    Output: Use System.out for output. Follow the format of the output shown above.

    Hand-in: Save your file using the naming conventions described in the beginning of the assignment. Upload your file using the web-based hand-in tool. Submit three sets of data using the following input:
    1. 1000011
    2. 1100100 1011
    3. A binary number of your choice3
    Then press -1 to quit the loop.
    Last edited by helloworld922; October 15th, 2010 at 12:52 PM.


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Anyone help me about JAVA ?

    That's not how this works. Read this: How To Ask Questions The Smart Way

  3. #3
    Junior Member
    Join Date
    Oct 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Anyone help me about JAVA ?

    I'm not programmer , I'm just a new comer study how to write a java program , but it's really hard and out of my knowledge , so please help me if possible .Many thanks you guy and I put my faith on you guy ,Thanks so much

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Anyone help me about JAVA ?

    Quote Originally Posted by batista11b5 View Post
    I'm not programmer , I'm just a new comer study how to write a java program , but it's really hard and out of my knowledge , so please help me if possible .Many thanks you guy and I put my faith on you guy ,Thanks so much
    You are not going to get help this way. Read the link I posted. Follow the directions in it. Post some runnable code that demonstrates where you're stuck. Ask a specific question.

  5. #5
    Member Darryl.Burke's Avatar
    Join Date
    Mar 2010
    Location
    Madgaon, Goa, India
    Posts
    494
    Thanks
    8
    Thanked 48 Times in 46 Posts

    Default Re: Anyone help me about JAVA ?

    Quote Originally Posted by batista11b5 View Post
    I'm not programmer
    That much is obvious.
    , I'm just a new comer study how to write a java program
    That's not so obvious. I don't see any evidence of studying or writing a Java program.
    , but it's really hard and out of my knowledge
    Dodged classes? Neglected study material?
    , so please help me if possible .
    Sure, but you have to show some effort first.
    Many thanks you guy
    You're welcome.
    and I put my faith on you guy
    Misplaced faith. Try putting some faith in your system of education.
    ,Thanks so much
    For nothing.

    db
    Last edited by Darryl.Burke; October 19th, 2010 at 12:00 AM.

  6. #6
    Member Darryl.Burke's Avatar
    Join Date
    Mar 2010
    Location
    Madgaon, Goa, India
    Posts
    494
    Thanks
    8
    Thanked 48 Times in 46 Posts

    Default Re: Anyone help me about JAVA ?

    Cross posted
    http://www.ddth.com/showthread.php?p=2325221

    Was also cross posted on java-forums.org, but the homework dump was deleted by a moderator.

    db

  7. #7
    Member Darryl.Burke's Avatar
    Join Date
    Mar 2010
    Location
    Madgaon, Goa, India
    Posts
    494
    Thanks
    8
    Thanked 48 Times in 46 Posts

    Default Re: Anyone help me about JAVA ?

    Now double posted here, with blue-whale font size.
    http://www.javaprogrammingforums.com...p-me-code.html

    db

  8. #8
    Member Darryl.Burke's Avatar
    Join Date
    Mar 2010
    Location
    Madgaon, Goa, India
    Posts
    494
    Thanks
    8
    Thanked 48 Times in 46 Posts

    Default Re: Anyone help me about JAVA ?

    Yet another cross post
    Please help me fix my code ? - Java Forums

    db