How to create a program that accepts 5 digits from the user between 0 and 9

how to create a program that accepts 5 digits from the user between 0 and 9 then put them in ascending order using link-list method..

You can use a scanner to get user input from the command line.
import java.util.*;
public class Test {
    private List<Integer> list;
    private Scanner in;
    public static void main (String... args) {
        new Test ();
    public Test () {
        list = new LinkedList<Integer> ();
        in = new Scanner (System.in);
        for (int i = 0; i < 5; i ++) {
            System.out.format ("Please enter a number (%d more): ", (5 - i));
            list.add (in.nextInt ());
        Collections.sort(list, new Comparator<Integer> () {
            public int compare (Integer i1, Integer i2) {
                return i2 - i1;
        System.out.println (list);
}

Similar Messages

  • How to create a report which accepts parameters from the URL

    Hi,
    I am trying to create a report that would only show the rows based on a criteria. My table has the following structure:
    ID number(10)
    Review_date date
    Review varchar2(1000)
    I want the report to display the following query:
    Select Review_date, review from t1 where id=:ID;
    I need the value of the parameter ID to be accepted through the URl. As in, the requirement wants that a url like www.abc.com:7777/abc?ID=1 should display a page where the report is run for id=1 and the results are displayed.
    I have created a report in Portals where id can be entered once the customize link is pressed and the criteria is added. But the requirements state that users should not have to do this, links will be provided to them based on certain criterias, they just need to click on them. Any help is highly appreciated.

    You could try the forum for Financial Reporting - Hyperion Query and Reporting
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • How to create a program that will accept a series of strings of 0 and 1 onl

    how to create a program that will accept a series of strings of 0 and 1 only then displays 0 as 48 and displays 1 as 49.

    Isn't one thread enough for your homework?
    http://forum.java.sun.com/thread.jspa?threadID=5253850&messageID=10051155#10051155

  • I gifted a ringtone to my sister that I purchased from the iTunes store, and it is on her phone, but we can't figure out how to get it moved to her ringtones.  Can anyone help?

    I gifted a ringtone to my sister that I purchased from the iTunes store, and it is on her phone, but we can't figure out how to get it moved to her ringtones.  Can anyone help?

    Edit > Preferences.  Select the check box for Ringtones, this will add them to the listing in iTunes. 
    Not sure that really answers your question though.

  • Hello there, I am creating a database of all our companies press contacts. I would like to create a form that would act as the front end and feed the database which is obviously the back end. The database is in Access 2013. My question is to whether this

    Hello there, I am creating a database of all our companies press contacts. I would like to create a form that would act as the front end and feed the database which is obviously the back end. The database is in Access 2013. My question is to whether this is indeed possible?

    This forum thread appears to point towards the problem.
    Re: Unable to Switch Audio Sync Settings

  • How to create a service entry sheet based from the PO

    how to create a service entry sheet based from the PO
    Gurus,
    I am creating a service entry sheet from the PO but I am getting an error of u201CPlease maintain services or limits Message no. SE029- Diagnosis(You cannot enter data until the PO item has been maintained correctly) u201C
    The document type of the PO is standard NB, account assignment category is Q- (Proj make to order) and the item category is D(service). Then I am trying also create a PR using account assignment category is Q- (Proj make to order) and the item category is D(service) but still cannot proceed, a message asking me to enter a service entry number. What I know the process is create a PO(maybe based from PR) then post the GR then create a service entry sheet in ML81N but I cannot proceed. Just creating a PR or PO using those mentioned account assignment and item category and getting an error of need to enter a service entry sheet number.
    Please help.thanks!

    HI,
    Process for Creating Service Entry Sheet
    Transaction Code :    ML81N
    1)To open the respective Purchase Order, Click on the u2018Other Purchase Orderu2019, then enter the Purchase Order No.
    2)Click on the u2018Create Entry Sheetu2019 icon(3rd Icon on Top-Left)
    3)Give Short Text (e.g. R/A Bill No. 1) and top service entry sheet number also generated.
    4)Click u2018Service Selectionu2019 Icon on the Bottom of the Screen.
    5)For the 1st Time, when we are making Service Entry Sheet for a respective Purchase Order, we need to u201CAdopt Full Quantityu201D by clicking the Check box next to it, then Enter.  (*For the next time, no adoption is required, just continue)
    6)Select the respective Services by clicking on the Left Hand Side, then Click u2018Servicesu2019 (Adopt services) icon on the Top.
    7)Give the completed Quantity, then Click u2018Acceptu2019 icon(a green flag on the top)
    8)Save .
    9)Service Entry Sheet is SAVED and account posting made.
    Hope, it is useful for you,
    Regards,
    K.Rajendran

  • How to close an app that was downloaded from the apps screen?

    How can I close an app that was downloaded from the apps store, and is still on my apps page?

    Force close apps
    1. Double tap the home button to bring up the multi-tasking view
    2. Swipe the app's windows upwards to close
    3. The app will fly off the screen
    http://support.apple.com/kb/ht5137

  • I just bought macbook pro with 10.8.3 os. When i start the system, all applications automatically start up as well! How can I turn them off. I checked the user settings and no application is set tom open automatically!

    I just bought macbook pro with 10.8.3 os. When i start the system, all applications automatically start up as well! How can I turn them off. I checked the user settings and no application is set tom open automatically!

    You have 14 days to return the computer w/no questions asked.  Plus you have 90 days of FREE phone tech support on top of your standard 1 year warranty unless you also purchased AppleCare which gives you an additional 2 years of coverage plus FREE phone support.
    Strongly suggest that you take FULL advantage of the above before it runs out.  Let Apple deal w/the problems.

  • HT4718 How do you uninstall programs that was downloaded on the internet

    Hello everyone,
    I have a MacBook Pro 13 13 inch 2012 mid and I learned how to use a Mac now but I just don't know if you can uninstall programs that was downloaded on the internet. If you do know how to uninstall programs please comment and let me know

    You may find these articles helpful.
    http://support.apple.com/kb/PH14299
    http://www.thexlab.com/faqs/uninstallingapps.html

  • HT4528 im trying to find out how u delete a song that u added from the itunes radio...from iphone???

    i am trying to find out how u delete a song that u added from itunes radio....from iphone????

    HI nhenson04,
    If you are looking to delete downloaded content on your iPhone, you may find the following article helpful:
    Apple Support: How to delete content you've downloaded from the iTunes Store, App Store, iBooks Store, or Mac App Store
    http://support.apple.com/kb/HT5772
    Regards,
    - Brenden

  • Accepting Imut from the user keyboard

    Is this the only way of accepting an input from the user via a keyboard or is there an easier way ?
    Thanks.
    import java.io.*;
    public class Greetings
    public static void main(String[] argv) throws IOException
    // Keyboard Input
    BufferedReader b = new BufferedReader(new InputStreamReader(System.in));
    // Declare Variables
         String UserName;
    // Accept User Name
         System.out.println("What is your Name?");
    UserName = b.readLine();
    }

    Personally I always use the gui counterpart JOptionPane.showInputDialog()

  • How to create a proxy that accept requestes get/post in the same time?

    Hi everybody,
    I have two questions with Service Bus 11gR1.
    I have to create a proxy in https that accept request get/post in the same time, also this proxy should be able to recognize the common name of the certificate.
    Is it possibile?
    Thanks a lot.
    Ettore

    The approach I mentioned is part of correctly configuring client cert authentication. For client cert authentication to succeed weblogic expects the user derived from the certificate by the user name mapper class to exist ( just exist , it wont check the password) in its security realm. The problem you have mentioned is common for any type of 'authentication' and not just specific to this approach.
    The user name mapper class can be configured to accept any attribute in the certificate DN as the mapped user. Since the thread starter is interested in CN, then he has to set CN as the mapping attribute.
    Edited by: atheek1 on Nov 10, 2010 1:33 AM

  • How to create a projector that accepts a file that is dragged on its icon?

    I would like to develop an application that allows it to receive as input any file that is dragged on the icon of the projector.
    In practice: I would like to know the (path of) file dragged on it, so that then the application can work on it.
    Do you know how to do?
    Thank You.

    Update:
    It is possible to do it with
         http://www.eee-craft.com/director/awaOSUtil/
    BUT Director can't produce a Projector that accepts the dragged file.
    Any ideas?
    Thanks!

  • How to create a map that is larger than the game in width and height?

    hi,
    i wounder how i can create a map(not the design) that is larger than the game in width and height, part of it will appear in the main page and anther part you can move to it after you press the arrow symbol, but the map is just one image so i want put it in line and out line the game page, and the out line part includes buttons and symbols the player can use, but it will be in line and the other part will be out line when you press the left arrow or the down arrow, how i can do that?
    and is that possible to animate it so when the player press the arrow, will give it action to start the animation in one sec, i know how to animate it if that possible but i don't know which code i will use for the mouse click with the arrow symbol, and how to use the same code in the same symbol to start anther animation depending on which part of the map is on?

    I don't know a lot about mask and masked layers and how to work with the normal layers beside i will use some 3D graphics but not in the background, i will explain all this to you to be more clearly.
    first i am using action script 3.0
    close ex,
    you have 2d map"image"  900*300 pixel.
    this image contains some 2d symbols when you click will go to anther normal map (anther normal layer) so they must appear.
    your game 320*320 px, and the place the map will show on 300*300, and there's basics objects will be in most pages including the page that show the map so i don't know a lot about how this will work with mask layers.
    so you can only see the left side of the map image and what it contains, while there's two arrows one to the left and one to the right there's three cases here,
    first when it show the left side(start from x:0 to x:300), the left arrow will not active when you press and the right arrow will start an animation that make the map image move to the mid side in one sec when you press.
    in mid side (start from x:301 to x:600) the same left arrow will active when you press to send you back to the left side while the same right arrow will be active to send you not to the mid side but to the right side,
    when moved to the right side the same left arrow will be active to send you to the mid and the right will not active when you press and depending on that,
    first how to make the large image appear with the three sides in the same place without effecting the other objects "like disappearing them" ?
    and the codes i need in the same left or right arrow symbol to make different actions with the same symbol when clicked depending on which part of the map is on.

  • How to Create another program instance in iphone from a COPY previous proj

    Say I've created one program by starting Xcode afresh.
    Now I want to create another program using the previous program as a base, I copy and paste the project folder and rename it, unfortunately, when I run the program, it replaces the previous program in my iPhone.
    How do I tell xcode it's a new program ?
    Message was edited by: Bracer-J

    Thank you

Maybe you are looking for