Comparison Program

I am trying to write a program that reads 5 integers and displays the highest and lowest integers typed in. We are only supposed to use the ideas of variables and comparison operators. The way I figured does this is create a variable named maxVar and keep reassigning it if some other variable ends up being larger. What am I doing wrong. I am new to java
public class Comparison
public static void main( String args[] )
         { // start main method
      Scanner input = new Scanner( System.in );
        int number1; // first number to compare
        int number2; // second number to compare
        int number3; // third number to compare
        int number4; // fourth number to compare
        int number5; // fifth number to compare
        int maxVar = 0; // This is the MaxValue
        System.out.print( "Enter First Integer: " );
        number1 = input.nextInt();
        System.out.print( "Eneter Second Integer: " );
        number2 = input.nextInt();
        System.out.print( "Enter Third Integer: " );
        number3 = input.nextInt();
        System.out.print( "Enter Fourth Integer: " );
        number4 = input.nextInt();
        System.out.print( "Enter Fifth Integer: " );
        number5 = input.nextInt();
        if ( number1 <= number2 )
                number2 = maxVar;
        if ( number1 > number2)
                number1 = maxVar;
        if ( number3 >= maxVar )
                number3 = maxVar;
       if ( number4 >=  maxVar )
                number4 = maxVar;
        if ( number5 >=  maxVar )
                number5 = maxVar;
        System.out.print( " The maximum Integer You Entered Was:"  );
        System.out.printf("%d /n", maxVar );
        } // end method main
} // end class Comparison

What is wrong with the answers you got in your other thread?
http://forum.java.sun.com/thread.jspa?threadID=764850&messageID=4362380#4362380

