Online Hibernate Training just in Rs. 1000

One week online training in Hibernate ORM framework. Learn Hibernate Framework and enhance your skills. Best Online Hibernate training at 90% discount. Join Now!! Offer is valid Only for limited Period!!! Online Training Big Data and Hadoop Training Java Training  
 

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

Ads

 
 

Share on Google+Share on Google+

MD MidoO
could someone help in this ........
3 Answer(s)      6 years and 3 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

Ads
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.


Ads









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
to the user) please tell me how could i design that. Please help me asap Thanks a lot
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 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
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 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
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
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
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
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 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
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