What's the prob?

hi all!..
i need ur help to solve this matter :)
i used to build a program:
1. create two arrays that can save data about 'name' dan 'salary' of lecturer.
2. user need to input data (name and salary).
3. create ascending sorting of the two arrays.
4. user also need to input which data they want to sort (by name or by salary).
the source code: (contains error)
import java.io.*;
class Array
     InputStreamReader a = new InputStreamReader(System.in);
     BufferedReader b = new BufferedReader(a);
     int i,j,choice;
     String name[]=new String[10];
     double salary[]=new double[10];
     void input()
          for (i=0;i<10;i++)
                    System.out.print("name[i] : ");
                    name=b.readLine() ;
                    for (i=i+1;i<10;i++)
                              System.out.println("salary : ");
                              salary[i]=Integer.parseInt(b.readLine());
                         System.out.println("salary ");
          System.out.print(name[i]);
          System.out.println("1: Sorting by name");
          System.out.println("2: Sorting by salary");
          System.out.println("Your choice:");
          pilihan=Integer.parseInt(b.readLine());
     void sorting()
          if(choice==1)
               for(i=0;i<10;i++)
                    for(j=i+1;j<10;j++)
                         if(name[i].compareTo(name[j])<=0)
                              String temp=name[i];
                              name[i]=name[j];
                              name[j]=temp;
               System.out.println(name[i]);
          else if(choice==2)
               for(i=0;i<10;i++)
                    for(j=i+1;j<10;j++)
                         if(salary[j].compareTo(salary[i])<=0)
                         double temp=salary[i];
                              salary[i]=salary[j];
                              salary[j]=temp;
               System.out.println(salary[i]);
          else
               System.out.println("Wrong choice!");
     void output()
          System.out.println(" "+name);
          System.out.println(" "+salary);
     public static void main(String arg[])
          Array z=new Array();
          z.input();
          z.sorting();
          z.output();

Hi ,
I have compiled and run the program for you. But it has got design flaws. I can assume that you might be looking for sorting the name and salray for empolyees. But the current design takes name and salary array in two different arrays.
import java.io.*;
import java.util.Arrays;
public class EmpArray
     InputStreamReader a = new InputStreamReader(System.in);
     BufferedReader b = new BufferedReader(a);
     int i,j,choice;
     String name[]=new String[10];
     double salary[]=new double[10];
     private void input()
          try
               for (i=0;i<10;i++)
                    System.out.print("name : ");
                    name=b.readLine() ;
                    System.out.println("salary : ");
                    salary[i]=Double.parseDouble(b.readLine());
               System.out.println("1: Sorting by name");
               System.out.println("2: Sorting by salary");
               System.out.println("Your choice:");
               choice=Integer.parseInt(b.readLine());
          }catch(Exception e)
               System.out.println(" error"+ e.getMessage());
     private void sorting()
               if(choice==1)
                    Arrays.sort(name);
                    System.out.println("Sorted names are ");
                    for (i=0;i<10;i++)
                         System.out.println(name[i]);
               else if(choice==2)
                    Arrays.sort(salary);
                    System.out.println("Sorted salaries are ");
                    for (i=0;i<10;i++)
                         System.out.println(salary[i]);
               else
               System.out.println("Wrong choice!");
     private void output()
                    for (i=0;i<10;i++)
                         System.out.println(name[i]);
                         System.out.println(salary[i]);
     public static void main(String arg[])
               EmpArray z=new EmpArray();
               z.input();
               z.sorting();
               z.output();

