Looping Help

I think I am completely off on the logic here I have everything displaying like I want but when the last window appears and you press "Y" I want the PaymentCalculation method to run again.
import javax.swing.JOptionPane;
public class MortCalcSwing
     public static void PaymentCalculation()
          //declare and construct variables
          String LoanAmount, LoanTerm, LoanRate;
          double Amount, Term, Rate, PaymentAmount;
          double monthTerms, decRate;
          //prints prompts and get input
          System.out.println("\tThe Mortgage Calculator");
          LoanAmount=JOptionPane.showInputDialog(null, "Enter the loan amount: ");
               Amount = Double.parseDouble(LoanAmount);
          LoanTerm=JOptionPane.showInputDialog(null, "Enter the term of the loan in years: ");
               Term = Double.parseDouble(LoanTerm);
          LoanRate=JOptionPane.showInputDialog(null, "Enter the rate of the loan: ");
               Rate = Double.parseDouble(LoanRate);
          //calculations
          monthTerms = Term * 12;
          decRate = Rate / 100;
          PaymentAmount = (Amount * decRate) / (1 - Math.pow(1+decRate,-monthTerms));
          //output
          JOptionPane.showMessageDialog(null, "The payment amount is " + Math.round(PaymentAmount));
          //System.exit(0);
     public static void Question()
          do
               //declare variable for Question Method
               char mtgQuestion, Question;
               //print prompt for user input
               mtgQuestion=JOptionPane.showInputDialog(null, "Do you want to run program again Y/N?");
                    Question = char.parseChar(mtgQuestion);
          }while (Question = "Y");
     public static void main(String[] args)
          PaymentCalculation();
          Question();
}

Well I have one part of the program looping just not the entire thing..........
import javax.swing.JOptionPane;
public class MortCalcSwing
     private static String Question = "";
     public static void PaymentCalculation()
          //declare and construct variables
          String LoanAmount, LoanTerm, LoanRate;
          double Amount, Term, Rate, PaymentAmount;
          double monthTerms, decRate;
          //prints prompts and get input
          System.out.println("\tThe Mortgage Calculator");
          LoanAmount=JOptionPane.showInputDialog(null, "Enter the loan amount: ");
               Amount = Double.parseDouble(LoanAmount);
          LoanTerm=JOptionPane.showInputDialog(null, "Enter the term of the loan in years: ");
               Term = Double.parseDouble(LoanTerm);
          LoanRate=JOptionPane.showInputDialog(null, "Enter the rate of the loan: ");
               Rate = Double.parseDouble(LoanRate);
          //calculations
          monthTerms = Term * 12;
          decRate = Rate / 100;
          PaymentAmount = (Amount * decRate) / (1 - Math.pow(1+decRate,-monthTerms));
          //output
          JOptionPane.showMessageDialog(null, "The payment amount is " + Math.round(PaymentAmount));
          //System.exit(0);
     public static void Question()
          do
               //print prompt for user input
               Question=JOptionPane.showInputDialog(null, "Do you want to run program again Y/N?");
          }while (Question.equalsIgnoreCase("Y"));
     public static void main(String[] args)
          PaymentCalculation();
          Question();
}

Similar Messages

  • Smartform - Field not outputting more than 255 characters in a loop - Help!

    Hi,
    I have the following problem with my Smartform:
    I am looping from a table and into a structure (Loop function).
    1 of those fields is 1000 characters long and will be filled usually at 500 characters inside.
    However, when looping and outputting the field (text node) in the format &Tablename-Fieldname&, only up to 255 characters are output.
    To give you a better idea - I have a Loop Node and there, I am looping from a table (type table of) into a header
    (type).
    Using LCHR does not help.
    Why does this happen? How can I fix this? Are any symbols available in Smartforms, like they are in SAPscript?
    Any possible solutions will help.
    Please help – this is very important and very urgent.
    Best Regards,
    John

    Hi,
    if you want to output a long string in a smartform putting it as &name& in a text will not help you. For printing such an information you use temp include texts you create an delete on the fly while processing the SF.
    To Do so:
    - define GV_SUFFIX type char2, GS_HEAD a structure with fields TDOBJECT type TDOBJECT, TDNAME type TDOBNAME, TDID type TDID, TDSPRAS type SPRAS
    - define a code step importing the text, the language and the GV_SUFFIX, in the coding , you convert the string to itf and than use function module SAVE_TEXT to save the include text and put the information into GS_HEAD
    - define an include text where you put out the newly created include text
    - define a code step to delete the temporary text with function module DELETE_TEXT
    Best Regards
    Roman Weise

  • Patchadd stuck in infinite loop -HELP!!

    Hi all,
    Iam trying to install some OS patches in SunOS 5.8 machine[sun4u sparc SUNW,Sun-Fire-280R]
    But after the process starts, it seems to get stuck in an endless loop. I get the following messages.
    Checking installed patches...
    Verifying sufficient filesystem capacity (dry run method)...
    After the second line, the process of installing patch does not seem to end.
    I did the install in single mode.
    Rebootted the machine and did an fsck. But didnt help. Tried downloading a patch to patch 'patchadd' , but could not install it as well.
    I tried debugging the patchadd. Here is a debugging trace.
    required utlsa are available
    Checking installed patches...
    Verifying sufficient filesystem capacity (dry run method)...
    + exit_code=0
    + pkgInst=
    + pkgDispList=
    + dryrunFailure=
    + ReqArrCount=0
    + firstTimeThru=yes
    + cd /var/spool/patch/112396-02
    + + pwd
    curdir=/var/spool/patch/112396-02
    + typeset -i pkgInsCtr=0
    + newpkglist= SUNWcsr
    + pkgInst= SUNWcsr
    + newpkglist= SUNWcsr SUNWcsu
    + pkgInst= SUNWcsr SUNWcsu
    + pkglist= SUNWcsr SUNWcsu
    + [[ -f SUNWcsr/pkginfo ]]
    + echo inside. . . .
    inside. . . .
    + /usr/bin/cp /tmp/patchadd-127541250/response.1250 /tmp/patchadd-127541250/response.1250.1
    + [[ yes == no ]]
    + [[ yes == yes ]]
    + echo first time thru
    first time thru
    + [[ no == yes ]]
    + pkgadd -D /tmp/patchadd-127541250/112396-02.1250 -S -n -a /tmp/patchadd-127541250/admin.tmp.1250 -r /tmp/patchadd-127541250/
    response.1250.1 -R / -d . SUNWcsr SUNWcsu
    + 1>> /tmp/patchadd-127541250/pkgaddlog.1250 0< /dev/null 2>& 1
    It seems like it is getting stuck in the pkgadd command .
    Any help on this would be highly appreciated.
    Thanks,
    Vimalnath. A

    HI,
    Make sure the patch doesn't exists in the system.
    Ski

  • Iphone stuck in infinite loop, HELP!

    my iphone after resetting all settings through settings>general>reset, is stuck in an infinite loop.
    it turns on, shows the apple logo, then about a minute later the loading symbol appears, after 10mins it quickly flashs black and then starts the loop again, i have left it for over 12 hours, to see if it will fix itself, but it wont.
    i cant get it into dfu or recovery mode, it wont even turn off until it runs out of battery and then repeats its loop. when i charge it it just starts the loop again!
    please i really need help, if i cant resolve this problem, im not going to buy the ipad and the iphone 4g as i planned to do so.
    please could anyone help!

    If you can't get your iPhone into DFU or recovery mode, there is a major problem. You can make an appointment at an Apple store if there is one nearby.
    This is a user to user help forum only, so doubtful if any fellow users will lose any sleep over your threat not to purchase an iPad or the next generation iPhone when released if this problem cannot be resolved. If not, more than likely there is a hardware problem or failure. If a problem arises with your PC that you cannot resolve, are you not going to purchase another PC either?

  • Nested Loop Help

    Hello,
    I have generated a simple VI, to make multiplication and division operations. I have the following operation performed with the following inputs.
    A1 has a value range from 1 -10 fixed
    A2 has an input range of 1 - 5
    A3,A4 are constants.
    so Result  = (A1*A3 ) / (A4*A2)*100 ,
    I want to  plot "Result Vs. A1" with a current value of A2, increment A2 and repeat the procedure. So I generate 5 graphs and display it in only one. I need to write a nested loop to perform this operation.however I am able to do it only once.
    I am trying to use for loop structure in one another but havent gone ahead in this.Any help will be appreciable..Thanks in advance.

    altenbach wrote:
    Dravi99 wrote:
    The Problem is that I want to plot the division result vs. the # of array out elements and i am unsuccessful at it. May be i am missing on the waveform graph properties.
    You should make the current values default before saving so we have some typical data to play with.
    Currently, your code makes very little sense, because the inner loop has no purpose.
    If you plot the division result versus array index (I assume that's what you want, I don't understand what you mean by "the # of array out elements "), you only have one plot. What should be on the other plots???
    Please explain or even attach an image of the desired output. Thanks!
    Thanks Altenbach for the inputs.
    I have made the values default. Srry for the previous one.
    Now the inner loop was placed so that i can create a 2D array.
    I need to plot the division result vs. the value of the element in the arry out. i.e. currently my array out has 0.0...,0.3 I want that to be the X axis.
     The graph plotted   is for 1st value of "in", this value will change like from 4.5 to 4.7 to 4.9, not necesarily in steps.
    Thus my one graph should have multiple plots of "in" which has the above mentioned axis.
    Hope this time i was clear in my msg. I have attached the modified VI.
    Attachments:
    For_loop_prob.vi ‏17 KB

  • CcBpm Loop Help

    Hi,
    Can someone help me with this? I did some searches on sdn but I can't seem to find some sort of step by step for how a loop works?
    I have multiple account numbers which I sent to a 1:1 web service which returns 1 account. I neet to loop through all my acc nrs and combine the responses from the web service into 1 message structure..
    Thanks.
    Jan

    Hi,
         The loop in bpm is a while loop. The loop is executed till the specified condiotion is true.
    To use the loop, use the contained object to define a counter variable and increment the counter using container operation --.assign value to element. Use this counter variable to check if the condition is true, i.e, in the loop step, check if the value of the container variable exceed some specified value.
    Regards

  • Foreach loop help

    I am trying to create a foreach loop that takes all txt files in Program Files and print only the names of files over 10KB.
    This is what I got:
    foreach($file in (Get-ChildItem -Path "c:\Program Files" -recurse -Include *.txt |
    Select-Object FullName ))
    if($file.size -gt 10KB)
    Write-Host $file
    I've been testing around with this for a bit now and doing some Googling to no avail, it'll work if I don't try to sort it by size and ask it just to print the name of all text files in Program Files. Any nudge in the right direction would be appreciated.

    Let me be more explicit.  Whatou posted is not a loop.
    Always start with HELP when you are learning.  Ask your teacher to explain to you how to use HELP.
    help foreach.
    A ForEach loop cannot solve your issue here. You need to filter the results of a recursive search. In PowerShell this is almost never done with a loop. If your teacher tries to tell you otherwise you need to fire the teacher or take your money to a different
    school.
    Of course it may be more likly that you just didn't pay attention in class and are now asking us to do your homework for you.
    Sorry.  We don't do homework for children. This is a site for technicians who use scripting professionally. If you want to be a professional you need to do your homework No cheating. We are watching.
    ¯\_(ツ)_/¯

  • The never ending installation loop - Help!

    Dear Apple Forums,
    I can honestly say I used to hate apple, but since buying one for university use I've come to love my little MacBook Pro. However, it has recently suffered a massive problem and I've run into a very difficult situation. My macbook pro started giving me problems a couple weeks ago with the mac screen of death ("please restart your computer" in 3 languages) and I attempted to fix it using the mac troubleshooting guide online to no avail. Things only got worse as it took up to 7 attempts to get to the desktop. I finally decided to reformat this bad boy in hopes that whatever was wrong with it would go away.
    However, I've run into a major problem with the installation process. It seemed to be running fine through the first Mac OS X install disk, and it asked me to restart my computer, which I attempted when it showed me the screen of death. I just ignored it and continued on by inserting the second disk when prompted. Now I seem to be stuck in an endless loop of installation. I get to about half way through the installation when it tells me there was an error and that I should try installing again. I've attempted to install the second disk about eight times now, and I don't know what I need to do next.
    Any help would be greatly appreciated. I live in Maine, and I don't want to have to drive to New Hampshire to fix my precious computer.

    Figured I'd start recording the errors I get in the Installer Log:
    localhost : BomFatalError - cpio read error: bad file format
    localhost : Install failed: some files for GarageBandinstrumentsTiger may not have been written correctly.
    localhost : BomFileError 0: Unknown error: 0 - ./Instrument Library/Sampler/Sampler Files/Grand Piano/054F#2KM56M.wav
    localhost : Install failed: some files for GarageBandinstrumentsTiger may not have been written correctly.
    localhost : BomFatalError - cpio read error: bad file format
    localhost : Install failed: Some files for iDVDThemes_Tiger may not have been written correctly.
    localhost : BomFatalError - cpio read error: bad file format
    localhost : Install failed: Some files for iWeb_App may not have been written correctly.
    localhost : Install failed: Error encountered while writing receipt for iWebtempja.
    localhost : BomFatalError - cpio read error: bad file format
    localhost : Install failed: Some files for iWork Trial may not have been written correctly.

  • Apple logo loop help

    My phone is stuck on a continuos loop of the Apple logo. My Iphone 5 running on IOS 8.3 won’t respond when i try to turn the phone on. I hit the power button multiple times and try everything but it will not turn on. When i plug it into a charger though, it shows the screen as if it were dead but charging,(the empty battery but no charger cord symbol) and switches to the Apple logo screen as if it were booting up after it was dead. It repeats this forever but sometimes im able to turn it on but after awhile it shuts off at full battery and repeats the loop. I’ve tried a hard reset and plugging it in to Itunes but neither helped. Any help would be appreciated.

    Connect it to your computer, and hold both the home and power buttons. When the Apple logo screen re-appears, immediately let go of the power button but continue to hold the home button. iTunes should open and your iPhone should enter recovery mode.

  • Connect by loop help

    Hi,
    I have a table with 4 columns
    parent number,
    parent code varchar2(10),
    child number,
    child code varchar2(10)
    The parent code and child code are catogries and the parent and child are IDs both have to be equal to each other for there to be a link.
    i.e. a child 200 code 'C' with a parent 100 code 'T' only relatest to parent 100 code 'T'. There can be a parent 100 code 'C' and 'P' etc.
    I am after a connect by loop that will give me all the relationships that this table contains.
    Any help please

    So what you want is something like this?
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select &id as id, '&code' as code from dual)
      2  --
      3  select 'Child' as type, pcchild as id, pcchildcode as code
      4  from afpc, t
      5  connect by pcparent = prior pcchild and pcparentcode = prior pcchildcode
      6  start with pcparent = id and pcparentcode = code
      7  union all
      8  select 'Parent' as type, pcparent as id, pcparentcode as code
      9  from afpc, t
    10  connect by pcchild = prior pcparent and pcchildcode = prior pcparentcode
    11* start with pcchild = id and pcchildcode = code
    SQL> /
    Enter value for id: 1960
    Enter value for code: ACT
    old   1: with t as (select &id as id, '&code' as code from dual)
    new   1: with t as (select 1960 as id, 'ACT' as code from dual)
    TYPE           ID CODE
    Child        1957 ACT
    Child        1961 ACT
    Parent       2916 CAS
    SQL> insert into afpc values (7, 3000, 'TST', 2916, 'CAS');
    1 row created.
    SQL> with t as (select &id as id, '&code' as code from dual)
      2  --
      3  select 'Child' as type, pcchild as id, pcchildcode as code
      4  from afpc, t
      5  connect by pcparent = prior pcchild and pcparentcode = prior pcchildcode
      6  start with pcparent = id and pcparentcode = code
      7  union all
      8  select 'Parent' as type, pcparent as id, pcparentcode as code
      9  from afpc, t
    10  connect by pcchild = prior pcparent and pcchildcode = prior pcparentcode
    11  start with pcchild = id and pcchildcode = code
    12  /
    Enter value for id: 1960
    Enter value for code: ACT
    old   1: with t as (select &id as id, '&code' as code from dual)
    new   1: with t as (select 1960 as id, 'ACT' as code from dual)
    TYPE           ID CODE
    Child        1957 ACT
    Child        1961 ACT
    Parent       2916 CAS
    Parent       3000 TST
    SQL>

  • Loop Help

    Okay here's the deal. I have a hashcode dictionary which I am reading from through an external file. Now I have everything working perfectly. What's pretty much going on is this: (1)I'm asking the user to enter a item # or ID and (2)the program looks up the item ID (which contains both an item title and item price). From there I pretty much get those values and print them to a sales reciept. Now like I said, this is all working perfectly fine and my problem is not the dictionary or reading from it. What my problem is, is how to allow the user to input multiple items so that they may be printed on the same sales receipt. I know how to ask the user whether they would like to input another but I don't know which or how to use a loop for this. What I pretty much want to happen is after entering the first item ID, the user will be allowed to enter a second item ID, and so on until the user chooses not to enter any more and the calculations are run and printed on the sales receipt. Can anyone help me with this? If you feel that you need more info. to answer this, post what you want me to post and I'll post it. Thanks.

    I would read all the values entered by the user into a data structure, say an array first, then loop thru the array and for each entry in the array lookup the hashcode/dictionary for the relevant data and push them out to sales receipt. Hope this helps!! If not i did not really understand ur prob.

  • Loop - Help pl!

    Am having the following jsp code and my execution is very slow.IAm looping through the resultset as follows.can anybody help pl!Thanks
    <%
                                  int pi=0;
                                  int pid=0;
                                  String pnme="";
                                  String pdp="";
                                  String pd="";
                                  int nval=1;
                                  int y=0;
                                  int sbid=0;
                                  String cpnm="";
                                  String getqk="select top 10ct,pgid,pg_name,dept from page_details order by ct desc";
                                  ResultSet rsgetqk=st.executeQuery(getqk);
                                  while (rsgetqk.next())
                                       pi=rsgetqk.getInt("ct");
                                       pid=rsgetqk.getInt("pgid");
                                       pnme=rsgetqk.getString("pg_name");
                                       pdp=rsgetqk.getString("dept");
                                       Connection con1=DriverManager.getConnection("jdbc:odbc:"+dsnname,"sa","");
                                       Statement st1=con1.createStatement();
                                       String linklistz="select main_pgid from sublinks a,page_details b where a.sbg_pgid=b.pgid and a.sbg_pgid="+pid+" and a.sblft_nvg="+nval+"";
                                       ResultSet rssblnlnkz=st1.executeQuery(linklistz);
                                       while (rssblnlnkz.next())
                                            y=y+1;
                                            sbid=rssblnlnkz.getInt("main_pgid");
                                       rssblnlnkz.close();
                                       st1.close();
                                       con1.close();
                                       Connection con3=DriverManager.getConnection("jdbc:odbc:"+dsnname,"sa","");
                                       Statement st3=con3.createStatement();
                                       int piid=0;
                                       String linklist="select a.pgid as pgid from page_details a,mainlinks b where a.pgid=b.main_pgid and a.pgid="+pid+"";
                                       ResultSet rssblnlnk=st.executeQuery(linklist);
                                       while (rssblnlnk.next())
                                            piid=rssblnlnk.getInt("pgid");
                                       rssblnlnk.close();
                                       st3.close();
                                       Connection con2=DriverManager.getConnection("jdbc:odbc:"+dsnname,"sa","");
                                       Statement st2=con2.createStatement();
                                       String gtcompx="select comp_name from comp_details where dep_name='"+pdp+"'";
                                       ResultSet rscp=st2.executeQuery(gtcompx);
                                       while (rscp.next())
                                            cpnm=rscp.getString("comp_name");
                                       }rsgetqk.close();%>

    Hi ,
    May be can you try with the below code and let me know if anything.
    thans
    Ramesh
    <%
    int pi=0;
    int pid=0;
    String pnme="";
    String pdp="";
    String pd="";
    int nval=1;
    int y=0;
    int sbid=0;
    String cpnm="";
    Statement     st     =     null;
    Statement     st1     =     null;
    Statement     st2     =     null;
    Statement     st3     =     null;
    String getqk="select top 10ct,pgid,pg_name,dept from page_details order by ct desc";
    Connection con1=DriverManager.getConnection("jdbc:odbc:"+dsnname,"sa","");
    st               = con1.createStatement();      
    ResultSet rsgetqk=st.executeQuery(getqk);
    /****Main Exeuction*******************************************************/
    while (rsgetqk.next())
         pi=rsgetqk.getInt("ct");
         pid=rsgetqk.getInt("pgid");
         pnme=rsgetqk.getString("pg_name");
         pdp=rsgetqk.getString("dept");
         /****First Exeuction*******************************************************/
         st1=con1.createStatement();
         String linklistz="select main_pgid from sublinks a,page_details b where a.sbg_pgid=b.pgid and a.sbg_pgid="+pid+" and a.sblft_nvg="+nval+"";
         ResultSet rssblnlnkz=st1.executeQuery(linklistz);
         while (rssblnlnkz.next())
              y=y+1;
              sbid=rssblnlnkz.getInt("main_pgid");
         rssblnlnkz.close();
         st1.close();
         /****Second Exeuction*******************************************************/
         st3=con1.createStatement();
         int piid=0;
         String linklist="select a.pgid as pgid from page_details a,mainlinks b where a.pgid=b.main_pgid and a.pgid="+pid+"";
         ResultSet rssblnlnk=st.executeQuery(linklist);
         while (rssblnlnk.next())
              piid=rssblnlnk.getInt("pgid");
         rssblnlnk.close();
         st3.close();
         /****Third Exeuction*******************************************************/
         st2=con1.createStatement();
         String gtcompx="select comp_name from comp_details where dep_name='"+pdp+"'";
         ResultSet rscp=st2.executeQuery(gtcompx);
         while (rscp.next())
              cpnm=rscp.getString("comp_name");
         rsgetqk.close();
    st.close();
    con1.close();
    %>

  • Ipod Touch 4g ios 4.2.1 32gb in boot loop help

    ive had my ipod since december 2010 and ive been using fine ever since till i started watching a video on youtube.
    it then froze so i rebooted it and it wouldnt load any app then on.
    i tried to sync it with itunes and itunes wouldnt detect it and i tried connecting it to 2 other pcs and still no joy.
    i then stupidly tried to erase all files and settings through the default option in the ipods settings.
    now all i get is it starts up loads the apple logo after about 5 minutes a white screen and restarts.
    i can put it in recovery mode where i see the itunes logo and usb cable but it wont be recognised on the pc
    i have tried on a
    win 7 32 bit system
    win 7 64 bit system
    win vista 32 bit system
    and its not recognised on any pc - no icons in the corner and nothing in my computer
    i checked device manager and no apple device appears under the usb serial ports
    i have completely removed itunes and deleted all relating software and stopped the apple mobile device service and reinstalled itunes
    i have restarted the amds
    ive even restarted my pc several times and im lost at what to do next
    it won't even detect charging status through usb yet when in my docking station it charges just fine
    any help is greatfully accepted and i will answer any questions as thoroughly as possible.

    i jailbroke it though for testing apps a friend of mine made and its proved because ive also changed the boot logo and thats seen in the boot loop so the warranty thing might be now voided ive used it fine for 3 months this way until now

  • Music Loop Help

    Okay what I have here is a real simple and fast loading
    script to stream a .mp3 file for music throughout the entire site
    I've built. What I need to do is make this music loop (repeat
    continiously) unless Stop is pressed. The whole fla file consists
    of 1 Frame with 2 Layers.
    1) The action Scipt Below.
    2) The control buttons.
    Is there an easy addition to add to my script to allow the
    music to loop.. Music plays on load. If somone presses "Stop" it
    stops. If somone presses "Play" it will play again and loop.
    Action Script:
    var tune:Sound = new Sound();
    tune.loadSound("breathe2.mp3", true);
    tune.start();
    play_mc.onPress = function() {
    tune.stop();
    tune.start();
    stop_mc.onPress = function() {
    tune.stop();
    Thanks for any help on this.
    Cheers!
    TRI0N

    Doesn't the sound object allow you to declare the number of
    times the music playing loops?
    tune.start(secondsOffset, loops);
    Just give it a number that will likely never roll over like
    100000
    tune.start(0, 10000);
    If your site music is say one minute in length then thats
    10000 minutes of play time.

  • Prime Number Loop Help

    I have used some code and written a program that asks the user for a number and it checks to see if it is prime or not. The program works fine, but I need it to loop and ask for another number or to exit. Here is my code and what my teacher has suggested to do, but I dont understand how to do this.
    This program checks to see if a number is prime or not. I got a lot of help on the Java Sun Forums.
    import java.io.*;
    public class Prime
    public static void main(String[] args)
    System.out.print("Enter a number: ");
    String input = readInput();
    int number = Integer.parseInt(input);
    int divisor = 2;
    int numberbytwo = number / 2;
    // Sets the factor to false uses loop to test
    boolean primen =false;
    while( divisor <= numberbytwo )
    if (number % divisor == 0)
    primen = true;
    break;
    divisor = divisor + 1;
    if( primen )
    System.out.println( number + " is NOT a prime number");
    else
    System.out.println( number + " is a prime number");
    Input method
    private static String readInput()
    try
    BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
    return keyboard.readLine();
    catch (IOException e) {}
    return "";
    What you have done is absolutely right...If you want to keep the user in the loop after the first check, you can do it and it is quite easy. Move the prompting for a number etc..to another function just the readInput() method...call it maybe askUser() or something.....
    and then in your below logic:
    if( primen )
    System.out.println( number + " is NOT a prime number");
    // ASK THE USER IF HE/SHE wants to continue. If yes call the askUser() method....
    else
    System.out.println( number + " is a prime number");

    It is, Jim. But not as we know it...Enlighten me 'o learned one, how should it be then??? Well, my comment suggested that the language wasn't standard,
    not that it should be.
    That's not a quibble: for what it's worth, I think fully spelt out words are
    probably a good thing in an international forum with many members for
    whom English is not their first language. And that care and
    attention to language is important both for describing problems and
    their solutions, and for coming up with something acceptable to the
    compiler. But more important than either of these, is the need to
    communicate, and to help.
    You were doing both of these. And I wasn't. So I shouldn't have
    stomped on your thread. For that I am sorry.
    (But destin started it! And it's "Enlighten me, oh learned one; how, then,
    should it be?")

  • E75 Stuck in a loop HELP!

    All the sudden my E75 got stuck in some sort of loop this morning. The main screen keeps flashing over and over like its refreshing in a loop and won't stop. I restarted the phone, pulled the battery, and it keeps doing it.
    I do not want to do ANOTHER FREAKING RESET ON THIS PHONE! I have had it a week and needed to wipe it TWICE now *Once after the number ported cause it wouldnt take data anymore even after a power cycle and once cause of graphical glitches all over the title bar*.
    I just want my phone to be useable. Someone please help. 

    Only solution for now is by typing *#7370# (clear all data in phone memory, restore defaults).
    Second thing, after restet- change "active" profile to "basic", and wait for phone soft update (not 100% sure, that is solution, but no loop for now after I changed profile).

Maybe you are looking for

  • WebLogic 8.1SP4 and IIS

    Hi, I want to configure weblogic with IIS and have found enough articles on how to proxy IIS to point to a single instance or a clustered environment but not on how to proxy IIS to multiple WebLogic servers I have the application running on http://<w

  • Dimensional Modelling  issue

    Hi, I am working with Stock Exchange data, as per the availability of data, I found 2 dimensions that is *(1)Time* *(2)Company* In my fact table, some of the fact(measures) are changing based on Date(Day) and some of the them are changing based on Ti

  • Import mdl file problem

    Hi , i have oracle 11.1.0.7 on windows 2003 SP2 32 bit , i imported a MDL file created by oracle 11.1.0.6 (windows 2003 SP2 32 bit) . i can not run maps correctly and the situation is not stable. do i need any patch or do more activity after importin

  • My safari won't open. What do I do?

    My safari won't open. What do I do?

  • App store still requires password (with Touch id)

    Hi there, Just wondering if I'm doing something wrong here. It just seems that the App store always asks me for my password even when I have touch id enabled. It sometimes asks for the password and then the touch id? Is there a setting or something t