Results 1 to 4 of 4
  1. #1
    pinar is offline Member
    Join Date
    Oct 2010
    Rep Power

    Exclamation Help me pls It is my homework:(

    question1)(Finding the smallest n such that n2 > 12000) Use a while loop to find the smallest integer n such that n is greater than 12,000.

    2)Finding the largest n such that n3 < 12000) Use a while loop to find the largest integer n such that n is less than 12,000.

    3)(Computing future tuition) Suppose that the tuition for a university is $10,000 this year and increases 5% every year. Write a program that uses a loop to compute the tuition in ten years. Write another program that computes the total cost of four years' worth of tuition starting ten years from now.

    4)(Finding the two highest scores) Write a program that prompts the user to enter the number of students and each student's name and score, and finally displays the student with the highest score and the student with the second-highest score.

    I hope answers :(((

  2. #2
    RichW is offline Member
    Join Date
    Oct 2010
    Rep Power


    Since I asked a question only fair I answer one.

    I don't want to answer your homework for you, but if you know how to create a class and compile it, for the first three questions, I will explain a while loop.

    A while loop tests to see if a statement meets a condition, if it does meet the condition, run some code, if it doesn't, then skip the code...

    So lets say we had this:

    int a = 6;
    while(a < 10)
    a = a +1;

    The output on the screen would be:

    It would stop at 9, because 10 would be above 9. A while statement tests the condition, evaluates it, and if it meets the condition, it runs the code, since the code adds 1 to a, a keeps increasing until it gets to 10. I am not sure if this was clear, the ending value of a would be 10, it just would not print because of where the print statement was located. If the print statement and the a = a+1 lines were switched in order, it would print 7, 8, 9, 10 instead. Hope that helps.

    For question number 4, thats a lot harder than the rest. It will be helpful to look at api. (Java 2 Platform SE v1.4.2) may be helpful.

    Good luck.
    Last edited by RichW; 10-19-2010 at 09:57 PM.

  3. #3
    SQUALL is offline Member
    Join Date
    Oct 2010
    Rep Power


    I will give you idea :)

    q1: make first input as (smallest) ... Declare variable smallest ..

    then make compare between it and next input ... if next input small than it

    make smallest equal the new input ...

    of course inside loop ...

    I hope that help you ...

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    Quote Originally Posted by pinar View Post
    I hope answers :(((
    I'm sorry, but this is nothing but a homework dump where you've posted an assignment word for word without demonstrating a lick of work. Please do yourself and us a favor by showing the work you've done and not posting homework in the forum without showing what you've tried and what specific questions you may have.

Similar Threads

  1. Homework help please
    By chick in forum New To Java
    Replies: 22
    Last Post: 03-19-2010, 07:39 AM
  2. Homework help
    By rclausing in forum New To Java
    Replies: 26
    Last Post: 11-24-2009, 06:06 AM
  3. Please Help with Homework
    By theuser in forum Advanced Java
    Replies: 2
    Last Post: 07-30-2009, 03:37 PM
  4. help with homework
    By pinkdiamondgail in forum Advanced Java
    Replies: 7
    Last Post: 04-07-2009, 01:34 AM
  5. Homework help...
    By robrobrob in forum New To Java
    Replies: 4
    Last Post: 10-17-2008, 04:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts