How could u write this application?

write an application to read an unknown number of integer pairs representing binary numbers from a file redirected input from the command line. do not use sentinel value or prompt.
1. Echo print in colums 1 and 2 the numbers that were read.
2. Convert each number to decimal for columns 3 and 4.
3. Count the number of 1's in the numbers for columns 5 and 6.
4. Find the larger of the decimal versions of the first and second number of each integer pair, and print that number in column 7.
5. Keep separate cumulative sum of the decimal versions of the first and second number of each integer pair, and print that number below the appropriate column after all numbers have been read.
Sample output:
10 11 101 1111 111 10000 101011 0
thanks for your interest

> hey young fella, its not a HW or something!! everyone
talks alot here like they know everthing(which they
aint gotta clue), i decided to put an easy
application to c how many people are going to be able
to write this application??
That's a little tough to believe. It's far more likely that you need some help on figuring out how to go about writing such an application. There's nothing wrong with that; just know that most folks who volunteer to help here aren't particularly interested in "proving their skills" by way of programming "challenges". They typically get far more satisfaction by helping others learn Java.
i guess u r one those fellas who dont have a clue about java!!! b/c if u
were not, this would take ur 5-6 mins of time..
So, do you have a specific question regarding those requirements? If you do, please ask. If, on the off chance you've got some special insight regarding an implementation, post your idea and get some feedback from the community.
Also, please make the extra effort to write out words such as "see", "you", "are", "your", and "because". The extra keystrokes won't cost much in the way of time, and the enhanced clarity will be appreciated by those communicating on a forum with international readership. Also, it will give the appearance that you take your question seriously, which will in turn make your question look more interesting to answer.
Thanks!
~

Similar Messages

  • How could I write this in java

    I have to use a parameter in a statement. I am trying but its giving error. I am trying to write it like ....
    fw.write("Object     dir/my.dat\n");I substitute my.dat with a variable dat & write like
    fw.write("Object     dir/+"dat"+\n");dat is a String variable.

    Sam_Fin wrote:
    thanks,welcome
    How could I remove this error.
    Unreported exception java.io.IOException; must be caught or declared to be thrown fw.write("#the number of patterns to be recognized\n");
    Its for every fw.write statement.read the Sun (Oracle?) [tutorial on exceptions,|http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html] and then either throw the exception or wrap in a try / catch block (the tutorial will explain how).

  • How could I write this code?

    I am trying to create a shared object that will host a chat
    room environment. I will have many of these rooms and I know what I
    want to do, just not how to write it in actionscript or if it is
    even possible. the underlined portion is what i just don't know how
    to code (
    (room + roomNumber + _so) ) as it should throught usage
    equate to something like
    room1_so,
    room2_so,
    room3_so, and so on. any help would be greatly appreciated.
    thanks in advance.
    function doJoin(roomNumber) {
    (room + roomNumber + _so) = SharedObject.getRemote(
    (room + roomNumber + _so) ,_root.clientroom_nc.uri,true);
    if(
    (room + roomNumber + _so) ).data.seat1 = occupied) {
    do this;
    }

    its actually connecting to flash media server remote shared
    object as opposed to the local shared object. The code in question
    was actually taken nearly word for word from the macromedia sample
    file so I know that that portion is correct.
    If I replace the shared object name from
    tl["room"+roomNumber+"_so"].connect(_root.clientroom_nc);
    and change it to
    room1_so.connect(_root.clientroom_nc);
    everything works fine and the connection is succesful,
    however since I hope to have many many rooms that is just not a
    feasible way to write it. I have racked my brain trying to think of
    an alternative way of writing it but have come up with nothing. I
    am well versed in Basic, PHP, and some C, but this damn
    actionscript stuff is throwing me for a loop since it is incredibly
    different in a lot of ways.

  • HT1926 when trying to setup itunes on my pc i get the following message: there is a problem with this Windows installer package. A program required for this install to complete could not be run. How could I solve this problem?

    when trying to setup itunes on my pc i get the following message: there is a problem with this Windows installer package. A program required for this install to complete could not be run. How could I solve this problem?

    Repair your Apple software update.
    Go to START/ALL PROGRAMS/Apple Software Update. If it offers you a newer version of Apple Software Update, do it but Deselect any other software offered at the same time. Once done, try another iTunes install
    If you don't find ASU, go to Control Panel:
    START/CONTROL PANEL/Programs n Features/highlight ASU and click REPAIR,

  • Hi, I upgraded my iphone 4 to iso 5 beta 6, but now it shows "No Service" at top left, and unable to complete your activation. Also tels that this device is not registered as part of the iphone developer programme. How could I fix this problem? Please..?

    Hi, I upgraded my iphone 4 (4.3.3) to iso 5 beta 6, but now it shows "No Service" at top left, and unable to complete your activation. Also tells that "this device is not registered as part of the iphone developer programme." How could I fix this problem? Please help me...,

    I had a similar occurrence with my just activated iPhone 4.
    I had been using the phone for three days when an odd occurrence with voice mail caused me to call tech support. After some discussion they decided to push the activation to my phone (even though I had been using it for three days). When I went to power it back up again I repeatedly got the "no service" notification. I got tech support on a land line and we tried hard reboots and so on. No joy. They told me to take it in to the point of sale and either the SIM card or the phone needed (or both) needed replacing.
    I tried one last hard reboot after dinner and the phone came up with service, but I took it in to the point of sale in the morning and they swapped the SIM card out and I went to a Genius Bar appointment to get the phone checked out. It is supposedly OK, but I am still having some problems when syncing it so I will have to visit the Genius Bar again tomorrow about that. At least I have not experienced the "no service" problem in the roughly 24 hours since the SIM card was replaced. (Fingers crossed)

  • How can I close this application?

    I entered a script that autoclicks every 0.1 seconds and I didn't turn off the mouse thing so it just keeps entering 5s. I can't do anything except move my cursor(can't click or type). How can I close this application?

    > I have an interface (main vi) wich call another interface (pop
    > up).this interface call another interface. How can I do in order to
    > close the interface which is calling without stopping my application
    >
    There is a mechanism built into subVIs and subVI calls to open when
    called and close when finished. This still works fine for many tasks
    and is quick and easy. To use this, you can use the File>>VI Properties
    on your subVI, go to Window Appearance, Customize, and it is in the left
    column near the bottom.
    You can also set this on a subVI call by right clicking, choosing SubVI
    node setup and set the same Open when called and Close on exit settings.
    The difference between them is that the first will affect every usage of
    the VI, whereas the
    second can be set to pop open sometimes and other
    times not.
    Of course there is another way, introduced when the VI server was added.
    There is a VI property for the VI class, Front Panel Window Open.
    Setting it to True and FALSE will open and close. There is also now a
    method for opening and closing with a few additional options.
    The VI Server allows for more control and flexebility, but the first two
    options are still perfectly valid for simple things. If using them,
    closing your subVI is as simple as exiting your outer loop of your
    subVI. This returns and closes the window all at once giving control
    and and data parameters back to the caller. If using the VI Server, you
    can either close the window just before returning or leave it to the
    caller. Just be sure they are in agreement.
    Greg McKaskle

  • My macbook air doesnt have iMessage. How do i download this application?

    My macbook air doesnt have iMessage. The apple website says it should be on here but it isnt. How do i download this application?

    Messages was released in the summer of 2012, with the 10.8 (Mountain Lion) version of the Mac operating system. If you got your MBA before that and haven't upgraded the OS, it won't be there.
    You can upgrade to the latest OS version (Yosemite) for free from the Mac App Store, and that will include Messages.
    Hope that helps

  • List v = new Vector() how can i write this ?

    List v = new Vector() how can i write this ?
    vector does not 'extends' List rather it 'implements' only ......so how can write this way ? ( polymorphism applies only for 'extends' ).

    my question in a simple way is :
    List some_list extends Vector
    No, List is an interface; Vector is a concrete class. Read the javadocs.
    Vector implements List
    >
    AND
    List some_list implements Vector
    are these two same in behaviour
    our  apart from theoretical differences ?thanks
    Interfaces don't have any implementation; they're pure method signatures. When a concrete class implements an interface, it makes a promise that says "I will provide implementations for exactly these methods. Any client can call a method from the interface and I will do something 'sensible' if I'm written correctly."
    From the point of view of static and dynamic types, there's no difference between interfaces and classes.
    C++ has interfaces, too - they're classes with all pure virtual methods. If you understand how C++ works, the concept shouldn't be hard.
    ArrayList is preferred precisely because it isn't synchronized by default. (You can always make it so using java.util.Collections if you wish later on.) If you don't need synchronization, why pay the performance penalty?

  • How do I write this SQL command in Oracle

    Hi all
    I wriote this SQ L statement in Ms SQL Server. How do I write this sql command in Oracle?
    ALTER VIEW dbo.ConsumptionAS SELECT TOP 100 PERCENT ID,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200710' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Oct2007,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200711' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Nov2007,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200712' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Dec2007,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200801' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jan2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200802' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Feb2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200803' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Mar2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200804' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Apr2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200805' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS May2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200806' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jun2008 ,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200807' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jul2008 ,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200808' AND NbrDaysUsed != 0 THEN (QtyUsed/ NbrDaysUsed) * 748.05 ELSE 0 END)) AS Aug2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200809' AND NbrDaysUsed != 0 THEN (QtyUsed NbrDaysUsed) * 748.05 ELSE 0 END)) AS Sep2008
    FROM dbo.MasterConsumption WHERE YEAR_MONTH >= '200710' AND YEAR_MONTH <= '200809' GROUP BY ID ORDER BY ID
    I am very interested in this part:
    SUM(CASE WHEN YEAR_MONTH = '200710' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Oct2007
    thanks
    Edited by: user631364 on Oct 27, 2008 8:25 AM
    Edited by: user631364 on Oct 27, 2008 8:26 AM
    Edited by: user631364 on Oct 27, 2008 8:27 AM

    Thank you!!
    Now let me aslk the second part of my question.
    This sql command:
    ALTER VIEW dbo.ConsumptionAS SELECT TOP 100 PERCENT ID,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200710' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Oct2007,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200711' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Nov2007,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200712' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Dec2007,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200801' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jan2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200802' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Feb2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200803' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Mar2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200804' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Apr2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200805' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS May2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200806' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jun2008 ,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200807' AND NbrDaysUsed != 0 THEN (QtyUsed/ Days_Usage) * 748.05 ELSE 0 END)) AS Jul2008 ,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200808' AND NbrDaysUsed != 0 THEN (QtyUsed/ NbrDaysUsed) * 748.05 ELSE 0 END)) AS Aug2008,
    CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = '200809' AND NbrDaysUsed != 0 THEN (QtyUsed NbrDaysUsed) * 748.05 ELSE 0 END)) AS Sep2008
    FROM dbo.MasterConsumption WHERE YEAR_MONTH >= '200710' AND YEAR_MONTH <= '200809' GROUP BY ID ORDER BY ID
    was created with this query in SQL Server and then I saved it in a store procedure, that I scheduled to run montlhy
    SET ANSI_NULLS ON
    DECLARE @SQLString NVARCHAR(4000)
    /* Build the SQL string once.*/
    SET @SQLString = 'ALTER VIEW dbo.Consumption AS SELECT TOP 100 PERCENT ID, CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = ' +
    "'" + dbo.CONLastMonth_fn(getdate(), month(getdate()) - 12) +
    "'" +
    ' AND NbrDaysUsed != 0 THEN (QtyUsed/ NbrDaysUsed) * 748.05 ELSE 0 END)) AS ' +
    dbo.CONMonthInEnglish(getdate(), month(getdate()) - 12) +
    … (GOES FROM current month -12 to current month -1)
    , CONVERT(decimal(10, 2), SUM(CASE WHEN YEAR_MONTH = ' +
    "'" + dbo.CONLastMonth_fn(getdate(), month(getdate()) - 1) +"'" +
    ' AND NbrDaysUsed != 0 THEN (QtyUsed/ NbrDaysUsed) * 748.05 ELSE 0 END)) AS ' +
    dbo.CONMonthInEnglish(getdate(), month(getdate()) - 1) +
    ' FROM dbo.MasterConsumption WHERE YEAR_MONTH >= ' +
    "'" + dbo.CONLastMonth_fn (getdate(), month(getdate())-12 ) +"'" +
    ' AND YEAR_MONTH <= ' +
    "'" + dbo.CONLastMonth_fn (getdate(), month(getdate())-1 ) +"'" +
    ' GROUP BY ID ORDER BY ID '
    EXEC sp_executesql @SQLString
    Is that something that can be done in Oracle in the same way?
    Do you use another approach?
    please advice
    Edited by: user631364 on Oct 27, 2008 10:19 AM
    Edited by: user631364 on Oct 27, 2008 10:21 AM
    Edited by: user631364 on Oct 27, 2008 10:21 AM
    Edited by: user631364 on Oct 27, 2008 10:22 AM
    Edited by: user631364 on Oct 27, 2008 10:23 AM
    Edited by: user631364 on Oct 27, 2008 10:23 AM
    Edited by: user631364 on Oct 27, 2008 10:24 AM

  • How do I write this as a loop?

    How do I write this code to function as follows.
    When btn1 is clicked, SenderLoad should be "clay" AND when btn2 is clicked, SenderLoad should be "iron", etc...
    var mgB:Array = [btn1, btn2, btn3, btn4];
    var mgBW:Array = ["clay", "iron", "cotton", "leather"];
    var SenderLoad:LoadVars = new LoadVars();
    var ReceLoad:LoadVars = new LoadVars();
    var mgNum:Number=0;
    for (i=0; i<mgBW.length ; i++){
    mgBW[i].onRelease = function () {
    mgNum++
    SenderLoad.word = mgB[mgNum];
    SenderLoad.sendAndLoad("http://www.web.com/my.php",ReceLoad,"POST");
    ReceLoad.onData = function(src) {
    var messageA:Array = src.split(",,,");
    ldrB2.html=true;
    for(var i:Number=0; i<messageA.length; i++){
               var a:Array=messageA[i].split(",,");
       ldrB1.htmlText +=a[0];
       ldrB2.htmlText +=a[1];

    if you want different words in different colors you can use:
    ldrB1.html=true;
    ldrB1.text = formatF("REJECT",0xff0000,ldrB1)
    ldrB1.text = formatF("ACCEPT",0x000000,ldrB1);
    ldrB1.text = "formatF("BANNED",0xc0c0c0,ldrB1);
    function formatF(s:String, col:Number, tf:TextField):Void {
    if(tf.text.indexOf(s)==-1){
    return;
        tfor.color = col;
        var startindex:Number = 0;
        while (startindex>-1 && startindex<tf.text.length-1) {
            var bindex:Number = tf.text.indexOf(s, startindex);
            var eindex:Number = bindex+s.length;
            tf.setTextFormat(bindex,eindex,tfor);
            startindex = eindex;
    var tfor:TextFormat = new TextFormat();

  • How could I fix this code

    Hii 2 all
    How could I change this statement for parameters list,, so the client_name can contain spaces ??
    add_parameter(p_id,'p_client_name',TEXT_PARAMETER, '''' || :cntrl.client_name || '''');
    cause it couldn't print and give syntax error when the :cntrl.client_name contains any spaces !!!!
    please help
    thanks:)

    First I must apologize, I asked you to test something that was not needed... for a moment I thought we were talking about web.show_document, that's why I asked you to test with double-quotes..
    Regarding your problem, Manu is right, there is not need to wrap around the parameter in quotes..
    add_parameter(p_id,'p_client_name',TEXT_PARAMETER, :cntrl.client_name);I have to ask you the same question that Manu asked you before, where are you using this parameter?
    In your Report you must be using in a piece of PL/SQL code, we need you to post that code...
    Edited by: Rodolfo Ferrari on Sep 10, 2009 4:44 PM

  • I have a new Macbook Pro but it does not have iDVD. How can I get this application?

    I have a new Macbook Pro but it does not have iDVD. How can I get this application?

    I have a new Macbook Pro but it does not have iDVD. How can I get this application?
    If you are still within your 15 day return period.  Call Apple they will sent out iDVD at no charge.  (There are no realistic substitutes.)
    Nicely explain that you may return the computer without iDVD. That usually does the trick.  You MUST speak to a senior advisor to get a free copy. The first tier people cannot do it.
    408-996-1010
    800-692-7753
    If that doesn't work you can purchase iLife 11  (includes iDVD) on disk.
    IDVD is a wonderful piece of software and well worth the low cost of $40.
    http://www.amazon.com/Apple-MC623Z-A-iLife-VERSION/dp/B003XKRZES/ref=sr_1_1?ie=U
    http://dealmac.com/lw/artclick.html?1,527850,1872219

  • I'd like to transfer the photos from iPhone to MacBook Air. My iPhoto used to detect my iPhone automatically, but it doesn't happen anymore. How could I fox this? Thanks for helping!

    I'd like to transfer the photos from iPhone to MacBook Air. My iPhoto used to detect my iPhone automatically, but it doesn't happen anymore. How could I fox this? Thanks for helping!

    Check the iPhoto preferences:
    From the main menu bar:  iPhoto > Preferences > General:
         "Connecting camera opens"  : Set this option to  "iPhoto".
    If that does not help, disconnect your iPhone and reset your iPhone.
    To reset iPhone, press and hold the Sleep/Wake button and the Home button at the same time for at least 10 seconds, until the Apple logo appears.

  • My QuickTime player us not playing .avi files and says I need a codec I can't play no .avi files on QuickTime. How could I fix this because I want to play these files with QuickTime.

    My QuickTime player us not playing .avi files and says I need a codec I can't play no .avi files on QuickTime. How could I fix this because I want to play these files with QuickTime.

    Hmm . . . comes with a Utility MPEG2 Component ML app with no explanation of what it's for?
    The utility app is an "assistant PKG installer." It allows Lion and Mountain Lion users to install the older QT MPEG-2 Playback Component installer PKG file which is not allowed to run on its own under Lion or Mountain Lion since these operating systems already have a QT X only MPEG-2 component embedded in the QT embedded structure. Without this utility you would have to either copy the component from an older system to your Lion or Mountain Lion system, use Pacifist for installation, or manually open the PKG contents and transfer the component to the appropriate component folder.
    As to your "discussion" regarding the playback of AVI file types, there are really only two strategies here:
    1) You can add component support so that QT can play the files natively or
    2) You can convert the file contents to compression formats that are natively compatible with the unmodified QT component configuration.
    Each user should decide for his or her own self which approach best suits their needs for a particular source file. In most cases, conforming the system's codec component configuration to play the source file directly results in higher video quality since no transcoding takes place but this strategy will not work if a codec which is required is not available for the user's operating system. On the other hand, converter utilities tend to support more built-in codecs and are easier to use since the user does not have to concern him or herself with the nature of the particular source compression formats but at the risk of some potential loss in visual quality. As to what converter to use, once again this is a matter of personal choice. In the case of commercial converters like iSkysoft, the codecs are built in while MPEG Streamclip accesses the host operating system's QT codec component configuration. I personally prefer the free HandBrake app for AVI, MKV, TS, MTS, and M2TS conversions since it has an exceptionally full-featured X.264 GUI with some user options that 97% of users are likely to never use.

  • How can i install AppRadio application...i am in Tunisia and the application is not found in the Tunisian AppStore...it's essensual for piloting my Pioneer SPH-D01 AppRadio....please how can i get this application ...thanks

    how can i install AppRadio application...i am in Tunisia and the application is not found in the Tunisian AppStore...it's essensual for piloting my Pioneer SPH-D01 AppRadio....please how can i get this application ...thanks

    If it's not available in the store in which you have your account, you're pretty much out of luck. In order to purchase from the U.S. iTunes Store you need a)a valid billing address in the U.S., b) a credit/debit card billed to that address or an iTunes prepaid card purchased in the U.S. and c) to be physically located in the U.S. at the time of purchase.

Maybe you are looking for