Similar Messages

  • From some reason (i'm not sure why..) my whole iphoto library got deleted. I restored the whole library from my backup. The photos are blank but steel have the photo info. (date, res., size etc.) Do you know what's the prob.? why can't i see my pics.

    from some reason (i'm not sure why..) my whole iphoto library got deleted. I restored the whole library from my backup. Now all the photos are blank but steel have the photo info. (date, res., size etc.) Do you know what's the prob.? why can't i see my pics.

    It's says that file does not exist. How come? And why does it still show the image info.?
    Where can i find those files (i have a daily backup)
    The original image files are missing form your iPhoto library or iPhoto cannot find them, because the link to the originals has been broken. The image info is stored in the internal libraries, independent of the original files. That is, why you are still seeing them.
    I restored the whole library from my backup.
    Try restoring from an older backup, from before you first noticed the problem. 
    How large is the library, that you restored? Is the file size large enough to hold all your photos, or has the size been reduced?  If the library is still large, the photos may still be inside, even if iPhoto cannot find them.
    It's says that file does not exist. How come?
    What happened, before your iPhoto library got deleted? Which applications have you been running, or which new software have installed or upgraded?  Have you moved the library to a different disk or tried to use it from different user account or access it over the network?

  • For reorganizing table what is the Probs/Cons & Mandatery checks.

    Hi,
    For reorganizing table on line what is the Probs/Cons & Mandatery checks.
    I will reorganize FAGLFLEX Table ,Present table size 210GB.
    My Questions are
    1.What is the free space required in PSAPSR3 table space.
    2. PSAPTEMP Tables pace required size.
    3. PSAPUNDO Tables pace required size.
    Pleas Help.
    Edited by: Gabriel Samson on Nov 19, 2010 8:43 PM

    Hi,
    For reorganizing table on line what is the Probs/Cons
    Refer Topic# 7 of [SAP Note 541538 - FAQ: Reorganization|https://service.sap.com/sap/support/notes/541538]. This Note address all the questions related to Reorganization.
    First I would check how much wasted space is there for table FAGLFLEXA at database level.
    Run the following SQL commnad to get such result. The result will include Top 40 Tables sorted by Wasted Space due to Table fragmentation.
    The following SQL command is taken from [SAP Note 821687 - FAQ: Space utilization and fragmentation in Oracle|https://service.sap.com/sap/support/notes/821687]. Refer it to get more info.
    First Update Database statistics before executing following query.
    SELECT * FROM
    (SELECT
        SUBSTR(TABLE_NAME, 1, 21) TABLE_NAME,
        NUM_ROWS,
        AVG_ROW_LEN ROWLEN,
        BLOCKS,
        ROUND((AVG_ROW_LEN + 1) * NUM_ROWS / 1000000, 0) NET_MB,
        ROUND(BLOCKS * (8000 - 23 * INI_TRANS) *
          (1 - PCT_FREE / 100) / 1000000, 0) GROSS_MB,
        ROUND((BLOCKS * (8000 - 23 * INI_TRANS) * (1 - PCT_FREE / 100) -
          (AVG_ROW_LEN + 1) * NUM_ROWS) / 1000000) "WASTED_MB"
      FROM DBA_TABLES
      WHERE
        NUM_ROWS IS NOT NULL AND
        OWNER LIKE 'SAP%' AND
        PARTITIONED = 'NO' AND
        (IOT_TYPE != 'IOT' OR IOT_TYPE IS NULL)
      ORDER BY 7 DESC)
    WHERE ROWNUM <=40;
    The result will tell you about how much space benefit you will get, if you reorganize such required tables.
    What is the free space required in PSAPSR3 table space.
    The required Space will be sum of Total Space of Table(s) and the sum of total space of their associated indexes. You can extend the default table space (of table owners) with that required size or You can create new Table space for such big tables and incorporate -n <new_table_sapce> option in Table Reorganization command so that the new table will be created in new table space after successful completion of table reorganization process.
    2. PSAPTEMP Tables pace required size.
    PSAPTEMP will be used during Index Creation activities. So It should be sufficient to handle such activity. Refer SAP Note  659946 to get more info.
    3. PSAPUNDO Tables pace required size.
    PSAPUNDO will be used to store "Before image of last consistent Data" of actual Table Data. In Table reorganization activity Materialized views will be created in default table space of table owner. Such Materialized vies will be used to record all changes of actual Table which happen while Table Reorganization activity.
    Regards,
    Bhavik G. Shroff

  • ACE: a class-map with multiple ports... what about the probe/serverfarm?

    Hello Gilles,
    One question about something I was not able to find in the documentation.
    Lets say I have one class-map which includes 2 ports (in this case https and 5061).
    Can I associate this class-map to just 1 generic serverfarm and probe for both ports or I have to specify 2 serverfarms/rservers/probes?
    So, by not specifying the ports on the rserver, if a request is received on port 443 (or 5061), it is sent to the same respective port on the rserver?
    The same way is valid for the generic probe.  ACE module is able to probe both ports based on the class-map?
    Thanks and have a great day!!
    Giulio.
    probe tcp PROBE_GENERIC_TCP
      description This probe works for all TCP services by inheriting the VIP port.
      interval 15
      faildetect 2
      passdetect interval 15
      passdetect count 2
      open 2
    rserver host SERVER1_ACCESS
      ip address <1AC>
      inservice
    rserver host SERVER2_ACCESS
      ip address <2AC>
      inservice
    serverfarm host ACCESS-SFARM
      probe PROBE_GENERIC_TCP
      rserver SERVER1_ACCESS
        inservice
      rserver SERVER2_ACCESS
        inservice
    class-map match-any OCS_L4ACCESS
      2 match virtual-address x.x.x.176 tcp eq https
      2 match virtual-address x.x.x.176 tcp eq 5061
    policy-map type loadbalance first-match OCS_L4ACCESS
      class class-default
        sticky-serverfarm ACCESS_STICKY
    policy-map multi-match POLICY
    class OCS_L4ACCESS
    loadbalance vip inservice
    loadbalance policy OCS_L4ACCESS
    loadbalance vip icmp-reply active
    connection advanced-options OCS_VIPTIMEOUT
    nat dynamic XXX vlan 503

    Even if you use the 4710 appliance or expect the inheritance in the module software, it's worth considering if this is really what you want. If you keep multiple ports in the L3/L4 class-map you can't handle the services independently. You will have a common serverfarm for both https and 5061. If https service stops on one rserver, the ACE will place that rserver (and not that service) in out-of-operation state and it won't receive any 5061 traffic either. (You have the fail-on-all probe option but I wouldn't say it's a better choice. In that case, https traffic would be sent to the rserver even if https port is closed as long as there is at least one working service on it.) That's why I prefer a separate class-map and separate serverfarm for each service. (They can contain the same rservers, no need to duplicate.) BUT if the software supports probe port inheritance, you can benefit from it even in this scenario: serverfarm-443 and serverfarm-5061 can both use your PROBE_GENERIC_TCP.

  • Gave My IPad to family mem. reset it and reregistered it to their name. Downloaded apps, that now won't open. What's the prob?

    Gave my iPad 2 to a family mem. Reset it and reregistered it in their name. Downloaded apps and now they won't open? Wow , what went wrong?

    A reset may help. Tap and hold the Home button and the On/Off buttons for approximately 10-15 seconds, until the Apple logo reappears. When the logo appears, release both buttons.
    No content is affected by this procedure.

  • When I go to Music Artist, I do not find some Artists,  what's the prob?

    There are some Artists that do not show, the weird thing is that they used to show up. Also some songs do not show when you look in the Artist, but if you make a searh per song (Music >> Song) all songs are there.
    Thanks

    It could also be that the songs are marked as being part of a compilation. If the tracks are ticked in the Get Info>Info tab as part of a compilation, they will not appear under Artist on the iPod. Highlight a song you know is not appearing, from the iTunes File menu, choose Get Info and click the Info tab, if "Part of a Compilation" is marked untick it and afterwards update your iPod, you'll find it now appears as normal. Compilations are stored in a separate folder in iTunes so the songs don't appear inside the normal Artist>Album folder, this means therefore they don't transfer over in the same way.

  • My apps dance open and close on their own in my IPad 2 what can be the prob? I have already restored

    I got the charger flex or pin changed and now the apps dance on the screen, photos open and zoom in, then out, the other apps open and close. I have already restored the device with Itunes and prob is still there. What can be the problem? Any suggestion will be welcome. Thank you

    THANKS for your prompt reply  Bluetooth is off in my laptop and IPhone.. and in fact the reset is the only thing that can make it back to normal. But for a lil while. I wonder if it is the touch, or the home botton... both things are very expensive to replace, so I wouldn't like to spend $$ and continue having the prob.....

  • What is the maximun recommended number of probes, rservers, server-farms

    Team,
    What is the maximun recommended number of probes, rservers, server-farms, class-maps, policy-maps per context on an ACE module?
    Regards,
    John...

    John,
    A practical limit on ACE module is 4k each for probes, serverfarms, class-maps & policy-maps. Rserver instances can be up to 16K. These limits represent total per system. They may exist all in a single context if desired. These numbers will vary based on specific configuration requirements.
    For more specific guidance please reach out to your account team or technical marketing engineer.
    Other resource info can be found under Cisco Application Control Engine (ACE) Troubleshooting Guide -> ACE Module Resource Limits:
    http://docwiki.cisco.com/wiki/Cisco_Application_Control_Engine_%28ACE%29_Module_Troubleshooting_Guide%2C_Release_A2%28x%29_--_ACE_Module_Resource_Limits
    DocWiki for ACE:
    http://docwiki.cisco.com/wiki/ACE
    HTH.

  • Im using iphone4. It suddenly turns off if not plugged in. It will only turn on once its plug in again.As pr tech, if its battery prob, then it would nt turn on completely. What do u think is the prob ?

    Im using iphone4. It suddenly turns off if not plugged in. It will only turn on once its plug in again.As per tech, if its battery prob, then it would not turn on completely. What do u think is the prob ?

    cutieliz wrote:
    What do u think is the prob ?
    The battery

  • My macbook pro shuts down and doesnt let me turn it on after a few days i try to turn it on and it works but then after a few hours or so of using it it turns off again and the cycle of me waiting days to turn it back on happens again whats the prob?

    my macbook pro shuts down and doesnt let me turn it on after a few days i try to turn it on and it works but then after a few hours or so of using it it turns off again and the cycle of me waiting days to turn it back on happens again whats the prob?

    If you haven't already done so, try this simple step first.

  • I want to create a TTL pulse. The stepper motor I'm trying to control responds to a high to low edge, when the low pulse width is greater than 0.5 microsecon​ds. What is the best way to go about creating a pulse like this?

    I'm using the NI PCI-6025E card connected to an SCB-100 wiring peripheral. I'm programming the DAQ card using LabVIEW 6.0.2 on a win95 box.
    My first attempt has yielded some surprising results.
    I created a vi with a single while loop set to true. Within that while loop is a two frame sequence. Both frames use the "Write to Digital Line.vi".
    The first frame sets the line in wire to false.
    The second frame sets the line in wire to true.
    The device channel on both frames has been set to my user defined channel nam
    e -> clock.
    clock --> sets the DIO0 channel to be digital write out.
    Using an oscilloscope and some wires I hook ground to the SCB-100's digital ground and I hook the probe to the DIO0 channel. What I see are two different pulses alternating between one another. One has a pulse width of 5ms and the other has a pulse width of about 50ms. You seem to get a grouping of one type of pulse followed by a grouping of the other type of pulse.
    Obviously this is very strange and not what I want. It is also far too slow. So I'd like to know if anyone knows how to do this properly. Remember I only need a low pulse width of 0.5 microseconds.
    Thanks,
    Any help or guidance would be much appreciated.
    Scott

    Scott,
    You don't need to use a digital line to create a TTL pulse. The PCI-6025E has two onboard general purpose counters. You can use one of these counters to create a single pulse of the desired pulse width. For an example of how to program the counters on your board, refer to LabVIEW's Search Examples>>I/O Interfaces>>Counters>>Pulse Generation>>DAQ-STC based.
    The advantage of using a counter over the digital line is that it allows you to control the timing of the pulse through hardware and not software. Thus, it is inherently faster, and the timing resolution is more accurate. The counter will count down an internal 20 MHz timebase to create the pulse delay and the pulse width.
    For more information on the hardware capabilities of your board, you can refe
    r to the User Manual online at www.ni.com/manuals.
    Hope this helps.
    Regards,
    Erin

  • What's the best way to load balance multiple protocols on one vserver?

    Hi,
    We have a CSM blade on a 6513, in bridge mode. I'm just wondering what is the best way to serve HTTP and HTTPS (or any two or more ports) from the same group of servers. As I see it, we have two options:
    1. Don't set a port on the vserver, so it is load balancing "any" or "tcp". This is easy but I want to be sure there isn't a downside to this, other than the obvious security issue.
    2. Create multiple vservers and point them at the same serverfarm. I tried this and I got some odd results with the health checks.
    Any ideas? Thanks a lot.

    you listed the only 2 options available.
    The advantage of solution #2 is that you can apply specific config for each protocol ie: for HTTP you can turn 'persistent rebalance' if needed.
    If you want to use specific probes [not icmp], it is also a good practice to create a different serverfarm for each protocol.
    Like this, if the HTTP service goes down but not the server, you can still have other protocols loadbalanced.
    Regards,
    Gilles.
    Thanks for rating this answer.

  • Hey, i have very strange prob with my iphone 5(latest version/updated), after resetting it, so it doesn't connect to my laptop, even it doesn't charge too. it does charge from wall charger i try all the possible methods but still i am facing the prob

    Hey, i have very strange prob with my iphone 5(latest version/updated), after resetting it, so it doesn't connect to my laptop, even it doesn't charge too. it does charge from wall charger i try all the possible methods but still i am facing the prob any fix/solution for it.. Helppppp!!!!!!!!!!!!!!!!!!!!!!!! As soon as possible, it will be gratefulness,
                                Thnksssssss....

    So you are saying that you followed all of the steps in the support document for problems with connection, including removing and reinstalling iTunes? You do not say what you have tried, so it is hard to make recommendations. If this is the case, then you have tried resolving driver issues? What if you go to Device Manager and look for the iPhone. You should be able to click on it and see about drivers. You can update/reinstall the device driver.

  • In a RT motion and data system, what is the best variable handling structure(s)?

    I built a system that applies motion control to two axes and also takes data from a third axis encoder. 
    The program structure is parallel timed loops (one motion control loop, one data collection loop, one host communication loop) with front panel.
    This is targeted to a RT target; there is no host program.
    Now I am using global variables to pass information between the loops and for exchanging information with the front panel indicators and controls.  I think this is a suboptimal solution.  I am considering the following changes:
    1) For communicating variable values (such as commanded velocity and position) to the motion loop, I will replace the global variable structures with onboard variables in the motion card memory.
    2) For saving the data collected from the third axis, I will use an RT-FIFO structure in the RT controller memory.
    3) I will eliminate the front panel from the RT program and create a separate user interface program targeted to the host PC.  Communication between these programs will be accomplished using the Simple TCP/IP Messaging Protocol as described in this document:
    http://zone.ni.com/devzone/conceptd.nsf/webmain/0986799C984500F886256F170079411E
    Global variables will be replaced with Motion onboard variables.
    Before I start this chore, am I following the best practice?  Any advice on improving any aspect of this plan?
    My System:
    Windows XP on P4 PC ethernet to
    PXI-8187 RT Controller
    PXI-7350 Motion Control board
    (2) servo axes with quadrature feedback
    (1) additional quadrature encoder used as measuring probe
    I do not have a DAQ card in this system.
    Thank you!
    Laine

    Thanks Kristi.  I understand your recommendation.
    Some of my variable instances are 4 or 5 SubVIs deep.  For instance, the main high priority loop calls MOVE.vi which calls CALC_ANGLE.vi, which calls CALC_MOVETIME.vi which calls CALC_VELOCITY.vi which uses the variable Initial_velocity.  If Initial_velocity is received from the host in the main program, passed to the high-priority loop using an RTFIFO, then bundled and kept in a shift register, what is the best way to get that information down where I need it?
    Not only will I have to redeclare the RT-FIFO in each subVI, but I will also need to pass the reference value cluster down the chain as well?  This sounds messy and computationally expensive to me.  So my choices might be
    1) Eliminate subVIs and bring everything to the top.  This is a rather large program, so could make quite an extensive top vi if all code is in one place.
    2) Use onboard variables to store and pass values.  Are these less deterministic than RTFIFOs?  What is their primary purpose if not to pass data, or are they just to be used with motion card onboard programming?
    3) Use global variables, but I think these are not deterministic.
    4) Bite the bullet and pass the variable cluster down through the SubVI chain.  Is there an easier way to do this than what I describe above?
    Have I made any bad assumptions or overcomplications?
    Thanks.
    Laine

  • What are the jar files needed for HTMMLB?

    Hi,
    I have imported a HTMLB comp par file into my NWDS.
    it is showing me some errors like com.sapportals.htmlb cannot be resolved...what may be the prob...do i need to import any jar files regarding this.
    Plz help..
    Thanks,
    Viswes

    Hi,
    Please see this helpful link
    New Reference for Portal APIs
    Ramganesan Karuppaiyah

Maybe you are looking for

  • COPA DS enhancement

    Hi, I want to enhance COPA DS. Normally the operating concern has to be modified and the the COPA DS needs to be recreated after deleting the old one. But my client doesnt want that operating concern should be touched. he is ok if i append the extrac

  • I have a question whether I am using the correct IIf statement in SSRS?

    I have created a report with columns for case name, date opened, staff assigned, title, contact date, created by, and comments. I also have selected the comment_type field for the sake of indicating which data to pull but it will not be listed on the

  • Can you modify itunes "restore feature" so that i can restore my ipod to 5.1.1 as in itunes it also updates it.

    i want to downgrade my ipod to 5.1.1.  If you can please modify itunes so that while restoring my ipod , itunes does not automatically upgrade it but make it return to the original version which is much better than ios 6.0.1 as it is slower, i don't

  • Show pixel dimensions during crop

    Good Morning, I need to be able to see the pixel dimensions while I'm cropping.  I clicked on the "Info" pallet and it shows this in inches, however, I didn't see how to change it to pixels.  For some website work I need to set images to specific pix

  • ARD 2.2 is a mess... Scanner broken

    Apple please get this one right... This software stinks! I've had countless problems with prior versions on 10.3 and 2.1 and now with 2.2 and 10.4 I'm having this issue with the the scanner not picking up all of my clients on my local subnet. It pick