Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Ad icon
ZTE MF283U 4G Unlocked Router (Used)
ayanthamaxi
Updated:
Sunday at 8:26 PM
ලංකාවේ හොඳම උපකාරක පන්ති සහ ගුරුවරුන් එකම තැනකින් - TopTuition.lk
dulithapathum
Updated:
Saturday at 8:07 AM
Colombo
RidhMathraa ’26 🎶✨
Tmadhusanka
Updated:
Jul 15, 2026
Ad icon
Colombo
PXN V10 Pro Direct Drive Racing Wheel (Under Warranty)
Abdur Rahman
Updated:
Jul 15, 2026
Ad icon
USDT ණය සේවාව - USDT Loan Service
පුරවැසියා
Updated:
Jul 15, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Tabloid
The JAVA club
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="amilabanuka" data-source="post: 3998353" data-attributes="member: 5836"><p>[CODE]/*</p><p> * To change this template, choose Tools | Templates</p><p> * and open the template in the editor.</p><p> */</p><p>package averagefinder;</p><p></p><p>import java.io.BufferedReader;</p><p>import java.io.IOException;</p><p>import java.io.InputStreamReader;</p><p></p><p>/**</p><p> *</p><p> * @author Amilaa</p><p> */</p><p>public class AvgFinder {</p><p></p><p> private int[] numberList;</p><p> private int numberOfValuesMoreThanAerage;</p><p> private BufferedReader reader;</p><p> private static final int NUMBER_OF_VALUES = 10;</p><p></p><p> public static void main(String[] args) {</p><p> new AvgFinder().calculate();</p><p> }</p><p></p><p> public void calculate() {</p><p> numberOfValuesMoreThanAerage = 0;</p><p> reader = new BufferedReader(new InputStreamReader(System.in));</p><p> numberList = new int[NUMBER_OF_VALUES];</p><p> int total = 0;</p><p> for (int counter = 0; counter < NUMBER_OF_VALUES; counter++) {</p><p> while (true) {</p><p> System.out.println("Enter the number " + (counter + 1) + " : ");</p><p> try {</p><p> String input = reader.readLine();</p><p> try {</p><p> int value = Integer.parseInt(input);</p><p> numberList[counter] = value;</p><p> total += value;</p><p> break;</p><p> } catch (NumberFormatException e) {</p><p> System.out.println("That is not a number");</p><p> continue;</p><p> }</p><p> } catch (IOException ex) {</p><p> ex.printStackTrace();</p><p> }</p><p> }</p><p> }</p><p> int avg = total / NUMBER_OF_VALUES;</p><p> for (int number : numberList) {</p><p> if (avg < number) {</p><p> numberOfValuesMoreThanAerage++;</p><p> }</p><p> }</p><p> System.out.println("number of values more than the average =" + numberOfValuesMoreThanAerage);</p><p> }</p><p>}</p><p>[/CODE]</p><p></p><p>how is this one?</p></blockquote><p></p>
[QUOTE="amilabanuka, post: 3998353, member: 5836"] [CODE]/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package averagefinder; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * * @author Amilaa */ public class AvgFinder { private int[] numberList; private int numberOfValuesMoreThanAerage; private BufferedReader reader; private static final int NUMBER_OF_VALUES = 10; public static void main(String[] args) { new AvgFinder().calculate(); } public void calculate() { numberOfValuesMoreThanAerage = 0; reader = new BufferedReader(new InputStreamReader(System.in)); numberList = new int[NUMBER_OF_VALUES]; int total = 0; for (int counter = 0; counter < NUMBER_OF_VALUES; counter++) { while (true) { System.out.println("Enter the number " + (counter + 1) + " : "); try { String input = reader.readLine(); try { int value = Integer.parseInt(input); numberList[counter] = value; total += value; break; } catch (NumberFormatException e) { System.out.println("That is not a number"); continue; } } catch (IOException ex) { ex.printStackTrace(); } } } int avg = total / NUMBER_OF_VALUES; for (int number : numberList) { if (avg < number) { numberOfValuesMoreThanAerage++; } } System.out.println("number of values more than the average =" + numberOfValuesMoreThanAerage); } } [/CODE] how is this one? [/QUOTE]
Insert quotes…
Verification
Hath warak paha keeyada? (hatha wadikireema paha)
Post reply
Top
Bottom