Page 109 - CA_Blue( J )_Class10
P. 109

12               s=(a+b+c)/2.0;
                  13               area=Math.sqrt(s * (s-a) * (s-b) * (s-c));

                  14               perimeter=a+b+c;
                  15               System.out.println("Area of the Scalene Triangle: "+area);

                  16               System.out.println("Perimeter of the Scalene Triangle: " +perimeter);
                  17           }

                  18       }
                 You will get the following output:















                                Let’s Revisit



                       ®  User-defined methods are created by programmers according to the need of the program.
                       ®  Library methods are already defined in the Java compiler and kept in some classes.
                       ®  Java provides a vast variety of packages that contain a huge library of built-in classes.
                       ®  The Math class in Java provides different types of mathematical methods.





                                                              MIND DRILL






                      Solved Questions


                 A.  Tick ( ) the correct answer.

                    1.  Which of the following is the main advantage of using a method?
                       a.  It can be reused                            b.  It cannot be reused
                       c.  Make programs tough                         d.  It cannot be compiled
                    2.  Which of the following types of methods are already defined in the Java compiler and kept in some packages?
                       a.  User-defined                                b.  Library
                       c.  Both a and b                                d.  None of these
                    3.  Which of the following class provides mathematical methods?
                       a.  Scanner                                     b.  InputStreamReader
                       c.  Math                                        d.  Graphics
                    4.  The Math.min( ) method is used to find the minimum number between ………………… number arguments.
                       a.  2                                           b.  3
                       c.  Infinite                                    d.  Fixed


                                                                                                                       107
                                                                                          Mathematical Library Methods   107
   104   105   106   107   108   109   110   111   112   113   114