Hiển thị kết quả từ 1 đến 5 / 5
  1. #1
    Tham gia
    22-02-2010
    Bài viết
    3
    Like
    0
    Thanked 0 Times in 0 Posts

    Ai thích thử thách (về JAVA) cộng thêm 1 ít vốn tiếng anh thì vào đây nhé

    mình có 1 số bài muốn nhờ anh em giúp , ai có khẳ năng + trình độ thì cho mình bik đáp án nhé

    File PDF :
    Code:
    http://www.mediafire.com/?0grtieipgc9crro
    Gợi ý :

    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 binary
    1 1
    2 10
    3 11
    4 100
    5 101
    6 110
    7 111
    8 1000
    9 1001
    10 1010
    11 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.
    Quote Quote

  2. #2
    Tham gia
    16-10-2010
    Bài viết
    2
    Like
    0
    Thanked 0 Times in 0 Posts
    Homework dump cross posted at
    http://www.javaprogrammingforums.com...bout-java.html

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

    db

  3. #3
    Tham gia
    05-03-2009
    Bài viết
    390
    Like
    1
    Thanked 6 Times in 6 Posts
    Quote Được gửi bởi darylbu View Post
    Homework dump cross posted at
    http://www.javaprogrammingforums.com...bout-java.html

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

    db
    Bùn cười!
    Chủ thớt đang học ở NIIT hay Aptech đấy?

  4. #4
    Tham gia
    22-02-2010
    Bài viết
    3
    Like
    0
    Thanked 0 Times in 0 Posts
    Quote Được gửi bởi darylbu View Post
    Homework dump cross posted at
    http://www.javaprogrammingforums.com...bout-java.html

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

    db
    llll , you just waste your time to look for something like that on google dude ) , but it's fine ,bc that's your right )

  5. #5
    Tham gia
    16-10-2010
    Bài viết
    2
    Like
    0
    Thanked 0 Times in 0 Posts

    Cross posted again

    Even bigger font than the cross poster used here
    http://www.javaprogrammingforums.com...p-me-code.html

    db

    [=========> Bổ sung bài viết <=========]

    Yet another cross post
    http://www.java-forums.org/new-java/...x-my-code.html

    db
    Được sửa bởi darylbu lúc 12:15 ngày 19-10-2010 Reason: Bổ sung bài viết

Bookmarks

Quy định

  • Bạn không thể tạo chủ đề mới
  • Bạn không thể trả lời bài viết
  • Bạn không thể gửi file đính kèm
  • Bạn không thể sửa bài viết của mình
  •