I don't understand what is going on here

I must be retarded because this is simple - a line is scanned - it's parsed into an integer and it's supposed to go through some if/else statements and change my variables based on what my input is -
Everything works up to the if else statements - but I can't for the love of all that is holy understand why it keeps outputting the place holder values and not the manipulated values - eh, here's my code.
I've been trying an input on 12 which should yield max int = 12, pos count = 1, neg sum = 0, odd sum = 0 but it only gives 1, 1, 1, 1
import java.util.Scanner;
public class Assignment2
     public static void main(String[] args)
          Scanner scan = new Scanner (System.in);
          String booger, numStr;
          char delim=' ';
          int stringLength,firstIndex,nextIndex,maxInt=1,oddSum=1,negSum=1,posCount=1,load=1;
          String test = "12"; // delete when done
          int numTest = Integer.parseInt(test); // delete when done
          String result = ("The maximum integer is "+maxInt+"\nThe sum of the negative "
                              +"integers is "+negSum+"\nThe sum of the odd integers is "
                              +oddSum+"\nThe count of positive integers in the sequence "
                              +"is "+posCount);
          // User input
          System.out.print("Enter any number of integers, enter 0 to ignore further input: ");
          booger = scan.nextLine();
          stringLength = booger.length();
          firstIndex = booger.indexOf(delim);
          nextIndex = booger.indexOf(delim, firstIndex+1);
          if (booger.length()==0)
               System.out.println ("\nUser failed to input!\n");
          else
               if (firstIndex == -1)
                    load = Integer.parseInt(booger);
                    if (load==0)
                         maxInt=0;oddSum=0;negSum=0;posCount=0;
                         System.out.println("\n"+result);
                    else
                         if (load>0)
                              maxInt=load; posCount=1; negSum=0;
                              if (load%2 !=0)
                                   oddSum=load;
                                   System.out.println("\n"+result);
                              else
                                   oddSum=0;
                                   System.out.println("\n"+result);
                         else
                              if (load<0)
                                   maxInt=load; posCount=0; negSum=load;
                                   if (load%2 !=0)
                                        oddSum=load;
                                        System.out.println("\n"+result);
                                   else
                                        oddSum=0;
                                        System.out.println("\n"+result);
}

Java does not dynamically change your variables.
int x = 10;
int y = x;
x = 50;At the end of this code y will still be 10 even though the value of x has changed. That is what you are doing. You initially assign some value to result but then it never changes even though some of the other variables in the code have been changed.

