Problem with max min numbers

I want to make program where a user enters int numbers until he/she enters negative number.
Program shall then print out min, max, avarage(only with one desimal) and how many numbers that are entered by the user.
Does anyone have suggestions??

I have almost done it.
I just cant get min number to work.
What might be wrong with my program??
public class Oppg1
public static void main( String args[] )
int total; //summen av de inntastese talla
int tallTeller; //antall tall tastet inn
int tall;
//int tall1;
int min,max; //tallverdien
int antTall;
double gjennomsnitt; //nummer med desimal verdi
String tallString;
max=0;
min=0;
total=0;
tallTeller=0;
antTall=0;
//les inn f�rste tall fra bruker
tallString=JOptionPane.showInputDialog("Tast inn heltall eller avslutt med vad � taste neg tall");
//konverter tallString til int
tall=Integer.parseInt(tallString);
while (tall>0) {
total=total +tall; // adderer tall til total
tallTeller= tallTeller+1; //inkrementerer tallteller
antTall=tallTeller+1;
min=Math.min(tall,min);
//max=Math.max(max,tall);
//ta imot neste tall fra bruker
tallString=JOptionPane.showInputDialog("Tast inn heltall eller avslutt med ved � taste negativ tall");
//konverter tallString til int
tall=Integer.parseInt(tallString);
DecimalFormat twoDigits = new DecimalFormat("0.00");
if(tall<0){
antTall=tallTeller;
//Hvis bruker taster inn en tall ihvertfall
if (tallTeller!=0){
//beregn gjennomsnittet
gjennomsnitt=(double)total/tallTeller;
//vis gjennomsnittet
JOptionPane.showMessageDialog(null,"Antall tall tastet inn: "+antTall+"\n"+"Gjennomsnitt: "+twoDigits.format(gjennomsnitt)
+"\n"+"Max tall: "+max
+"\n"+"Min tall: "+min,"Utskrift",
JOptionPane.INFORMATION_MESSAGE);
else // hvis ingen tall er tastet inn, en passende tekst
JOptionPane.showMessageDialog(null,"Ingen tall tastet inn","",
JOptionPane.INFORMATION_MESSAGE);
System.exit( 0 );
}

Similar Messages

  • Haven't been able to use pages for a while.  Keep getting following message.  Have tried reinstalling iWork, but no luck.  Same problems with Keynote and Numbers/Users/scottmcdonald/Desktop/Screen Shot 2012-03-14 at 9.39.52 PM.png

    Haven't been able to use pages for a while.  Keep getting following message.  Have tried reinstalling iWork, but no luck.  Same problems with Keynote and Numbers/

    Have you moved Pages from its installed location? Or just dragged a copy to your current system?
    It can't find some of its resources apparently.
    Peter

  • After I updated lion to 10.7.4, app store does not recognize my ID APPLE and it unable to connect me to app store in order to update/download apps? What have I to do? I have the same problem with mac mini e mac book air. Please help me!

    After I updated lion to 10.7.4, app store does not recognize my ID APPLE and it unable to connect me to app store in order to update/download apps? What have I to do? I have the same problem with mac mini e mac book air. Please help me!

    Your advice did not help me. I also installed 10.7.4 combo but the situation is the same.
    my internet connection is ok, mail is ok, but app store after 3 resets does not recognize my ID and it says "connection is not possible". Why? I have the same problem in both my mac mini late 2009 and mac book air 2010? Is it a problem of 10.7.4 update? I have to solve this problem and how can i return to 10.7.3 if my last backup was not with 10.7.3???thank you for your kind collaboration...

  • Having problems with ipad mini and Siri. Works sporadically, will work once and then the second time not. Worked all the time with the original Mailbox app. Then started doing the same thing when I installed the new update so wondering if it is software?

    Having problems with ipad mini and Siri. Works sporadically, will work once and then the second time not. Worked all the time with the original Mailbox app. Then started doing the same thing when I installed the new update so wondering if it is software?

    Hi,
    I have the check box on a second Partition  but not on the Time Machine one
    I forget what I did now to get this called "Recovery HD"
    For the rest try https://discussions.apple.com/docs/DOC-4055  User Tip that links to Pondini's work on Time Machine.
    10:17 pm      Friday; May 2, 2014
    ​  iMac 2.5Ghz i5 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • Having problem with iPad mini retina connecting to cellular data. Any body else.

    Having a problem with iPad mini connecting to cellular service. Anybody else?

        Hey there nemesyssoft!
    Congrats on the new iPad! It's a great device! We certainly want you to be able to use the device as soon as possible. If I may ask, were you still having issues connecting to the data network at all? Activation can take be a bit longer the initial time. Please let us know if you still need assistance.
    Thanks!
    MichelleG_VZW
    Please follow us on Twitter @vzwsupport

  • Aduio problems with the mini!  help!

    I have serious audio problems with my Mini right now -- Please Help!
    When I play iTunes, iPod, etc. I hear very bad static, and start and stops; like its an audio feed from the radio, a scratchy audo feed, that pauses.
    At first i thought it was the old speakers that i run through the old display; but I plugged in Bose headphones to the mini itself and got the same bad, sound. this just started, can anybody help? thanks.

    Check your Audio/MIDI Setup, making sure that your audio out settings are for 44.100khz, 2ch-16bit. I've seen some apps that arbitrarily change it to 1ch-8bit, which can cause the poor sound you're describing.

  • Problem with index of numbers in BSP Front end

    Hello All,
    I am facing the below problem. Request your help.
    Scenario: When I am trying to add the projects in the Front end , I am facing the problem with the index of numbering of the projects.
    Example: If I am adding 6 projects ( at the max only 4 on each page i-e there are 2 pages ), then the index is wrongly numbered and the arrow (for direction of the pages) are wrongly displayed. The direction of the arrow is pointed to the next page rather pointing to the previous page and the index of numbering of the pages is wrong.
    Request you to please suggest if this is any code fault in the table maintainance activity in the backend (BSP).

    Hi Irina,
    If you mean the number range is skipping 10 numbers in between runs then its because of the buffering in the number range.
    To avoid the buffer influencing the number range, pass
    'X' to the function module parameter: IGNORE_BUFFER.
    This should resolve the problem.
    Cheers,
    Aditya

  • Mighty Mouse Tracking Problems with Mac mini core duo

    I have a new Mac mini core duo (2GB RAM, 100GB HDD) and I'm having problems with my USB Might Mouse.
    The cursor stutters and doesn't track with the movement of the mouse and it will sometimes leap to a different part of the screen or get stuck at the last place it rested. At other times the mouse will track smoothly for a while before starting to stutter again. The behavior isn't consistent.
    Is anybody else having tracking problems?
    Any thoughts on what might be causing this behavior?
    iMac G5 20 & Mac mini 1.42Ghz, PB G4 1.67Mhz, Mac mini core duo   Mac OS X (10.4.6)  

    Hmm, this could be one of two things. Your mac might be faulty (Harware wise) which would suck. But, hopefully it is a problem with your drivers that need updating. Try these 3 options.
    1. Update you mouse driver.
    2. Update you video card driver (Video cards can sometimes affect mouse sensitivety -don't ask why)
    3. This is my last solution, before consulting a technician (For money if you can do it free talk to one!) or returning your mini: Try reformating/reinstalling Max OSX and if u have bootcamp check out wat happens to the mouse in XP check for the same problem if it doesn't happen in XP your hardware is safe. IF the problem continues after this... looks like your hardware is bad in that case i recomend a return or send back (If your on warranty).
    GOod luck,
    Wannabe

  • Problem with applescript for Numbers

    I am new to Applescript and am haveng problems with what seems to be a pretty simple task.  I want to check the value of each cell to test for a certain condition and then based on the results increment another cell.  I keep getting the following error:
    error "Numbers got an error: Can’t make {4, 5} into type integer." number -1700 from {4, 5} to integer
    Here is my script:
    tell application "Numbers" to tell document 1 to tell sheet "Sheet 1" to tell table "Table 1"
              set fNineStart to 4
              set fNineEnd to 12
              set bNineStart to 14
              set bNineEnd to 22
              repeat with irow from 8 to 40
                        set skinscount to 0
                        repeat with jcol from fNineStart to fNineEnd
                                  set minscore to value of cell (jcol & 5)
                                  if value of cell (jcol & irow) is equal to minscore and the value of cell (jcol & 6) is equal to 1 then
                                            set skinscount to skinscount + 1
                                  end if
                        end repeat
                        set the value of cell (27 & irow) to skinscount
              end repeat
    end tell
    Here is the spreadsheet:
    Name
    1
    2
    3
    4
    5
    6
    7
    8
    9
    Front
    Nine
    10
    11
    12
    13
    14
    15
    16
    17
    18
    Back
    Nine
    Total
    Net
    ESC
    score
    Skins
    Par
    4
    4
    4
    5
    3
    4
    5
    3
    4
    36
    4
    5
    3
    4
    5
    3
    4
    4
    4
    36
    birdie
    3
    3
    3
    4
    2
    3
    4
    2
    3
    27
    3
    4
    2
    3
    4
    2
    3
    3
    3
    27
    eagle
    2
    2
    2
    3
    1
    2
    3
    1
    2
    18
    2
    3
    1
    2
    3
    1
    2
    2
    2
    18
    low score
    3
    4
    4
    3
    3
    4
    5
    3
    4
    4
    4
    3
    4
    5
    3
    4
    4
    4
    # of people with min.
    1
    3
    1
    1
    1
    2
    4
    1
    2
    16
    2
    1
    2
    3
    3
    2
    1
    4
    2
    Skins
    HCP
    Joe
    y
    3
    3
    4
    5
    5
    3
    4
    5
    4
    5
    38
    5
    5
    4
    4
    5
    3
    4
    4
    5
    39
    77
    74
    Bill
    y
    7
    5
    4
    5
    5
    4
    4
    5
    4
    4

    Hi fairchild.bill,
    Real experts will I hope chime in, but I think one problem is the way you are referring cells:
    Instead of:
    value of cell (jcol & irow)
    I think you need to use something like:
    value of cell irow of column jcol
    And
    value of cell jcol of row irow
    Studying examples of scripts for Numbers 3 at macosxautomation.com may give you some ideas on this.
    SG

  • Synching problems with pages and numbers

    After an initial problem with synching which was resolved with Yosemite Pages and Numbers have been synching across all my devices for a couple of weeks and now all of a sudden they have stopped again!! They synch across my phones and iPad but not to my macbook pro!! Very very annoying! How do I resolve it?

    Found a solution, but it is odd:
    On the 2008 Mac Pro, I UNCHECK the boxes beside Pages and Numbers in System Preferences > iCloud > iCloud Drive > Options. Now Pages and Numbers will properly save edited documents to the appropriate folders on iCloud Drive.
    Go figure ...
    Hope that this helps someone else.
    Jon

  • Problem with mac mini 2012 connection

    Hello!I have a problem with my mac mini 2012 connection!The hdmi to hdmi connection working great at my mac mini!The thunderbolt(mac mini) to hdmi (display) is not working!But when i have the hdmi to hdmi cable and the thunderbolt to hdmi at the same time (my display have two hdmi output) works fine!!But when i unplug the hdmi to hdmi cable stop working the thunderbolt to hdmi!!Any solution for that??I want only the thunderbolt to hdmi connection!!

    Whew, never heard of this problem yet!?
    Is it possible the TB->HDMI is set to mirror the HDMI->HDMI screen?

  • Problem with Mac Mini and Panasonic PT-AE700 projector

    I just bought a brand new Mac Mini and intended to connect it through hdmi to my Panasonic PT-AE700 projector (with a 10 m hdmi-hdmi cable and a dvi-hdmi adapter). However there is no signal recognized by the projector.
    Any suggestions? I have tried with two different dvi-hdmi adapters between the Mini and the cable. Both work fine with my MacBook Pro, but with the Mini there is no signal.
    Mac Mini   Mac OS X (10.4.7)  

    Thanks again BSteely for your answer.
    Unfortunately I still haven't been able to get anything out from the projector through HDMI.
    However, I've found someone with a similar problem. It seems the problem is the lenght of the HDMI cable (which in fact is closer to 15 m than 10 m). HDMI is designed to handle at least those 10-15 m runs, but the problem seems to be DVI, which is only capable of something around 5 m. Since I'm converting from DVI to HDMI, I'm subject to DVI's limitations. And the MBP seems to have better capability of handling the weaked signal than the Mini.
    Read more: http://www.avsforum.com/avs-vb/showthread.php?t=712218
    Gefen should have an amplifier (HDMI Super Booster) that could solve the problem. I just ordered it to see if it could help in strenghtening the signal and solve the problem for me.
    Read more: http://www.gefen.com/kvm/product.jsp?prod_id=2939
    If someone has any experience from the booster, please let me know.

  • Problem with opening a Numbers document

    I have a problem with a Numbers document, which I created 3 weeks ago and step by step extended with additional functionality. I'm not anymore able to open the document. I can rename the document and maybe - I didn't try - delete the document. But when I'm clicking on the file's icon, the error message appears "Tabelle kann nicht geöffnet werden". It seems that the file is defect but how I it be revived. What steps I have to do to re-open the document?

    Check out that thread if you find it helpful. There are some cool ideas there.
    Adding a font to pages for Ipad

  • RMDATIND uploading problem with external material numbers

    Hi,
    I'm using LSMW direct input program RMDATIND (Object:0020 Method:0000) for creating materials.
    I have a problem with uploading materials which have two types of external material numbers.
    For example one material number is 1111-333 and then we have 10000000. The problem is that direct input won't create materials with number 1111-333 though it's possible to create them manually. It works fine with material 10000000.
    Does anyone know how fix this issue?

    Sweth123 wrote:
    Hi Guys:
    >
    > Clicked check box External number assignment without Check., When I am creating a material (mm01) with only numeric characters it is giving me an eror message saying for this material type Numeric characters are not allowed.
    >
    > i should be able to create a material with external number range and it can be numeric or alpha numeric?
    >
    >
    > Thanks
    > Sweth
    Hi,
    go to the path Define Number Ranges for Each Material Type click on maintain groups & select the materila type & select the mouse on material type & click on maintain after that maintain the number ranges.
    for ex: from 300000000 to 399999999 internal no.range
                from A                to ZZZZZZ     external no.range
    from this u can able to create a material with external number range and it can be numeric or alpha numeric
    Regards
    Raj.

  • Problems with iPod mini in iTunes 7

    I recently installed iTunes 7.0.1.8 on my PC and have been having problems with my iPod mini (Windows format, software version 2.6.1). Initialy I could not see the iPod in iTunes but I followed the advice in a support article to change the Startup Type under Terminal Services Properties to "manual" which seemed to work.
    However now new music that I have purchased will not transfer because it says that my iPod software is too old; but the Update button on the Summary tab in my iPod Preferences is greyed out - help?!
    Dell Latitude D610   Windows XP  

    Dude I Dont Know What To Do.. I Have Done Like Everything That apple.com/support Said To Do.. I Just Cant Get The **** Thing To Work.. Its Been Plugged In To My Laptop Since About 6pm And Its Now 132 Am And I Still Cant Use It, However It Does Turn On.. First Screen Is The Black Background With The Apple.. Than It Opens To The Menu For Music Videos Photos Settings Ect.. Than To A Grey Unlit Screen With A Battery With One Bar And A Lightening Bolt Through It.. Not Blinking Not Doing Anything.. And Last It Will Tell Me Batt Low Plug In Yadda Yadda Yadda.. Do You Know A Trick?

Maybe you are looking for

  • Can't extend my desktop

    I'm using a G4 laptop and want to use a second monitor as an extended monitor. But all I can get is a mirror of my laptop LCD. There's supposed to be a button that says "arrangement" that allows extending, a friend says, but no such button appears on

  • Oracle 11G javaw Universal Installer error

    Hey all, I'm trying to install Oracle 11G on XP Pro and I'm having all sorts of problems. I downloaded the complete installer: <b>Oracle Database 11g Release 1 (11.1.0.6.0)</b> and I receive the following error when I attempt to install: <b>The Java

  • ActionCommand and getSource() are not enough

    Hi, I have a question about the basic concept of event-handling in Java. I'll illustrate my problem by example. Suppose my program contains two classes, i.e Main and GUI, whereas MainClass implements ActionListener. The action takes place on a JPanel

  • Integration of ADF with Vignette(Content Management Tool)

    Hi Is it possible to integrate ADF with vignette(Content Management Tool) in any way so that i could have the power of both the tools in developing web pages and managing the contents of it in a better way?

  • Handbuch Adobe photoshop elements 8

    Wer kann helfen, bin Anfänger. Wo finde ich ein Hanbuch zur Version 8?