Similar Messages

  • File comparison program

    Can anyone recommend a good file comparison program?
    Thanks
    Vic

    Thanks! I'm now playing with Beyond Compare
    A.Translator wrote:
    > Joe Makowiec schreef op 14/11/2008 :
    >>> Can anyone recommend a good file comparison
    program?
    >
    >> Windows has its own built-in 'fc' utility. If you
    don't like that, get a
    >> copy of the GNU utilities ports for Windows[1] and
    use 'diff'
    >
    >>
    http://gnuwin32.sourceforge.net/
    >>
    http://unxutils.sourceforge.net/
    >
    > Or WinMerge (free) from
    http://winmerge.org/
    > or Beyond Compare from
    http://www.scootersoftware.com/
    >

  • Comparison programs for mac

    I am switching from windows to mac. I used Beyond compare for file comparison in windows with great ease and success. I downloaded textwrangler for the mac and followed all the directions. I cannot find twdiff anywhere on my machine, even in the usr/bin/ directory and even when searching with spotlight. If I open TextWrangler it says it is installed and I can navigate to 2 files and compare. I want to be able to do it from inside dreamweaver as I did before. Does anyone know of a free or inexpensive program that I can use to compare 2 files? Hey Adobe - this SHOULD be a built in feature of your program! Thanks for your help.

    On my computer, the path to the twdiff file appears to be TextWrangler.app > Contents > Helpers > twdiff.
    That path is normally invisible from the Mac's Finder. However, the path is visible and navigable using the Browse button from Dreamweaver's File Compare pane in the Preferences window (Dreamweaver > Preferences).
    I don't recall if the twdiff file was contained within the TextWrangler.app by default, or if I managed to put it there years ago. Regardless, by pointing to that file in Dreamweaver's File Compare pane, the file comparisons work. For instance, select two files in Dreamweaver's Files window, right-click and select Compare Local Files. When I do that, both files open in TextWrangler, side-by-side, with the differences listed below. Click one of the differences below to highlight that section of code in the side-by-side files.
    Here's more help from Dreamweaver on this subject: http://help.adobe.com/en_US/dreamweaver/cs/using/WSc78c5058ca073340dcda9110b1f693f21-7edda .html#WSc78c5058ca073340dcda9110b1f693f21-7edca
    Hope that helps. ...pt

  • Do integrity checks by file comparison really work?

    Hello,
    I use a program (Beyond Compare) which has a Folder Compare module, with a function for doing a binary comparison between the files inside two folders. I use it to check the integrity of my backups, by comparing my main hard disk files, with the ones on
    the backup hard disks. If two files get recognized as being different, then one of them should be corrupt (if they didn't get modified "normally").
    My question is: will this method work to detect real file corruptions? Will it detect any kind of corruption, both copy corruptions, and "bit rot" corruptions? Will there be no problem regarding read cache? I mean: if the first file to compare gets read
    from disk, and is kept in a read cache (by Windows or by the hard disk, or by something else), will the second file get read from the same cache (if Windows or the hard disk think they are identical files)? Do Windows and hard disks have some kind of procedure
    to detect if a file to read from disk is already available in cache, even if it is in a different folder than the "original" one? Perhaps some kind of file-checksum-system which decides that the files are same? (And this system would not notice if the file
    to compare is corrupt). If this would be true, then integrity checks by file comparison would not work, because in practice the same file would be read twice (first from disk, and then from cache), instead of reading both the two files to be compared from
    disk.
    I have already done tests by manually "corrupting" files (changing slightly the contents, while keeping size and timestamp the same), and it works (the files get recognized as different). But I'm not sure if it will work also with "real" corrupt files.
    I'm interested mostly about Windows 8 Pro 64bit and NTFS (but would like to know also in general).
    Thanks.

    I also have Beyond Compare and have used it to check backup data.
    Yes, Windows does RAM caching.  If you have a comparison program read enough file data that you
    can be sure the RAM cache is flushed, then you can be sure that reading the file data back and comparing it with the original data is a valid way to ensure you have uncorrupted backups.
    Note that NTFS now does online recovery, so just the act of reading back the data can trigger processes inside the file system implementation that will recover the data if it should start to experience "bit rot" (weakening or failure of the
    storage medium).  But this is not strictly necessary as other operations, such as defragmentation etc., will occasionally access the disk data as well.
    Some time back I wrote a small utility that calculates a CRC-32 on all the data from all the files in a set of folders.  This is another way that re-reading all the data can be triggered, as well as producing a summary number that can be easily
    compared to determine that all is well - though one doesn't need my software to do it...  There are hash programs available that can accomplish the same things.  Search for SHA-1 programs, but beware there can be malware associated with free programs
    and download sites.
    It's good that people think about data integrity.  There's all too little of that nowadays.
    -Noel
    Detailed how-to in my eBooks:  
    Configure The Windows 7 "To Work" Options
    Configure The Windows 8 "To Work" Options

  • Ruleset Comparison in GRC10

    Hi,
    Does any one also know the Ruleset comparison program name in GRC10.
    I tried running the Ruleset comparison option from NWBC->Setup-> Access Ruleset Maintenance->Rulesetup->Ruleset Comparison, there is an option to select Risks,Actions,Permission, however on running the comparison tool no risks/action/permission is getting populated in the output report. Is this a bug? has any one else faced this issue?
    Cheers,
    Sabitha

    Dear both,
    with the rule comparison report you have the possibility to compare GRC rule sets (old/new) directly in ARA.
    Basically you upload the new rule set and you are able to compare which risks, actions or permissions have been changed compared with your old one. Please be aware that you cannot load the new rule set with the similar name as comparison isn't possible then.
    The report shows the differences between the rule sets, e.g. which risk, action or permission has differences.
    Does this answer your question?
    Thanks and regards,
    Alessandro

  • Implement PO, FA, AP without HRMS & INVENTORY (11.5.10)

    Hi,
    We are implementing PO, FA & AP as part of P2P impelementation for Bank (v 11.5.10). Can you please let me know if there are any specific things to keep in mind considering there is no plan to implement HRMS & Inventory module in near future.
    Also is there any Banking Specific tips for implementing these modules?
    Appreciate your help in advance & have great day.
    Ashish

    1) It is possible that a patch changed it or that the user guide you looked at is not the latest version. What difference do you see? I have 25 columns in 11.5.10.2 instance.
    2) Did you follow the suggestions in the user guide http://docs.oracle.com/cd/A85683_01/acrobat/115faug.pdf page 3-27
    3) Did you run Physical Inventory comparison program after loading the records? Read the 10 pages upto 3-37 to find useful hints.
    Sandeep Gandhi

  • One billing Doc, Two accounting documents

    HI, all,
    I just found a billing document associated with 2 idential accounting document(different creation time, 10s minutes apart), our users has no idea how it happened, could any one help why and how to avoid this problem? our vension is ECC6 EHP4.
    Thank you!

    Hi,
    Just try to run the SDFI_CONSISTENCY_CHECK report and analyze what could be cause for such a system behaviour.
    A comparison program between Billing and Accounting for the Audit Informatio System (AIS).
    You need to have the following authorization role SAP_AUDITOR_BA_SD to the user id to execute the same.
    For each billing document and account, the program maps the differences between the billing document values and the accounting amounts. For each account, it maps the total of all billing document values and the total of all accounting amounts. You can use the differences to find billing documents where incorrect accounting amounts were posted. You can use totalling to check accounts to which incorrect amounts have been posted. The system takes the amounts into consideration for the differences and also for the totals in the document currency.
    The user is responsible for the evaluation. To enable you to quickly find inconsistencies, the program offers you the option of displaying only billing documents that contain differences. As an additional aid, you can go directly to the billing document, and from there display the accounting documents. You cannot make changes to documents. Various filter functions and sort options make the evaulation easier.
    Execution Help:
    a) Selection
    The selection screen enables you to select billing documents by document number, billing date, company code, and posting period with fiscal year.
    The checkbox 'Only Documents with Differences' specifies whether the system also includes documents without errors in the results list.
    The system does not check all entered billing documents, or billing documents determined using other selection fields. The program extracts from the selection only billing documents with 'Accounting document created' as the status for transmission to accounting. For technical reasons, down payment requests are ignored.
    Some reasons for the cause:
    If the system cache not being cleared during scheduled batch process. For this the basis and technical team can help you to sort it out
    Another case may be whether the accounting document is creating based on number of products.Our system has the
    configuration to split FI accounting by product wise.Check the transaction OBCY.
    Regards,
    Saju.S

  • Problem downloading rar file using HttpURLConnection

    I'm trying to read a rar(archiving) file from the Internet using a HttpUrlConnection.
    The program seems to work fine - however the download is not the same size as the file if downloaded through a browser.
    The archive is 52,332kb when downloaded through a browser
    and 4kb smaller when I try to download it.
    When I try to extract the downloaded file (with winRAR) the header is corrupt and there is an unexpected end of archive.
    Here is the pertinent code.
    try
                // configure and open connection
                HttpURLConnection conn = (HttpURLConnection)   currURL.openConnection(); // currURL is a URL object
                conn.setRequestProperty("Connection", "Keep-Alive");
                conn.setRequestProperty("Accept-Encoding", "gzip,deflate" );
                conn.setRequestProperty("Content-type", "application/x-rar-compressed" );
                conn.setRequestProperty("Cookie", cookie);   
                conn.connect();
                // get an input stream from the HttpURLConnection object    
                InputStreamReader isr = new InputStreamReader( conn.getInputStream() );
                BufferedReader in = new BufferedReader( isr );
                /* the string file_name has been parsed from the url
                 * and is in the format file_name.rar */
                File dest = new File("C:\\my_folder\\"+file_name);
                // open output stream
                OutputStream os = new FileOutputStream( dest );
                OutputStream buffer = new BufferedOutputStream( os );
                int data;
                while ( (data = in.read() ) != -1 )
                   buffer.write(data);
                // close streams
                in.close();
                os.close();
    catch( IOException iox)
         iox.printStackTrace();
    }Thanks in advance.

    Thanks ejp. I closed 'buffer' instead - that fixes the size problem.
    The archive is now exactly the same size as it should be - but the header information is still corrupt.
    When I compared the files using a binary comparison program it
    said that the files although the same size were different by approx. 6.7mb out of 53.5mb.
    I'm perplexed as to what this difference could stem from; is it the encoding, the charset, something similar?
    The underlying file I'm trying to download is an avi if that makes any difference.

  • Gpib file transfer

    I have an Agilent E5052A that use Win2000, and I'm saving the screen capture into local c: drive of Scope. when I try to copy that picture into my PC (using GPIB) the file pass thru without problems but I can't to open the file, please see Original.png and Test.png files attached.
    I'm using Visa ReadToFile.vi to transfer file. I already tryed with Direct "Visa read" and "GPIB read" vi's and get same results.
    I compared the two files using a file comparison program, in text mode looks similar or equal (exept for the begining and end), but if compare the two files in binary Files, i'm gatting to many differences.
    any body has an idea?
    Message Edited by lmontoya on 03-24-2010 12:08 PM
    Solved!
    Go to Solution.
    Attachments:
    Original.png ‏21 KB
    test.png ‏21 KB

    Hi lmontoya,
    there are two problems:
    - first you have 8 additional bytes at the start, some counter or length of file or similar...
    - then (nearly) all EOL chars are replaced by 0x0D0A, which happens when not setting a correct transmission or file saving mode. It has to be some "binary" transmission instead of text transmission (with inherent EOL conversion). Probably you used "Save Text to file" with EOL conversion enabled... Please attach your VI for spotting the problematic section of your code...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Payroll parallel reconciliation with external non-SAP System

    Hi folks,
         Did any one of you work on "payroll parallel reconciliation” project . We have data coming through SAP "payroll" results as well as from an external system. We have some wage types, schemas and some results tables in SAP payroll out put, they also have something like wage types and payroll results in external system. What I’m thinking that we can download the payroll result and write some macros in excel sheet or do Vlookup. Other approach is to upload external system data in to Sap and validate , or check what every condition are there .
    What else can we do? Please give your inputs/suggestions.
    Thanks
    Message was edited by: Saquib Khan

    Hi saquib,
    1. I suppose, apart from compareison of
       sap figures <-------> external software figures,
       , there is no other motive / purpose.
    2. There are 2 important things :
       a) No need to validate thru macro
          or paralllel online comparison.
         (don't go for such approach, as it may
          hinder sap normal business process)
       b) after payroll is processed in both systems,
          only after that,
          comparison should be done.
    3. Now the question comes, where should the
       validation be done ?
       a) sap
       b) external software
       c) excel
       d) others.
    4. Doing in excel and checking each figure
       can be done, provided we know how to do
       and we are expert at it.
    5. Other thing is,
       a) make y table for uploading data of external system
        (simple y table with wage type, amount, period.
      b) make a small z program to upload
        the data, 
        do the comparison, one by one.
      c) if required, the program can list
        out the variances.
    6. I personally feel, this shold be the
        best approach.
       (This comparison program can be developed
        in external software also.
       However, to download sap  data
       we once again have to create a small z program.,
      so why not, make one z program, once and for all )
    regards,
    amit m.

  • FA Physical Inventory in 11.5.10.2 / 10g db / HP

    We have a project which will implement a gui front end with an interface into the FA_INV_INTERFACE table. I have 3 questions. First, the layout of the FA_INV_INTERFACE table we have in our instance does not match the published one in the 11.5.10 Assets User guide. Was there a patch that changed the layout? Second, I inserted a row into the FA_INV_INTERFACE table for testing using an insert statement in sql developer and the row does not show up on the Inventory Entries form. How come? My last question is when I launch the Inventory Entries form after I enter the Physical Inventory header information, there is a message on the bottom 'FRM-41051 You cannot create records here'. Why not? Is there a system setting I need to flip? We have never used this functionality before.

    1) It is possible that a patch changed it or that the user guide you looked at is not the latest version. What difference do you see? I have 25 columns in 11.5.10.2 instance.
    2) Did you follow the suggestions in the user guide http://docs.oracle.com/cd/A85683_01/acrobat/115faug.pdf page 3-27
    3) Did you run Physical Inventory comparison program after loading the records? Read the 10 pages upto 3-37 to find useful hints.
    Sandeep Gandhi

  • Getting sites onto new computer

    I just installed AbodCS6 Master Suite onto my new computer.
    What's the best way to get my Dreamweaver sites onto the new computer so I can manage them?
    (Do I copy and paste all the files from my old computer or download the site on my new computer)?
    And is there a good way to keep everything synced if I want to be able to manage the site from two different computers or am I better off removing my old Dreamweaver CS6 installation?
    Thanks

    DropBox???
    I work on sites from at least 3 computers all the time. The site files are all stored on dropbox so that a change on one system changes them all. I maintain sync carefully by keeping and storing ftp logs and work records.
    I also run CS5, CS6 and CC on the same machine. As long as the site definitions are the same the local files will always be the same, only site sync may be a problem because CS6 will not have the same site sync info as CC.
    I highly recommend that you invest in a file comparison program. I'm Mac based and I use DiffMerge ($20) and it's great for a double check on the files in question.
    I've submitted feature requests to maintain site sync through Creative Cloud. Maybe that will show up in the future.

  • Reverting back to old layout - role comparsion   RSUSR050

    Hi Folks,
    We have upgraded to ECC 6.0 and BW BI 7.0  . The SUIM transaction for role
    comparison (program RSUSR050) has a new layout . compares the objects
    in downward display rather than the old 2 column display.  Is there a way to
    revert back to old display layout ? - much easier to compare .

    Hi Dan,
    if you have still an old system, you could take the old coding (also the includes SR050E10 and SR050F10) and copy it to  a z-report of your own to get the old look again.
    Nevertheless it is planned to deliver an improved design for the resultlist to make the comparison easier. But........   it is not clear until now, how long the realization will take.....
    rgds, Bernhard

  • Flash Media Server Priced to Lose?

    I would note that I recently read a report where, I believe,
    YouTube is going to the Apple platform. This I would have to
    consider as a major direction for this streaming video technology.
    Is this because the technology is better than Flash? I would have
    to say no. Well then why? In my opinion the answer is easy. The
    cost for streaming the products. The additional cost for streaming
    Quicktime or Windows video is ZERO. The cost to stream Flash is
    $4,500.00 per server. Prohibitive! The price to be hosted on one of
    Adobe's primary streaming Flash providers? $500.00 per month! The
    price to be hosted on a Windows server with Windows streaming?
    $13.30 per month. Adobe even offers a hack to the Windows Server
    software to stream Flash! In my opinion Flash is the best, most
    option rich animation software period. In my opinion streaming is
    the new technology for web sites. I would strongly suggest that
    Adobe's pricing of their streaming server software is a great big
    open door for people like Microsoft and Apple to take control of
    the streaming technology in the future. You can bet that Bill Gates
    and Steve Jobs have people working on exactly that right now. If
    that is true that YouTube/Google are going to Quicktime that on
    coming train is closer than they think.
    Right now I liken buying and learning Flash CS3 to buying a
    car and learning how to drive it only to find out later that to
    drive it out of my driveway is cost prohibitive.
    See
    Forbes
    from last year. They thought the same thing then and now YouTube is
    going to Quicktime.
    Open Source Flash Streaming server software:
    red5

    douglask1,
    > Why would they pay up to $4.500.00 per server to use
    Flash
    > when they can do it for free using Quicktime or Windows?
    If QuickTime and Microsoft do offer free streaming software,
    and if
    streaming is the true deal-breaker (not ubiquity of plug-in
    or, say,
    interactivity with traditional Flash animation), then I
    imagine Adobe would
    indeed take notice and compensate in their pricing structure.
    That's the
    volatile beauty of a free market.
    > Earlier, refering to YouTube going to Quicktime you said
    "It's
    > already going in a major direction. I would see that as
    a major
    > 'change' in direction. ;)". Well they are and I would
    bet they go
    > to streaming -vs- progressive.
    If your bet is right, I suspect we'll all see a big change,
    agreed.
    Time will tell.
    > I would further argue that the success of Flash is
    because of the
    > progressive downloads which are great for short clips.
    It's been great for long clips, too. I personally think much
    of the
    success is also due to the "one stop shop" nature of Flash
    video: no need
    for more than one plug-in. In addition, Flash offers keyed
    alpha that,
    while supported in the other video platforms, doesn't seem to
    be supported
    in their web implementations. (I could easily be wrong in
    that assessment;
    it's just that I haven't seen any QuickTime or WMV files with
    transparent or
    semi-transparent areas blended into the page in an apparently
    non-rectangular way. I haven't seen QuickTime or WMV files
    rotated or
    skewed, either.)
    > If one is interested in longer animations or videos
    progressive
    > severly restricts the amount a viewer can use the
    controls to scroll
    > forward or backward without waiting for a reload of that
    section
    Yes, that's a weakness of progressive download.
    > Progressive also allows for one to stop the video and
    grab (steal)
    > content.
    Agreed, that's arguably another weakness.
    > And, yes, server software is not cheep but Apache is
    free.
    > One could set up a server using Apache and Darwin, both
    free,
    > and stream Quicktime.
    Yes, and many do. Curiously, major motion picture studios
    seem to be
    leaning more on Flash, in spite this free approach. (That may
    change, as
    you've suggested, but it's interesting to me that Flash has
    taken so much
    market share in light of free alternatives. That suggests to
    me it's about
    more than just streaming.)
    > Flash is great! I love it! Don't take me wrong.
    No worries, douglask1, and I hope you don't take me wrong,
    either. I
    just don't see how this sort of speculation is useful on a
    tech support
    forum.
    > For anyone that wants/needs to use streaming Flash, in
    my opinion,
    > has priced themselves out of the market.
    That clearly cannot be, or there wouldn't be such a heavy
    Flash video
    market. Again, if your suspicions are are correct, that may
    change, but in
    the mean time, Flash video is enjoying a strong presence on
    the Web,
    streaming and not.
    > I guess you could use Flash and convert the videos to
    Quicktime
    > but how long do you think before good old Steve Jobs and
    his
    > team have a new version of Quicktime to compete with
    Flash CS3?
    I guess I just don't think of Flash and QuickTime as the
    analogous
    tools. Comparing those is like comparing apples to plum
    pudding. Yes,
    QuickTime content is programmable -- I've seen some really
    neat examples
    over the years -- but people barely seem to use it for that.
    Practically
    speaking, they use it for video. In the same way, PDFs are
    somewhat
    programmable, but people mainly use PDFs for "plain old"
    readable documents.
    Who knows why? Meanwhile, Flash content (clearly the heavy
    lifter by
    comparison, programming-wise) is being use all over the
    place. I honestly
    can't think of a more versatile platform: illlustrations,
    cartoons,
    PowerPoint-like presentations, MP3 players, games,
    multiplayer games,
    television output, Web applications ... and yes, Web video
    output. All from
    a single plug-in. That sometimes blows my mind (in a good
    way).
    What you're talking about are interesting topics, and
    depending on how
    things fall out, might make for some careful decision making
    on the part of
    numerous designer/developers (and the various companies
    discussed). Who
    would have thought Flash would have gotten as big as it did?
    Things change.
    Change is good. :)
    David Stiller
    Adobe Community Expert
    Dev blog,
    http://www.quip.net/blog/
    "Luck is the residue of good design."

  • HELP: need to do version comparison for large no.of programs

    i need to do version comparison for a large set of programs(approx.4000).anybody has any technique to do it fast,plz lemme knw.

    Hi
    try using this FM
    /SDF/CMO_COMP_VERSION
    AKB_VERSION_COMPARE
    Regards
    Shiva

Maybe you are looking for

  • Is there a way to prevent music from autostarting when connected to bluetooth

    Is there a way to prevent music from autostarting when connected to bluetooth Mike

  • Is a W5xx the only way to get a thinkpad that will take 4 sodimms?

    Hi Guys, From my research, it looks like the W series is the only way I can get a thinkpad that will take 32gb of RAM.  Ideally I would love a T430 as I like the slightly smaller form factor. I have seen a reference though to T530 with a quad core CP

  • Parsing the URL

    Hello Friends, I have couple of JSP pages. The URL for each of the Jsp page shown in browser looks somelike as follows. http://order.xyz.com/?p_mycode=2Mon_Fr&mnid=in_ss_ppo_hino_soos What I want ti achieve is as follows:-- In my Jsp page, I should b

  • SQL Server 2005 64-bit & SQL CLR Stored Procedures using DI API. COM Error.

    Hi, We've created a set of SQL CLR Stored Procs in C# .NET which use the DI API to import data into SAP (DEV was carried out on 32-bit environment). The DLLs and Interop.SAPbobsCOM have been successfully deployed as assemblies on SQL Server with thei

  • Business Service Response URI

    Hello, I have 2 clusters of managed servers (cluster 1 and cluster 2). I have another server with OSB. I created a business service that host several queues. I successfully created a proxy that routes messages from cluster 1 to the business service q