The JAVA club

coolshano

Well-known member
  • Sep 1, 2007
    14,327
    618
    113
    N/A
    members that r in our JAVA club...

    hasiwarna
    crazycombo
    hishan1983
    50Cent_SL
    Wolverine GTR
    ~Girl of Twilight~
    Gayan88'
    cjb
    nagaya
    wajiras
    ¤--bACarDi--¤
    fviran'
    TDM
    shiwankaswe
    rochel1977
    jeffhardy
    amilabanuka
    coolshano
     

    coolshano

    Well-known member
  • Sep 1, 2007
    14,327
    618
    113
    N/A
    amilabanuka said:
    sams ge eka java igena ganna sira
    eke hama pattama thiyenawa
    SCJP ekata nam kathi sierra ge potha thama sirama eka.... eka passe reference book ekak widiyatat hoda hinda gattata padu na.

    machan where can i buy the book??
     

    coolshano

    Well-known member
  • Sep 1, 2007
    14,327
    618
    113
    N/A
    amilabanuka said:
    expographic eke thiyenawa

    kotuwa
    battaramulla
    UOM

    owa thama mama danna barnches expographic eke... potha thiyenaw ganna

    kotuwe eka
    53 2/3 Second Floor Munsoor Building,
    Mainstreet,Colombo 11

    thanks machan.. book eka kiyak vithara weida?
     

    coolshano

    Well-known member
  • Sep 1, 2007
    14,327
    618
    113
    N/A
    amilabanuka said:
    ganan mathaka na machnan hariyata
    tika kalayak aragen
    1300 wage mathaka

    ehenam ela...
    mata thiyenawa study guide ekak... just wanna get some extra knowledge...
     

    rochel1977

    Well-known member
  • May 15, 2006
    11,466
    2,673
    113
    AKL, NZ and Kandy
    here are some basic java programs. any body can try these on j creator and post the coding so others also can get an idea. :yes:

    1st one

    Write a program that contains the following two methods:

    //to convert from feet to meters
    public static double footToMeter(double foot)

    //to convert from meters to feet
    public static double meterToFoot (double meter)

    The formula of the conversion is: meter = 0.305 * foot

    The program will prompt user to select which conversion to use and enter the value.

    2nd One

    Write a program that reads ten numbers, computes their average and finds out how many numbers are above the average. (Apply array)
     

    amilabanuka

    Well-known member
  • Sep 30, 2006
    7,291
    878
    113
    Thama math hoyanooo....
    rochel1977 said:

    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);
        }
    }

    how is this one?
     

    rochel1977

    Well-known member
  • May 15, 2006
    11,466
    2,673
    113
    AKL, NZ and Kandy
    amilabanuka said:
    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);
        }
    }

    how is this one?

    nice work machan. will see others coding also. :yes: