How to make a switch loop? ( Read inside for more info.)

I'm working on a project using switch and I want to know how to make it loop/ or is it possible to do so with for or while. If anyone could help me I'd be very thankfull.
Since my switch is too long I'll make an example:
System.out.println();
System.out.println();
System.out.println("Zgjedhni operacionin: ");
System.out.println("1. Mbledhja A + B\n");
System.out.println("2. Zbritja A - B\n");
optionNumber = sc.nextInt();
switch ( optionNumber ) {               
                    case 1: System.out.println("\nMbledhja A + B: ");
                          s11 = (a11+b11);
                          s12 = (a12+b12);
                          s13 = (a13+b13);
                          s21 = (a21+b21);
                          s22 = (a22+b22);
                          s23 = (a23+b23);
                          s31 = (a31+b31);
                          s32 = (a32+b32);
                          s33 = (a33+b33);
                          System.out.println( s11 + " - " + s12 + " - " + s13 );
                          System.out.println( s21 + " - " + s22 + " - " + s23 );
                          System.out.println( s31 + " - " + s32 + " - " + s33 );
                          break;
                    case 2: System.out.println("\nZbritja A - B: ");
                          s11 = (a11-b11);
                          s12 = (a12-b12);
                          s13 = (a13-b13);
                          s21 = (a21-b21);
                          s22 = (a22-b22);
                          s23 = (a23-b23);
                          s31 = (a31-b31);
                          s32 = (a32-b32);
                          s33 = (a33-b33);
                          System.out.println( s11 + " - " + s12 + " - " + s13 );
                          System.out.println( s21 + " - " + s22 + " - " + s23 );
                          System.out.println( s31 + " - " + s32 + " - " + s33 );
                          break;I've got the variables declared of course :P so now what I want after doing case 1 or case 2 or any other cases ( 9 in my program) I want to make a question if I want to do another operation and start again from beginning :$/

Solved it.
do {
System.out.println();
System.out.println();
System.out.println("Zgjedhni operacionin: ");
System.out.println("1. Mbledhja A + B\n");
System.out.println("2. Zbritja A - B\n");
optionNumber = sc.nextInt();
switch ( optionNumber ) {               
                    case 1: System.out.println("\nMbledhja A + B: ");
                          s11 = (a11+b11);
                          s12 = (a12+b12);
                          s13 = (a13+b13);
                          s21 = (a21+b21);
                          s22 = (a22+b22);
                          s23 = (a23+b23);
                          s31 = (a31+b31);
                          s32 = (a32+b32);
                          s33 = (a33+b33);
                          System.out.println( s11 + " - " + s12 + " - " + s13 );
                          System.out.println( s21 + " - " + s22 + " - " + s23 );
                          System.out.println( s31 + " - " + s32 + " - " + s33 );
                          break;
                    case 2: System.out.println("\nZbritja A - B: ");
                          s11 = (a11-b11);
                          s12 = (a12-b12);
                          s13 = (a13-b13);
                          s21 = (a21-b21);
                          s22 = (a22-b22);
                          s23 = (a23-b23);
                          s31 = (a31-b31);
                          s32 = (a32-b32);
                          s33 = (a33-b33);
                          System.out.println( s11 + " - " + s12 + " - " + s13 );
                          System.out.println( s21 + " - " + s22 + " - " + s23 );
                          System.out.println( s31 + " - " + s32 + " - " + s33 );
                          break;
System.out.println("Doni te beni edhe nje operacion?: ");
vazhdo = sc.next().equalsIgnoreCase("PO");
while ( vazhdo == true);Sorry for double posting can't see an edit button :$

Similar Messages

  • How to make a column as read only for update integrator.

    Hi All,
    i came across one issue while creating integrator.
    for update integrator i have column rowid.rowid is a parameter. by using this(rowid) i'am updating.i want to make rowid column as read only .
    if i enable read only for rowid,then it is passing null as parameter and inserting new row instead of updating the row.
    If any one came across this problem you can help me in fixing this issue.

    Hi Sanket,
    Thanks for reply.
    i have created a dummy column and passed the value of the orginal column values to dummy cloumn. and hided the orginal column.
    in this process i have come across same issue. it is not passing the value as parameter and instead of updating the row it is inserting an new row.
    Any alternate for this scenario.
    Thanks in advance.

  • How to make the OAF page Read-Only for one Responsibility?

    I have a requirement to make the entire OAF page to Read-only for particular Responsibility.
    Is there any direct option to make page Read-only ?
    Can anyone suggest some solution?

    Hi,
    Check one article on
    http://www.applikast.net/technical/oa-fwk/misc/making-an-oa-framework-page-readonly
    or you can do Personalization for each item on page.
    Thanks,
    Abhi

  • Which JDK doc to read up for more info on array ?

    The title says it all. I need to know what other properties does an array has. For instance, we can use "x_array.length" to find out no.of elements in x_array. Is there a property to tell how many dimension does the array has ? The ".length" only gives size of one dimension. To find the size of another dimension, I need to do something as below :-
    int two_D_array[][] = new int[20][30];
    out.printf("1) two_D_array size %d\n", two_D_array.length);
    out.printf("2) two_D_array size %d\n", two_D_array[0].length);
    Output :
    1) two_D_array size 20
    2) two_D_array size 30
    Is there any better way to improve the above codes ? Thank you.

    TKH wrote:
    The title says it all. I need to know what other properties does an array has. That's easy. There are none ;)
    Is there a property to tell how many dimension does the array has ? The ".length" only gives size of one dimension. To find the size of another dimension, I need to do something as below :-
    Nope, you can't know. Or rather you have to know when declaring the array so there's no way to change it on the fly.
    As a result there's no need to know...
    Something like
    int[] arr = getIntArr();
    private int[] getIntArr() {
        return new int[1][2][3][4][5] {};
    }won't even compile.

  • Someone got into my Apple account. Read description for more info.

    Recently, someone gained access to my Hotmail account (I don't know how, I'm a pretty careful person, especially around computers) and used it to reset my Apple account password. I always just changed it back (thank God he/she was too stupid to change my Hotmail password), but when I realized they got access through my Hotmail, I reset all my passwords associated with the account. This worked and I haven't had any trouble since I did so. However, he/she continuously tries to reset my Apple password and my account gets flooded with Apple ID reset requests all the time. Is there any way to make it stop? It's getting really annoying.
    Thanks,
    Chris

    Call AppleCare & ask for account security. Also, look at this:
    http://support.apple.com/kb/HT5570

  • How to make in the loop codes?

    How to make in the loop codes to have like my output(below)?
    For example:
    I am trying to figure out how to make them correct the way I want to have the output.
    String start = "02-01-08";
    String end = "02-29-08";
    Calendar a = new GregorianCalendar();
    while( start <= end ) {
              a.add(Calendar.DAY_OF_WEEK, 7);
              Date d = a.getTime();
              DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
              String ss = df.format(d);
              System.out.println(ss);
    }The output:
    +02-01-08+
    +02-08-08+
    +02-15-08+
    +02-22-08+
    +02-29-08+
    Anybody know how to make it correct?

    artist_tech07 wrote:
    I am confused where is the answer in the doc that you gave me?Read my first reply and read the docs. Then read them again.
    And then re-read this
    To do what you want you need a start and end Dates. These you can compare in one numeric form or the other. For example by using getTime.
    Then during each loop iteration you will need to add *1 day (using the Calendar)* to the start date.
    I am telling you what methods to use. I have told you were you can find those methods. I have given you a link to the Calendar class API. All you have to do is put 2 and 2 together. Or at the very least make an attempt to do so.

  • How to make a DFF in read only mode

    Hi All
    There is a requirement to male an descriptive flexfield (in Puchasing PO Headers) i read only mode for all the users.
    So that user must not select any values, Is any way to do this. Any workaround is possible ?
    Regards

    Hi;
    Please follow below and see its helpful:
    [Solved] How to make a DFF segment 'Read-Only' using Form Personalization?
    Also check:
    http://download-west.oracle.com/docs/cd/A60725_05/html/comnls/us/fnd/ogenff03.htm
    Regard
    Helios

  • How to make a DFF as Read only field

    How to make a DFF as Read only field

    Hi,
    You can add the read only token ($RO$) to any of the segments in the list. For example:
    segmentlist = "Context1|Segment1($RO$)|Segment2..."
    Thanks,
    Kumar

  • How to make an app a file receiver for images on iOS?

    Hi,
    How to make an app a file receiver for images on iOS?
    I did it for the Android app.xml like this:
    <intent-filter>
            <action android:name="android.intent.action.SEND"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <data android:mimeType="text/plain"/>
        <data android:mimeType="image/jpg"/>
        <data android:mimeType="image/jpeg"/>
        <data android:mimeType="image/png"/>
        <data android:mimeType="image/gif"/>
    </intent-filter>
    How to do it for iOS?
    (I'm using Adobe Air 4.0)
    Thank you!

    What app have you used to create your ibook?  Normally any app will have a menu item like File > Export that will give you the option of PDF, or you can use Print and there will be an option in the Print dialogue to Print to PDF.

  • How to make Adobe as your default viewer for all your PDF file instead of the Preview given? Thanks

    How to make Adobe as your default viewer for all your PDF file instead of the Preview given? Thanks

    you need to "Get Info" on the file first. Select it, right click and select 'Get Info' in the menu.
    In the window that pops up, near the bottom, the "Open With" drop down menu needs changed. If the drop down menu does not present the one you want, select "Other" and find it.

  • Time Capsule only works for one device at a time, how to make it capable to be used for multiple devices at times

    Time Capsule only works for one device at a time, how to make it capable to be used for multiple devices at times.
    Please help to set it up, thanks in advance

    You need to give more info..
    Firstly only works for what.. networking.. backup.. wireless. You need more nouns.. more adjectives... describe what you want and what fails.. then we can figure out why.
    Most likely you have bridged it when it should be in router mode..
    Most likely you are using Lion or ML which has the airport utility bridge the TC by default.
    Change it to working as a router. That might help.
    If you press reset button it will default back to router btw.
    If you are on Lion.. use a real utility. http://support.apple.com/kb/DL1547

  • How to make cell editable alv in WebDynpro for ABAP?

    I make Column editable ALV.(See under source code)
    But I can't make Cell editable ALV.
    How to make Cell editable ALV in WebDynpro for ABAP?
    and..how to get changed data?
    DATA: l_value TYPE REF TO cl_salv_wd_config_table.
      l_value = l_ref_interfacecontroller->get_model( ).
    * { EDITABLE
      DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
            lr_input_field     TYPE REF TO cl_salv_wd_uie_input_field,
            lr_column          TYPE REF TO cl_salv_wd_column.
      lr_column_settings ?= l_value.
      lr_column = lr_column_settings->get_column( 'TOTAL_COUNT' ).
      CREATE OBJECT lr_input_field
        EXPORTING
          value_fieldname = 'TOTAL_COUNT'.
      lr_column->set_cell_editor( lr_input_field ).
      DATA: lr_table_settings TYPE REF TO if_salv_wd_table_settings.
      lr_table_settings ?= l_value.
      lr_table_settings->set_read_only( abap_false ).

    the code seems to be correct....but where are you writing it?
    put the code in the wddoinit method and it should work.
    have a look at this article..
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1

  • How to make dyn/admin not to prompt for username and password?

    Hello all
    How to make dyn/admin not to prompt for username and password? I am writing a selenium job to automate cache invalidation to load test a production issue we are facing. Selenium is opening a fresh firefox session and prompting for username and password every time. I am also trying to modify my script such that it will use the same session again and not prompt for username and password. But I thought of asking this question in the group.
    Your inputs will help a lot.
    Thanks,
    Sundar

    Hi,
    You can set enabled property of /atg/dynamo/servlet/adminpipeline/AuthenticationServlet/ to false. It will not prompt for authentication.
    Gopi

  • How can I see if my program is for more than one user? We think we have bought in design for more users, but can not find out how to get in for more than one?

    How can I see if my program is for more than one user? We think we have bought in design for more users, but can not find out how to get in for more than one?

    If you bought a CC for team, you can log in at http://adobe.com and insert the e-mail that you gave at the moment at the purchase and than you can manage and see you product/plan/team.
    If I was not clear you can use the following link to help you solving your issue:
    Creative Cloud Help | Manage your Creative Cloud for teams membership
    If your not clear about this situation, contact with an agent of Adobe, by chat or phone. Use the following link to see the type of support you have on this matter:
    http://adobe.com/getsupport
    I think this will help you.
    Regards

  • How do i recover a purchase I made for more iCloud storage that i don't need?, How do i recover a purchase I made for more iCloud storage that i don't need?

    How do i recover a purchase I made for more iCloud storage that i don't need?

    Please see this website: http://support.apple.com/kb/HT4874

Maybe you are looking for