Problem with doing an average

I wrote this code tonight, the sum, max and min work but I can't compute the average. Secondly, I using 0 to stop the loop, but I would like to use Q how would i do that?
Int x = 1;
double total = 0;
int max = 0;
int min = 0;
double sum = ( total/ avg);
String Q;
String input;
while (x!=0)
System.out.println ("Enter a number ( or Q to quit): ");
Scanner scannerObject = new Scanner(System.in);
input = scannerObject.nextLine ();
x = Integer.parseInt(input);
total = total + x;
avg = (avg + 1);
if (max < x)
max = x;
if (min > x)
min = x;
and then of course some output giving min, max,avg and sum.
Thanks for the help,
Will

Do you know how to calculate an average? a + b + c / 3. What is your code doing? It is adding one to avg each time the user inputs something. This is a counter not the average.
To exit the loop using "Q" then you will need to compare the user input to "Q".

Similar Messages

  • Problem with doing bus to Aux/live rack unit sends

    Hi all,
    Just recently bought a compressor and a Spring Reverb... both rack units (not plug ins).... both with (1/4'') IO.
    My plan was to do a Bs send to an Aux. that utilized the IO plug in (routing a send and return to one of my new units). There after, I was hoping I could use the Bus send on the audio source track to send to the Aux/effect and then have a blend of dry and effected signal overall.
    I think I missing something because with both units I have and issue where I hear a very unpleasant double sound and I'm fighting feed back... this is the case if I put the IO plug in on the source track and the Aux... so I figure that's where my problems lies...
    Can anyone see what I might be doing wrong?
    Huge thanks for any help.
    Best,
    Ben

    Why do you put the IO on both tracks? I would use it solely on the aux track.
    Eddie

  • Problem with doing Cleansw

    I can't find the CTZAPXX.EXE program on my cd.
    (I have SBLi've! Value)
    So I looked in my Programs files and found it.
    But it wouldn't run and clicking it with the mouse restarted my computer.
    Then I found this CTUninstal.
    This is what popped up:
    <IMG src="http://img.photobucket.com/albums/v6/chocolatina23/ct.jpg">
    The instructions say to Select Dricer Un-installation for WDM drivers and click OK.
    I don't know which/what that is. Help please.
    I'm doing this because my sound doesn't work. I did the Diagnostics test and wave was the only one that didn't work. My System said that all the drivers were working perfectly. But I can't here Windows sounds nor sounds on the net. But I can hear stuff on my media players.

    Well I have a different sound card than you but the CTZAPXX.EXE program is located on my installation CD under: Audio/Drivers
    In any case, The WDM drivers would be the Windows Drivers.Message Edited by Russ on 03-29-2005 09:58 PM

  • Any problems with doing form

    Because I change songs on my MuVo TX FM fairly frequently, I'm tempted to format the device every few days to "clean it up." Does that do any...any...harm?

    WOW every few days? ummm isnt that a little toooooooo much. usually one or every other month will do but wow. uhh no it wont do harm but like dont you get tired of doing it's also instead just to a disk cleanup itll clean up the cah and junk files and junk. but formamting every few days is too much.

  • Any problem with a single MySQL database used on more than one site?

    I have a set of multiple sites hosted separately I'm working on. I'd like to set up a PHP/MySQL database on one site, and be able to pull data from it for completely separate sites. Seems like it shouldn't be a problem. Are there any problems with doing this I need to be aware of?

    I've set up databases on three different hosts, and in all cases I could access the databases from outside the domain of the site itslef.  GoDaddy is one of them, they used to restrict it, but now they give you the option when setting up a new database on your account.

  • I have a little problem with recursion.

    I have a HashMap, and I've written a method to fill it up recursively. The map size is 20.
    void fillMap(HashMap map)
    if(map.size()==20)
       return;
    //Code to fill up map
    System.out.println("Map size = " + map.size() );
    fillMap();
    }Output is like:
    Map size = 1
    Map size = 2
    Map size = 3
    Map size = 19
    Map size = 20
    Map size = 1
    Map size = 2
    and so on.
    Is there a problem with doing: if(map.size()==20)
       return;?

    yeah that was a typo.. my actual code seems to be fine that way.
    And it wouldn't compile unless I had a fillMap(*no value*) method either, right?
    I still don't get what is wrong. Here's some new code
    public class CustomMap extends HashMap
         public CustomMap()
              super(new HashMap(20));
              fillMe();
         private void fillMe()
              Object key;
              Object value;
                    if(size() == 20)
                   return;
              //--bunch of code here to determine the key and value
                    //-- I have it so no key and no value are the same, by the way
              put(key, value);
              System.out.println("Size: " + size());
              fillMe();
    }

  • Problems with Macbook after Software Update

    I haven't updated my Macbook in a long time, so I decided it was time I probably did. Software Update had updates for iTunes, Quicktime, and a 2009-Security Update. Everything seemed to be going okay. After the downloading and installing finished, it said the Security Update couldn't be installed and moved it to the trash. Then it prompted me to restart my computer because the other two installed okay.
    After restart, when my computer started back up, my Macbook is messed up. The doc is missing. I open a finder window, and it shows the main folders, but all the things on the right (where it shows the drive, applications, and such) is missing. I tried to back up my files, but it can't even read there is a blank disc inserted (keeps asking me to insert a blank disc). And it wont let me shut down my computer, or restart it. I click restart, and it seems like it accepts it, but it just doesn't do anything. The dashboard wont show up when you hit F12. This mac is all messed up.
    I don't know what happened here, all I installed was iTunes and Quicktime from the Software Update (security update didn't install), and all this happened. Any idea what happened and how I can fix this?
    I'm using Mac OSX Tiger 10.4.11.

    Welcome to Apple Discussions.
    There's a variety of things you could try, but first as to why it is doing this. Probably your drive was slightly corrupted. If it was minor you might not have noticed it, but when the updates tried to install, the whole thing compounded and led to a whole bunch of things missing.
    First, try to repair your drive. Boot from the System installer disc that came with your computer or is the one for the version you currently have on there, select language if applicable, choose utilities, run Disk Utility and verify (and repair if necessary) the drive. You can verify a drive from DU on your main drive while booted but I have found this can result in incorrect reporting of errors. To repair your drive you have to run it from a drive other than the boot drive anyway.
    Next, boot from your drive in [Safe Mode|http://docs.info.apple.com/article.html?artnum=107393] and repair permissions. You can repair permissions while booted from the installer disc but this uses the permissions configuration on the installer disc which may be out of date if you have run any updates on your computer. Booting your computer to Safe Mode restricts the number of things running on your computer while permissions are being run and does a bit of spring cleaning at the same time.
    Reading
    [Resolve startup issues and perform disk maintenance with Disk Utility and fsck|http://docs.info.apple.com/article.html?artnum=106214]
    [Using Disk Utility in Mac OS X 10.4.3 or later|http://docs.info.apple.com/article.html?artnum=302672]
    [Disk Utility's Repair Disk Permissions|http://docs.info.apple.com/article.html?artnum=25751]
    +Summary of above from BDaqua+ (couldn't have said it better):
    "Try Disk Utility
    1. Insert the Mac OS X Install disc that came with your computer (Edit: Do not use this disc if it is not the same general version as what you have currently on your computer, e.g. use a Tiger disc for a Tiger drive, not a Panther disc), then restart the computer while holding the C key.
    2. When your computer finishes starting up from the disc, choose Disk Utility from the Installer menu. (In Mac OS X 10.4 or later, you must select your language first.)
    Important: Do not click Continue in the first screen of the Installer. If you do, you must restart from the disc again to access Disk Utility.
    3. Click the First Aid tab.
    4. Click the disclosure triangle to the left of the hard drive icon to display the names of your hard disk volumes and partitions.
    5. Select your Mac OS X volume.
    6. Click Repair. Disk Utility checks and repairs the disk.
    Then Safe Boot, (holding Shift key down at bootup), run Disk Utility in Applications>Utilities, then highlight your drive, click on Repair Permissions, reboot when it completes."
    Report back after you have done this. It may be that you have to use a more powerful utility such as Diskwarrior.
    Once the drive is repaired you can try re-applying the two updates, though often it takes a full archive and install, plus re-application of all updates, to get everything working again.
    [Mac OS X: About the Archive and Install feature|http://support.apple.com/kb/HT1710]
    [Apple document about A&I in Tiger (10.4)|http://support.apple.com/kb/HT1545]
    [X-Lab Archive and install|http://www.thexlab.com/faqs/archiveinstall.html]
    [Kappy's A&I instructions|http://discussions.apple.com/thread.jspa?threadID=1823034]
    *In most cases _make sure_ you select "Preserve Users & Settings"*
    Finally, on updating:
    Updating
    Certain steps appear to minimize the risk of an update producing problems.
    Number one is to make sure you have a bootable clone backup of your computer in case you do need to back out of it again. This is the only guaranteed way of not having to worry about the results of an update.
    Some like to boot from their installer discs or an external backup and verify (and if necessary repair) their internal drives as well as drive permissions. This is done with Disk Utility. You can verify a drive while booted from the same drive but sometimes this produces spurious errors. Repairing a drive (if necessary) has to be done while booted from another disk.
    [Resolve startup issues and perform disk maintenance with Disk Utility and fsck|http://docs.info.apple.com/article.html?artnum=106214]
    [Using Disk Utility in Mac OS X 10.4.3 or later|http://docs.info.apple.com/article.html?artnum=302672]
    [Disk Utility's Repair Disk Permissions|http://docs.info.apple.com/article.html?artnum=25751]
    You can also go to the step of booting into safe mode to do the install.
    [Mac OS X: Starting up in Safe Mode|http://docs.info.apple.com/article.html?artnum=107393]
    [What is Safe Boot, Safe Mode? (Mac OS X)|http://docs.info.apple.com/article.html?artnum=107392]
    [Safe Boot takes longer than normal startup|http://docs.info.apple.com/article.html?artnum=107394]
    I like to download the update onto my computer and install it from there rather than let Software Update do it. I know a few people who had problems with doing the update via software updater found a manual install to work.
    Repair permissions again afterward.
    It helps to only install one update at a time and to run the computer for a while to make sure it is behaving well.
    The more cautious even like to unplug third party peripherals (see [comment by BDaqua|http://discussions.apple.com/message.jspa?messageID=9040746#9040746]).
    Almost all of the above steps (except backup) have been questioned (e.g., [Permissons repair|http://www.macworld.com/article/52220-3/2006/08/repairpermissions.html] as to necessity. Probably many people have done successful updates without doing them. I say they can't hurt, they can very likely do good (especially if your computer isn't regularly maintained), so why not do them to be safe?
    [BDaqua's comments on updating problems|http://discussions.apple.com/message.jspa?messageID=8948595#8948595]
    [Baby Boomer's comments on updating problems|http://discussions.apple.com/message.jspa?messageID=9025760#9025760]
    [Klaus1's post on updating and removing updates|http://discussions.apple.com/message.jspa?messageID=10257902] and [another one|http://discussions.apple.com/message.jspa?messageID=10402175]

  • Possible Problem with Save for Web and Devices?

    II've come here to the forum for some insight on why a gif file created by save for web and devices command is not showing up as an image in an uploading dialog box for my website.  I'm buildiing my website with word press and a custom freelancer theme.  I've created a customized header with Illustrator and have been saving the file with the save for web and devices command.  Once I have my gif file, I go to my theme uploader and try to upload the gif image and place it on my homepage.  I've not had any problems with doing this until yesterday, when I tried to upload an updated file.  What usually happens is that the thumbnail image shows up in the dialog box, I select my options, and click insert.  But what's started happening yesterday is that the thumbnail does not show up, unless I click on edit image.  This makes no difference, as when I click insert and go to my homepage and refresh it, the header doesn't show up.  I've tried working with the developer of the theme to resolve this problem and so far we've not found a solution.  I've tried to upload the header with different file types: jpg, png, tiff, but they don't work.  I thought I'd come here to see if anyone might have some suggestions.  The problem may not be with Illustrator's save for web and devices, but I thought I'd give this forum a shot.  Thanks for any and all respones. :[

    CT,
    If you can see and open the GIF/whatever (with any viewing application), the Illustrator Save for Web&Devices works. If not, you may ask about it in the Illustrator forum:
    http://forums.adobe.com/community/illustrator/illustrator_general?view=discussions
    If the image is there, to have the issue solved quickly, I believe you should ask in a forum covering the web building application.

  • Intermittent problem with TestStand calling CVI DLL calling MSCV DLL

    Sorry about cross post, but I am not sure which group is best to address
    this issue.
    Setup:
    Windows 2000 SP1
    TestStand 2.01f
    CVI 6.0
    MSVC++ 6.0 SP5
    Problem:
    I have a CVI Test Library DLL that contains test functions called by
    TestStand using the C/CVI adapter. The CVI Test Library DLL in turn makes
    several calls to another DLL written in MSVC++. I am experiencing an
    intermittent problem with one of the MSVC functions. The problem ~appears~
    to be stack related, but I am not sure. Among other things, this MSVC
    function accepts a const char * argument that is a TestStand lookup string.
    The function uses this string to access the TestStand API.
    What happens is this: Everything works fine. I then recompile the CVI DLL
    after making some mod, then run. The MSVC++ DLL asserts that the const char
    * arg passed by the CVI DLL is NULL. However, this is not the case if I
    single step through the CVI code. It has happened both with passing
    variables as the const char * argument and as hardcoded strings literals, so
    its not that I am actually passing NULL. The other argument to this
    function is the TestStand sequence context dispatch pointer (LPDISPATCH
    pobjSequenceContextDisp) and it always ~appears~ to be passed correctly.
    The problem is frustrating and hard to debug because I can not
    deterministically reproduce it. The problem ~never~ appears when I debug my
    MSVC++ DLL in Visual Studio. And it only occasionally appears otherwise.
    The problem, when it appears, always appears on the first run after
    recompiling the CVI DLL, though the problem does not happen after ~every~
    recompilation. I'd say it happens 1 in 6 times after a recompile.
    Recompiling the exact same code does not always make the problem disappear.
    If I change the CVI code (code that has nothing to do with the argument
    itself though) and recompile the problem almost always goes away. Selecting
    'Mark all for compilation' and rebuilding does not make the problem go away.
    Only tweaking the CVI code and recompiling does (usually).
    Whats more, the problem appears:
    * With the CVI DLL built as Debug or Release mode.
    * With the CVI default calling convention set to __stdcall or __cdecl.
    * With the C/CVI TestStand adapter set to run in-process or external
    instance of CVI.
    The problem appears to be some sort of stack or argument passing problem
    between CVI and MSVC, though thats just a guess based on the symptoms. I
    have quadruple checked the calling conventions of all declared functions.
    The CVI DLL functions all use TX_TEST (which resolves to __cdecl). The MSVC
    DLL functions all explicitly use __stdcall. Is there a problem with calling
    __stdcall MSVC functions from a __cdecl CVI function?
    I can find no other memory leaks or indications of memory corruption
    elsewhere in either the CVI or MSVC DLLs. Its only this one function that
    exhibits this strange 'null const char *' problem.
    Can anyone offer any ideas about what may be causing this problem? Anything
    else I should check/verify?
    Regards,
    Joe

    Silvius,
    > Although I'm not sure if any of the following are the real cause of
    > your problem, I have the following suggestions:
    Thanks for the reply. At this point any and all suggestions are welcome...
    > 1. There could be a problem with calling
    > __stdcall MSVC functions from a __cdecl CVI function. As a workaround
    > wrap the _cdecl call inside a _stdcall call that is exposed or
    > exported to TestStand or vice-versa. This can be a problem because if
    > _cdecl is used, the calling function is responsible for cleaning up
    > the stack and if _stdcall is used, the called function is responsible
    > for cleaning up the stack.
    I was under the impression that as long as everything was explicitly and
    consistently declared, you could safely mix cdecl and stdcall f
    unction
    calls. Is it bad to do this? Is this a known issue with the CVI compiler?
    I've never seen a problem with doing this under MSVC++.
    I'll try wrapping them in cdecl calls for CVI - though we have a
    depressingly large number of stdcall functions in the MSVC DLL ;-). They
    need to remain stdcall in the DLL because we also call them from Visual
    Basic.
    > 2.Don't mix Debug version of one DLL with the Release version of the
    > other DLL. I had some bad experiences doing this and both DLLs where
    > developed in MSVC. Allways use either Debug either Release versions of
    > DLLs.
    I verified that the MSVC DLLs were either ALL Debug or Release. I too have
    seen nasty problems when MSVC Debug and Release is mixed.
    One thing I had not thought of until your reply: What about mixing CVI Debug
    DLLs with MSVC Release DLLs? Have you ever seen issues with doing this?
    Thanks!
    Joe

  • Is anyone having problems with the battery heating up and draining the power?  Mine has been doing this for about 2 months now.

    Is anyone having problems with the battery heating up and draining the power?  Mine has been doing this for about 2 months now.

    This is a major problem with Lollipop, but yo said it started 2 months ago.   Several people have fixed problem by removing FaceBook And Face book messenger and then re loading the apps again.   You might want to clear your cache before reloading.  Not sure this is your problem, but worth a try.  Good Luck

  • Problems with compressing  files with right hand click. it does not work.

    Problems with compressing files with right hand click.
    I am using the compress function in the Mac OS (File > Compress XX) from time to time. Today it does not work anymore. OS 10.5.6
    I get a message: The content list cannot be created for compressing.
    I tried it with files and folders and keep getting this message. Anybody any idea as to how to fix this

    Thanks I love my macbook!!!!
    I also got further problems such as copy-paste not working etc.
    so I fixed it just this morning by running Applejack 1.5 and am back up running noticing your post.
    thanks for helping though!

  • Having a problem with Firefox using Hotmail email. Inbox - as checking messages it freezes up or a 1 item window follows cursor and does not allow you to enter

    I am having a problem accessing Hotmail email messages via Fireflox server. When I am in the Inbox, reviewing messages, it either freezes up or a "1 item" small icon window follows cursor and does not allow me to enter messages or do anything. Have to log off and start over. Suggestions>?

    Can you detect any pattern to it, whether related to messages with attachments, or particular advertising on the page, etc.?
    When you have a problem with one particular site, a good "first thing to try" is clearing your Firefox cache and deleting your saved cookies for the site.
    1. Clear Firefox's Cache
    orange Firefox button ''or'' Tools menu > Options > Advanced
    On the Network mini-tab > Offline Storage : "Clear Now"
    2. If needed, delete the site's cookies here
    While viewing a page on the site, right-click and choose View Page Info > Security > "View Cookies"
    (Usually the dialog will refer to live.com rather than hotmail.com, that's normal.)
    Then try reloading the page and logging in again. Does that help?

  • Is there a problem with FaceTime, can not connect. When dial it connects and drops. When friends are calling me they have calling message and I have connecting but it does not connect. Need help, face time is my life line.

    Face time not working. When dialled it says connecting and drops immediately. When my friends calling it show connecting but it does not.
    Is there a problem with face time. I am in south Africa, it was working perfectly up to Easter. Please help this is my life line.

    There is a barely acknowledged issue. For Mac users Apple has released an update to the app, but for iOS users the recommendation is for users to update their ipad to the most recent operating system.
    There may be a fix coming for iOS6 users (which seem to be many of those having problems) or there may not be. If your ipad isn't up to date then you can update it and see if that helps, or if you don't want to update then you may want to wait and see if there is either a fix or if it fixes itself.

  • I am currently using Lightroom 5.6 and operating on a Mac with OSX Ver 10.9.5. I am receiving an error problem when doing the following -  I am exporting selected photos from a particular Catalogue saved on Drive 1 to a folder created on another Drive whe

    Hi, I am having a little trouble with exporting images to another drive and Catalogue and need some help if anyone can give me some advice
    I am currently using Lightroom 5.6 and operating on a Mac with OSX Ver 10.9.5.
    I am receiving an error problem when doing the following -
    I am exporting selected photos from a particular Catalogue saved on Drive 1 to a folder created on another Drive where a Lightroom Catalogue has been created. In this Catalogue I have arranged for the images once exported to be moved to a different folder - I used the Auto Import process under the File dialogue box.
    When processing the Export I receive an error message for each of the images being exported indicating the following -
    Heading Import Results
    Some import operations were not performed
    Could not move a file to requested location. (1)
    then a description of the image with file name
    Box Save As                                  Box  OK
    If I click the OK button to each image I can then go to the other Catalogue and all images are then transferred to the file as required.
    To click the OK button each time is time consuming, possibly I have missed an action or maybe you can advise an alternative method to save the time in actioning this process.
    Thanks if you can can help out.

    Thank You, but this is a gong show. Why is something that is so important to us all so very, very difficult to do?

  • Problem with photoshop CS6 I have an imac intel 10.6.8...when I try to launch photoshop the icon bounces a few times then the adobe app manager tries to open then they both quit. they keep doing this over and over again but won't launch. worked fine for a

    problem with photoshop CS6 I have an imac intel 10.6.8...when I try to launch photoshop the icon bounces a few times then the adobe app manager tries to open then they both quit. they keep doing this over and over again but won't launch. worked fine for a few days after install.

    problem with photoshop CS6 I have an imac intel 10.6.8...when I try to launch photoshop the icon bounces a few times then the adobe app manager tries to open then they both quit. they keep doing this over and over again but won't launch. worked fine for a few days after install.

Maybe you are looking for

  • SB Live 24 + CD rom = Problem, please help

    Im using P4 2.4 ASUS MB (Via chipset VT8237)256MB 60GB HD52x Asus CDromSB Li've 24 bitHard disk is primary IDE, CD rom is secondary IDE masters I have used old creative and Ectiva sound cards very wel in last years. I gat a SB Li've 24bit new card. I

  • Can't get actionscript to work

    I'm very new to flash and I've watched many tutorials and I'm pretty  much doing exactly as I've seen others doing, but mine won't work.  I'm  trying to build an application that serves as a header for a website.  I  want there to be animations by th

  • JSP Requirements

    Hi, I'm developing an j2me application with natural interaction. My application needs to use jsp pages with xml to adquire parameters and that way read them to the user. If I only use xml it works ok, but when I embed java code on xml it doesn't work

  • Oracle Forms&Reports certification - choose the right path

    Dear professionals, I'm Oracle Forms and Reports developer for about 10 years. Now, I'm on the way to become Forms and Reports certified professional (either to be Forms Developer Professional or Oracle Fusion Middleware 11g Forms Developer): https:/

  • E-filing of TDS

    Hi guru what are the process to be followed in e-filing of tds in sap. Thanks shivaji