Similar Messages

  • I don't understand what is going on

    I sold my curve2 and got a new torch1, i don't understand what is happening. I see the contacts of the person using the curve2 now, and he changes my dp and display name. I tried creating a new BBID but its still the same.
    Solved!
    Go to Solution.

    graceycutey wrote:
    No I didn't
    We should always perform a security wipe before transfering ownership . I assume the other person is using BBM 7 or higher in which everything is controlled by our BlackBerry ID and the current issue is only possible if  he is having the same BlackBerry ID as your's, Do you know that person ? 
    You can change your BlackBerry ID but you should first try to reset the password for your BlackBerry ID , Refer to this Knowledge Base to reset your BlackBerry ID password. 
    KB26361  :How to change or reset a BlackBerry ID password.
    Or change or Update the BlackBerryID from BlackBerry ID website :
    KB28060 : How to change or update a BlackBerry ID username on the BlackBerry ID website
    Click " Like " if you want to Thank someone.
    If Problem Resolves mark the post(s) as " Solution ", so that other can make use of it.

  • I am getting a warning sign related to console and a terminal box with _ both in my dock. There seems to be a log associated with this veing taken in fractions of a second. I don't understand what is going on. Can anyone help?

    I am getting a warning sign related to Console  (9y7:36) and a box with >- related to Terminal in my dock. Also when I click on terminal there is a heading "bash 80 X 24" after my name in favourites. Can someone give me any idea what this could be about? Thanks in advance.

    So far, you have described the standard Dock symbols for Console utility and Terminal Utility.
    If you did not deliberately add them to the Dock, something you did seems to have opened these two Applications so that their icons are showing on the Dock.
    That may be perplexing, but is not a cause for alarm.

  • Please Help! I don't understand what's going on.

    I'm almost at the end of my 30 day trial of lightroom. I like the program very much but there's one behavior that has me baffled. Lightroom doesn't always sync folders properly to reflect a RAW file that I've converted to TIFF or jpeg and saved to the same folder that the file originally resided in.
    one example.
    I opened a NEF file that I shot with the Nikkor 10.5mm fisheye lens in Nikon Capture to convert to a convertional (unfisheye) wide angle look. I save the file to the original folder as a 16 bit tiff. When I select the folder in Lightroom that I saved the tiff file to and do synchronize folder, the synchronize folder dialog box states that there are NO photos to add. I check the folder in the finder and the tiff file is there.
    I try the exact procedure again and this time the sync folder dialog box says that is one file to import and the file is properly imported into the Lightroom database and the file shows up in the Lighroom folder.
    Have other people had this experience.?
    Thanks in advance
    John Blake
    Lightroom 1.1 Mac OS 10.4.10 Dual GH G4 with 1.5GB of RAM

    tomrock
    Saving the file and changing the file name did the trick. Lightroom Properly synchronized the folder and the new file is in the database.
    Thank you!
    I guess Lightroom sees two files as being the same file if the only difference is the file's extension. I will have to save the derivative files in a different folder in order to be imported into Lightroom's database.
    I'm going to start a new thread about this
    John

  • HT201412 My iphone 4S switches itself off regularly. The battery is well charged,however. So I don't understand what's going on. Anybody got any idea. Thanks a lots

    My 4S keeps on switching itself off for no apparent reason. I've had to restore 3 times already. Does anybody have an idea ? Thanks

    I should mention it is ios 6.1.3. The phone has now also started, after rebooting, showing the signal bars next to the wifi signal icon at the top but no "Sprint" type next to the bars as usual. And then after a few minutes it shuts down, shows the black screen with the white apple in the middle for a few moments, comes back up with the Waiting for Activation message, the signal bars pop up and the whole cycle just repeats itself.

  • Can't Understand What's Going on Here

    I have a right-to-left, facing pages document I'm working on, the first 4 pages I've numbered with roman numerals, they won't be showing anyway so that's not important, the problem is I started new section numbering on the fifth page but when I do so it shows the fifth page to be on the right when in fact it is on the left?
    You can take a look at the image below, shouldn't it be saying: Introd1     iv, and not: iv     Introd1?
    The triangle for the new section is showing iv although the new section starts on page 5, mind you, if I actually double click on any of these two pages in the pages panel it will display the correct page, my headache is why it's showing them like that? Have I done somehting wrong in the master pages or something? Also, I can't figure out how to export these pages to PDF, it keeps refusing, saying I've entered the wrong numbers. I enter: Introd1-4, to try and print pages 1-4 from the Introd section, but it doesn't let me.
    Anyway, here's a screenshot, hope someone can help:

    Just to clarify further, it is only in the pages panel where this mistake is showing, and within the pages panel itself it is literally just the labels that are incorrect not the pages themselves, the icons for the pages are showing the correct page on each side. If I click on the left page it will show me the correct left page, same with the page on the right, just the labelling underneath for that spread is messed up. Also in the main application window, this problem isn't occurring in the page numbering, for example below you can see that the left page is selected which in the pages panel is labelled as 4 but which in actual fact is Introd1:
    But in the application window, it's displaying the correct page reference:
    I made an additional new section just to check further, but same thing:

  • I don't understand what's happening with my Music. All the songs that I purchased, that were previously on my phone, now show up a Cloud next to them, but I can't play them. If I touch the Cloud, it turns into a red square but never downloads.

    I don't understand what's happening with my Music. All the songs that I purchased, that were previously on my phone, now show up with a Cloud next to them, but I can't play them. If I touch the Cloud, it turns into a red square, acts like it's downloading (which I can see happening in iTunes), but never downloads. The Cloud just stays there.
    I've sync'd my phone, I've turned it to "show all music" in Settings, I've drag and dropped the songs/albums onto my phone again. I feel like I've tried everything I've seen recommended, but nothing works.
    I've purchased a lot of music from iTunes. It should be there. What's going on?
    P.S. Same thing happening with my purchased books. Ugh.

    Once you successfully add you iTunes library to iTunes Match, you go to Settings>iTunes & App Store on your iOS device and turn on iTunes Match.  Your iTunes Match library will then appear on your iOS device.

  • Trying to understand what's going on with my line!

    I wonder if someone could help me understand what's happening to my connection.
    I've been on adsl2+ for over a month (since being on a very stable adslmax connection). I'm on a long line 62db atten' and connected at 2890 - same as adslmax which I expected.
    A week ago my connection was reset ( I was unaware) and now connect at 2271 - noise margin is now 13db - always had a stable 6db with no drops.
    The thing I don't get is every time I reboot my router constantly syncs at 2271. Why would it do this? Previously it sync'd at different speeds.
    It's as if I'm now on a fixed rate - but still shows as adsl2+.
    Spoke to bt but they say I have noise on my line and it's in 'acceptable levels' - which it isn't!
    Just want to understand what's going on!
    Thanks

    since the recent software/hardware updates at certain telephone exchanges, when you reboot the router or turn it off constantly, the exchange you are connected to sees it as a fault, and drops your connection to the lowest level possible. your connection then has to physically be  reset by an engineer at the exchange.
    this is what hapenned top me. for the last 8 years i have been on bt, always turning my router off at night, when i had finished, or rebooting it if i had a poor line. since june, my connection speed have been abismal, i stopped at 2420 for about a month (half of that the month before) then over a weel, it dropped to as low as 340kbps - on a 20 meg line.  after going through the help desk, and "you need a new bt homehub router" event though i did not use theirs, phase, and 2 months of stress, i had an engineer come out on Saturday.
    He tested everything (my line is capable of 18.3mb connections). my line was reset ay 8124kbps downstream... 27 hours later, it is on 572kbps, so needs to settle in..allegedly
    to get over this, i am using a BTfon zone connection off one of my neighbours, as it is faster...technology - if you are on option 3, then sign up for it now, as things may get worse.
    welcome to the world of last wednesday week.
    there's now't wrong with 2 cans and a piece of string. at certain times, it is often faster.

  • My steam won't launch ever since I updated to Yosemite I don't know what is going on.

    Whenever I try to launch it, it says "Steam quit unexpectedly" I have tried redownloading it 5 times and have every software up to date. I also have tried
    deleting all my steam files and it still doesn't work. Here is a screenshot:
    I also downloaded a program called EtreCheck that checks for issues so here is what it found:
    Problem description:
    My steam won’t launch ever since I updated to Yosemite I don’t know what is going on
    EtreCheck version: 2.0.10 (97)
    Report generated November 2, 2014 at 11:27:34 AM EST
    Hardware Information: ℹ️
      MacBook Pro (13-inch, Late 2011) (Verified)
      MacBook Pro - model: MacBookPro8,1
      1 2.4 GHz Intel Core i5 CPU: 2-core
      4 GB RAM Upgradeable
      BANK 0/DIMM0
      2 GB DDR3 1333 MHz ok
      BANK 1/DIMM0
      2 GB DDR3 1333 MHz ok
      Bluetooth: Old - Handoff/Airdrop2 not supported
      Wireless:  en1: 802.11 a/b/g/n
    Video Information: ℹ️
      Intel HD Graphics 3000 - VRAM: 384 MB
      Color LCD 1280 x 800
    System Software: ℹ️
      OS X 10.10 (14A389) - Uptime: 2:20:3
    Disk Information: ℹ️
      ST9500325ASG disk0 : (500.11 GB)
      S.M.A.R.T. Status: Verified
      EFI (disk0s1) <not mounted> : 210 MB
      Recovery HD (disk0s3) <not mounted>  [Recovery]: 650 MB
      Macintosh HD (disk1) /  [Startup]: 498.88 GB (350.08 GB free)
      Core Storage: disk0s2 499.25 GB Online
      MATSHITADVD-R   UJ-8A8 
    USB Information: ℹ️
      Apple Computer, Inc. IR Receiver
      Apple Inc. FaceTime HD Camera (Built-in)
      Apple Inc. Apple Internal Keyboard / Trackpad
      Apple Inc. BRCM2070 Hub
      Apple Inc. Bluetooth USB Host Controller
    Thunderbolt Information: ℹ️
      Apple Inc. thunderbolt_bus
    Gatekeeper: ℹ️
      Mac App Store and identified developers
    Kernel Extensions: ℹ️
      /Applications/Splashtop Streamer.app
      [not loaded] com.splashtop.driver.SRXDisplayCard (1.6 - SDK 10.7) Support
      [not loaded] com.splashtop.driver.SRXFrameBufferConnector (1.6 - SDK 10.7) Support
      /Library/Application Support/Hotspot Shield
      [not loaded] com.anchorfree.tun (1.1.1 - SDK 10.8) Support
      /Library/Extensions
      [loaded] com.logmein.hamachi (1.0.0) Support
      /System/Library/Extensions
      [loaded] com.Cycling74.driver.Soundflower (1.6.6 - SDK 10.6) Support
      [loaded] net.telestream.driver.TelestreamAudio (1.1.0 - SDK 10.8) Support
    Launch Agents: ℹ️
      [not loaded] com.adobe.AAM.Updater-1.0.plist Support
      [failed] com.adobe.AdobeCreativeCloud.plist Support
      [failed] com.adobe.CS5ServiceManager.plist Support
      [running] com.logmein.hamachimb.plist Support
      [loaded] com.oracle.java.Java-Updater.plist Support
      [not loaded] com.splashtop.streamer-for-root.plist Support
      [running] com.splashtop.streamer-for-user.plist Support
    Launch Daemons: ℹ️
      [loaded] com.adobe.fpsaud.plist Support
      [invalid?] com.adobe.SwitchBoard.plist Support
      [loaded] com.anchorfree.ajaxserver.plist Support
      [loaded] com.ea.origin.ESHelper.plist Support
      [running] com.logmein.hamachi.plist Support
      [loaded] com.oracle.java.Helper-Tool.plist Support
      [loaded] com.oracle.java.JavaUpdateHelper.plist Support
      [running] com.splashtop.streamer-daemon.plist Support
      [loaded] com.splashtop.streamer-srioframebuffer.plist Support
      [loaded] net.freemacsoft.LiteIcon.LIHelperTool.plist Support
    User Launch Agents: ℹ️
      [loaded] com.adobe.AAM.Updater-1.0.plist Support
      [failed] com.akamai.single-user-client.plist Support
      [loaded] com.divx.agent.postinstall.plist Support
      [loaded] com.genieo.completer.download.plist Support
      [loaded] com.genieo.completer.ltvbit.plist Support
      [loaded] com.genieo.completer.update.plist Support
      [failed] com.google.keystone.agent.plist Support
      [invalid?] com.valvesoftware.steamclean.plist Support
      [running] com.w0lf.cDock.plist Support
      [invalid?] net.brockerhoff.QuayMenu.plist Support
    User Login Items: ℹ️
      Steam Application (/Applications/Steam.app)
      iTunesHelper Application (/Applications/iTunes.app/Contents/MacOS/iTunesHelper.app)
      Off-Helper UNKNOWN (missing value)
      TotalFinder UNKNOWN (missing value)
      uTorrent Application (/Applications/uTorrent.app)
      Origin Application (/Applications/Origin.app)
      Hotspot Shield UNKNOWN (missing value)
      Genieo UNKNOWN (missing value)
      Genieo UNKNOWN (missing value)
      Genieo UNKNOWN (missing value)
      VMware Fusion Start Menu UNKNOWN (missing value)
      Genieo UNKNOWN (missing value)
      CrossOver CD Helper UNKNOWN (missing value)
      TuneupMyMac UNKNOWN (missing value)
    Internet Plug-ins: ℹ️
      AdobeAAMDetect: Version: AdobeAAMDetect 2.0.0.0 - SDK 10.7 Support
      FlashPlayer-10.6: Version: 15.0.0.189 - SDK 10.6 Support
      Default Browser: Version: 600 - SDK 10.10
      Flash Player: Version: 15.0.0.189 - SDK 10.6 Support
      OVSHelper: Version: 1.1 Support
      DivXBrowserPlugin: Version: 2.2 Support
      QuickTime Plugin: Version: 7.7.3
      OfficeLiveBrowserPlugin: Version: 12.3.4 Support
      Silverlight: Version: 5.1.20913.0 - SDK 10.6 Support
      JavaAppletPlugin: Version: Java 7 Update 67 Check version
    User Internet Plug-ins: ℹ️
      SOEWebInstaller: Version: 1.0 - SDK 10.5 Support
      NPRoblox: Version: 1, 2, 8, 25 - SDK 10.9 Support
    Safari Extensions: ℹ️
      GoPhoto.it
      Omnibar
      iTube Studio
      Searchme
      DivX Plus Web Player HTML5 <video>
      OpenIE
    3rd Party Preference Panes: ℹ️
      Akamai NetSession Preferences  Support
      Flash Player  Support
      Java  Support
    Time Machine: ℹ️
      Time Machine not configured!
    Top Processes by CPU: ℹ️
          11% LogMeIn Hamachi Menubar
          0% syslogd
          0% WindowServer
          0% launchd
          0% opendirectoryd
    Top Processes by Memory: ℹ️
      202 MB mds_stores
      189 MB installd
      133 MB com.apple.WebKit.WebContent
      129 MB Finder
      86 MB ocspd
    Virtual Memory Information: ℹ️
      417 MB Free RAM
      2.18 GB Active RAM
      417 MB Inactive RAM
      1.14 GB Wired RAM
      10.58 GB Page-ins
      195 MB Page-outs

    Genieo Uninstall
    Genieo Uninstall (2)      see post by   Linc Davis
    TuneupMyMac UNKNOWN (missing value)
    Also uninstall according to the developer's instructions.
    I also would remove uTorrent. You can get adware/malware and other junk from a Torrent download.

  • So I recently removed my partition so I can repartition but its telling me to do something with the disk utility I don't understand what I'm suppose to do?

    So I recently removed my partition so I can repartition but its telling me to do something with the disk utility I don't understand what I'm suppose to do?

    GCapinpin wrote:
    So I recently removed my partition so I can repartition but its telling me to do something with the disk utility I don't understand what I'm suppose to do?
    Unless you tell us what it is telling you we can't help.

  • I purchased the teacher and student lightroom 5. I put in my code and uploaded my evidence to show that I am a teacher. I am guessing it was sent through to someone. How do I know when I can use the software? I don't understand what to do next.

    I purchased the teacher and student lightroom 5. I put in my code and uploaded my evidence to show that I am a teacher. I am guessing it was sent through to someone. How do I know when I can use the software? I don't understand what to do next.

    Please refer below link for more information
    Education FAQ

  • When copying pic from iPhoto 09 to a file, to burn a CD, after 35 photos it stops copying and I get "Unable to create/users/dividrublesr/ documents/I don't know what is going on.

    When copying pic from iPhoto 09 to a file, to burn a CD, after 35 photos it stops copying and I get "Unable to create/users/dividrublesr/ documents/I don't know what is going on. Forgive me for any mistakes, I am a first timer.

    Given that the file is selected then the next possibility is that you're exporting two files with the same name. When you do this the export breaks down as the second file would overwrite the first. Check the filenames.
    Regards
    TD

  • I don't know what is going on with the White Balance (WB) and LR.  I had no problem before but recently LR started to change the  WB as  it is importing photos.  I checked the color scale for my photos and LR and both are with sRGB.  Now instead of LR cha

    I don't know what is going on with the White Balance (WB) and LR.  I had no problem before but recently LR started to change the  WB as  it is importing photos.  I checked the color scale for my photos and LR and both are with sRGB.  Now instead of LR changing the WB it is giving me a second copy with a new WB.  Your advise is very much needed and appreciated.  Thank you.

    Can you show us a screen capture of this 2nd copy with a new WB in your Lightroom grid? Thanks
    Are these second copy photos by any chance photos that had been previously imported?

  • I get message:can't save library file not enough access privileges.Don't understand what this means?

    I get message:"Can't save library file.  Not enough access privileges" .Don't understand what this means. No visible effect that I can see now.

    Classic example of why you should save your workm in progress...just hit Ctrl+s to do it on the fly.
    Yes I know. But it is the first time I work with Photoshop on such a big project and I thought it would be more stable.. Do the newer versions manage the memory better ?
    You can shrink your image down which will make it smaller enough to save
    Not enough memory to resize the image. And in the manipulation, it would corrupt some of my layers..
    you can try to save as a diffeent format
    I could succesfully save in Bitmap format. But I lose all my layers info..
    The making loads of screen shots would be good if it wasnt really an
    option seeing as it would use even more memory to do that then put the
    image together out of the screen shots.
    I made screen shots without any problem. I saved them through MS Paint without any memory problem, while Photoshop in parallel was just used as a static image for snapping...

  • I don't understand what eats my data to give me overage. I don't play games, or use apps, except texting and photos, I have facebook but rarely use it or read it, I try to clear and close anything opened

    I don't understand what gives me data overage, I make calls, text, take photo or video. I don't use any apps maybe once in a blue moon google a question. no games or navigation, don't shop, I do have facebook, but rarely use it.because I look on computer. I try to clear and close after each use. So what else can I do to prevent something eating data? I am a senior and don't understand gigs etc. Maybe  a few times a month I might post from cell to email a pic.

    Just because you do not use an app does not mean it is not doing something in the background.
    Facebook, for example... If you have used it one time it can be uploading any photos/videos you take with your phone on a regular basis even if you don't open it up again. Have you checked your settings in these apps to only sync while on wifi. This can cause a lot of data usage if you did not.
    If you don't feel you need the app, either delete it or disable it.
    Once you open an app the first time, it is activated and unless you make sure the app settings are such that you will not use a lot of data, you should assume they will. Especially apps which have the capability to upload photos/video from your phone.

Maybe you are looking for

  • Configuration of PerformancePoint Service in SharePoint 2013

    Hi, Recently I had configured Performancepoint Service in SharePoint Server 2013. But i had struck while deploying it into SharePoint through the Dashboard Designer.(i.e.,Deploy option has disable in Dashboard Designer). So,Could any one help me to p

  • Need of identifiers and modules in communication channel

    hi xi people. i just want to know about the need of identifiersw and moduled in CC. bcos i havent deal with these. can any one tell me please. waiting for u rr answer. regards. seeta ram.

  • Sequencing Microsoft Forefront UAG Internet Explorer Addon

    Hello, I am trying to sequence the Microsoft Forefront UAG components to allow a remote access site to work. I am using App-v 4.6, IE 10 and a Windows 2008 R2 sequencer. I am sequencing as a plugin and pointing to the locally installed version of IE,

  • .mpg video won't play in AVC3

    Hello all, I've been trying to input soundbites into my newscasts recorded with Adobe Visual Communicator 3 using video formats .mov and .mpeg (MPEG 4). With these formats, the video clip will play but without the audio. When I converted the .mov vid

  • ReportDocument object, sort options

    I am using Visual Studio 2005, Visual Basic syntax, SqlServer 2000 and CrystalReports XI to build a Windows Forms application.  I have a form that allows the user to define criteria for a report which I pass as a parameter to a ReportDocument object.