could someone help in this ........

could someone help in this ........

dear Sir/Mrs I'll be thankful for helping me on this .......

write a program that reads 10 numbers. find the largest number and count the occurrence of the largest number from a declared array. assume the assigned 4.6.3.2.5.6.6.1 and 6. the program will display the largest number os 6 and the count is 5.

note: 1-display the number in ascending order 2-display the number in descending order 3-display the total, average and the largest number

View Answers

May 25, 2011 at 10:44 AM

import java.util.*;
class  ArrayExample12{
        public static void main(String[] args){
        int sum=0,count=0;
        Scanner input=new Scanner(System.in);
        System.out.println("Enter Array Elements: ");
        int array[]=new int[10];
        for(int i=0;i<array.length;i++){
            int num=input.nextInt();
            array[i]=num;
        }
        int maxValue = array[0];
        for(int i=1;i < array.length;i++){
        if(array[i] > maxValue){
        maxValue = array[i];
        }
        }
        for(int i=0;i<array.length;i++){
            sum+=array[i];
            if(array[i]==maxValue){
                count++;
            }
        }
        System.out.println("Sum Of Numbers is: "+sum);
        System.out.println("Average of Numbers is: "+sum/array.length);
        System.out.println("Largest No: "+maxValue+" which occurs "+count+" times.");
        Arrays.sort(array);
        System.out.println("Numbers in increasing order: ");
        for(int i=0;i<array.length;i++){
          System.out.println(array[i]);
        }
        System.out.println("Numbers in decreasing order: ");
        for(int i=array.length-1;i>=0;i--){
          System.out.println(array[i]);
        }
    }
}

May 25, 2011 at 3:36 PM

Thank u very much ...... :)


June 8, 2011 at 6:50 AM

could u put the "numbers in increasing order" and the "number in decreasing order" in one line ?? EX numbers in increasing order 1.2.3.4.5.6.7.8.9.10.









