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



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

Have Programming Question? Ask it here!
 
 
 


MD MidoO
could someone help in this ........
3 Answer(s)      3 years and 2 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 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
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
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
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
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!  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
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
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
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
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.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
could not find the main class programm will exit - error
could not find the main class programm will exit - error  when i tried to run the below mentioned programmed it gives a error states - could not find main class programm will exit. class Car { String name: String Color
Could not read mappings from resource: e1.hbm.xml - Hibernate
Could not read mappings from resource: e1.hbm.xml  ... EXECUTING IS log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. Could
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
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
How could we get log file as simple text format
How could we get log file as simple text format  Above given javaerrorlog creates the log file in xml code how could we get it in simple text Manmohan
Error 500: WSWS3142E: Error: Could not find Web services engine. - WebSevices
Error Could not find Web services engine   Hi...: faultNode: faultDetail: {}:return code: 500 Error 500: WSWS3142E: Error: Could not find Web services engine. { http://xml.apache.org/axis
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
does anybody could tell me who's the author - Struts
does anybody could tell me who's the author  does anyone would tell.... would you please tell how could I contact with the author ? thanks the author's hard-working !! thanks roseindia  you could send me mail
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
Advertisements
 

 

 

DMCA.com