Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners could someone help in this ........
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


MD MidoO
could someone help in this ........
3 Answer(s)      3 years and 7 months ago
Posted in : Java Beginners


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


Advertisement
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
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
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
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
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 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
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  
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
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 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
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
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
help
to the user) please tell me how could i design that. Please help me asap Thanks a lot
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
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
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
help
help   how i can send a pitcture on url in java
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
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!  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
Advertisements
 

 

 

DMCA.com