Related Tutorials/Questions & Answers:
could someone help in this ........
could someone help in this ........  dear Sir/Mrs I'll be thankful for helping me on this ....... write a program that reads 10 numbers. find the largest number and count the occurrence of the largest number from a declared
Could someone Possibly help me with this
Could someone Possibly help me with this   think of a number and allow the user to guess it import java.util.*; public class ThinkNumber { public static void main (String args[]) { //generate number in range 1
Advertisements
Can someone help me with this?
Can someone help me with this?  I have this project and i dont know how to do it. Can someone help me? please? Write a java class named "PAMA..., Multiply, Divide) Help me please! Thanks in advance!   import
need someone to do/help with code
need someone to do/help with code  i need someone to do a code for me. It is a restaurant menu that displays a list of 10 food items. A customer..., along with the number of items sold..please help did a code 500 times cant
could any one help me?
could any one help me?  I'm a student in the faculty of computer and information science we will make graduation project "taxi dispatcher" we need to use mobile "x6 nokia" in car and send the coordinate of car through gps which
could anyone please help with the code.
could anyone please help with the code.  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException...(request, response); } } could anyone please check the code. If i enter
PLZ Need some help on the 2nd part of this question...Someone please help !!!!
PLZ Need some help on the 2nd part of this question...Someone please help !!!!  write an application that displays a menue of three items in a restaurant as follows: 1.Cheeseburger 4.99 2.Pepsi 2.00 3.Chips 0.75 prompt the user
help
verification mail to the user) please tell me how could i design that. Please help me
ModuleNotFoundError: No module named 'could'
ModuleNotFoundError: No module named 'could'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'could' How to remove the ModuleNotFoundError: No module named 'could'
ModuleNotFoundError: No module named 'could'
ModuleNotFoundError: No module named 'could'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'could' How to remove the ModuleNotFoundError: No module named 'could'
help
help   how i can send a pitcture on url in java
help
help  pls help me to get the code of a java program a program to perform different shapes in a menu using javaapplet
help
help  i need help with this code. write a java code for a method named addSevenToKthElement that takes an integer array, and an integer k as its arguments and returns the kth element plus 7. any help would be greatly
HELP
HELP  I need this code to open in a new web browser. but no matter what i do it wont please help?? Directive 055 Storage Requirements for the Upstream Petroleum Industry
Help...
Help...  Write a class that displays your first name vertically down the screen â?? where each letter uses up to 5 rows by 5 columns of a character input by you with a blank line between each letter
Help
Help   i have a html file.. i have take input and store in database .. Tell me the steps to perform.. i have xampp it includes mysql,tomacat,apache. and how display the data from datbase .. please explain
Help!
Help!  thanks for ur code, I'd like to ask a question: after press "c" or "C", timer starts and after every delay ms, it'll print "This line is printed only once." or just print once. I'm writting a timer but it seems to perform
Help
Help  Hi; Can anyone help me to solve this errors. I use J2ME(wirlesee Toolkit 2.5.2. for CLDC Project "SlideImageMIDlet" loaded Project settings saved Building "SlideImageMIDlet" C:\Documents and Settings\???? ?????\j2mewtk
help
based on the percentage of cheating. please help me
could not connect to the server - JDBC
could not connect to the server  Hii sir, I am working with a JBDC program now. Now i am trying to host it. when i am trying to connect... can we manage this.. Please help me..... Regards Sreejith  
help!!!!!!!!!!!!!!!!!!
help!!!!!!!!!!!!!!!!!!  import java.awt.; import java.sql.*; import javax.swing.*; import java.awt.event.* public class NewJFrame extends javax.swing.JFrame { JTextField1
could not start server. - EJB
could not start server.  Dear All I have installed netbeans 5.5.1 and sun java Application server 9.2 to run ejb program. But when I start... comes ---sun java server could not start. so what should I do to start this server
How could I use Socket in my application?
How could I use Socket in my application?  I created an application... out today that I have to use also Socket and I don't know exactly what I could do with it in my project. Sorry for being too general. But maybe someone has
NoClassDefFoundError: Could not initialize class com.net.plugin.HibernatePlugIn - Struts
NoClassDefFoundError: Could not initialize class com.net.plugin.HibernatePlugIn  Could not initialize class com.net.plugin.HibernatePlugIn... But its giving error such like NoClassDefFoundError: Could not initialize class
Could not parse configuration: hibernate.cfg.xml
Could not parse configuration: hibernate.cfg.xml  Hi, I am getting the error- log4j:WARN No appenders could be found for logger.... Exception in thread "main" org.hibernate.HibernateException: Could not parse
please i want someone to answer me pleeeeeeeeeeeeease...
please i want someone to answer me pleeeeeeeeeeeeease...    Write a JAVA program using 2D array to auto-grade exams. For a class of N students, your program should read letter answers (A, B, C, D) for each student. Assume
Please help me understand this query
Please help me understand this query  Hi, Could someone please help me understand the following query. Im finding difficulty relating it :-( Pls Help! select * from cbpartner where CBPartner.IsSummary='N' and salesrep_id
need someone do it for me plz..people
need someone do it for me plz..people  write an application that displays a menue of three items in a restaurant as follows: 1.Cheeseburger 4.99 2.Pepsi 2.00 3.Chips 0.75 prompt the user to choose
Could not establish the connection to oracle - JDBC
Could not establish the connection to oracle  Hi Friends, I am... getting error like: java.sql.SQLEXception:IO exception:The Network Adapter could...=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","scott","puppy"); please help
Regular Expression Help Help HELP!!!!
could help me to give a solution of how to retrieve the name and email add...Regular Expression Help Help HELP!!!!  HI all I am very new to java... the quotes ""07001", "MR Harish Ram","M.RHarish @ hotmail.com"" Help is greatly
org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator  I am getting the following exception while running Hibernate example, pls..." org.hibernate.MappingException: could not instantiate id generator
Could not open JPA EntityManager for transaction
Could not open JPA EntityManager for transaction  Hi, I am getting following error: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException
org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator  I am getting the following exception while running Hibernate example, pls..." org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator  I am getting the following exception while running Hibernate example, pls..." org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator
org.hibernate.MappingException: could not instantiate id generator  I am getting the following exception while running Hibernate example, pls..." org.hibernate.MappingException: could not instantiate id generator
C++ Starter needs help :S
to program. im looking for someone that could show me and answer all my questions abaut C++. Please help! :(   Please visit the following link: C...C++ Starter needs help :S  Hi, im 15 & im trying to learn how
Could not able to load jar file - WebSevices
Could not able to load jar file  Hi, I tried to parse the xml file to a java object. I followed the procedure that you have mentioned... help me
could not find a getter for id in contact class
could not find a getter for id in contact class   could not find a getter for id in contact class
MySQL server PID file could not be found! [FAILED]
MySQL server PID file could not be found! [FAILED]  MySQL server PID file could not be found! [FAILED
java help!
java help!   I need help starting off a program I am trying to write for class. The class should contain a private instance variable to represent... celsius.There are more methods but I would prefer to try them myself! Can someone please
Error 500: WSWS3142E: Error: Could not find Web services engine. - WebSevices
Error 500 WSWS3142E Error Could not find Web services engine  Hi all, I am getting the following error.Error 500: WSWS3142E: Error: Could not find Web services engine. Please Help. Thanks in Advance
org.hibernate.InvalidMappingException: Could not parse mapping document - Hibernate
org.hibernate.InvalidMappingException: Could not parse mapping document  Hi, i got error while i am executing this program please help me. Error code is below. log4j:WARN No appenders could be found for logger
HELP Java as a starter!
HELP Java as a starter!  I feel like my mind is going to blow! I... programming with Java and I cant find a guide that?s neat. In till someone told me to read... wasn't really needed to make game you could have just read 300 of the 1600 pages
Need someone to check and modify my simple code - Java Beginners
Need someone to check and modify my simple code   How to write a class that contains Variables that hold hourly rate of pay, number of hours worked. Display gross pay, withholding tax, which is 15% and net pay. I have tried
could not execute native bulk manipulation query
could not execute native bulk manipulation query  I am insert data in mysql through struts hibernate integration. But above error is coming. Please help me I am sending our Insert Class coding My Insert class coding package
Need Help in Java programming
Need Help in Java programming  Hello. Can someone please help me with writing the following program Java program that gives assignment details such as:assignment number,assignment name,due date,submission date,percentage marks
Specified JDBC Driver com.mysql.jdbc.Driver could not be loaded
Specified JDBC Driver com.mysql.jdbc.Driver could not be loaded  Hi... com.mysql.jdbc.Driver could not be loaded Exception in thread "main... com.mysql.jdbc.Driver could not be loaded
org.hibernate.MappingException: Could not read mappings from resource:
org.hibernate.MappingException: Could not read mappings from resource: ...: org.hibernate.MappingException: Could not read mappings from resource: hbmxml/login.hbm.xml please guide me what could be the probs. thanks in advance
Specified JDBC Driver com.mysql.jdbc.Driver could not be loaded
Specified JDBC Driver com.mysql.jdbc.Driver could not be loaded  Hi... com.mysql.jdbc.Driver could not be loaded Exception in thread "main... com.mysql.jdbc.Driver could not be loaded
STRUTS 2 Could not find action or result
STRUTS 2 Could not find action or result  hiii..i am new to struts 2... on my log: WARNING: Could not find action or result There is no Action...;/html> plzz help me out...i might have problem in my struts.xml...its

Ads