KnowledgeBoat Logo

Java Series Programs

  • User Defined Methods

    Design a class to overload a function series( ) as follows:

    (a) void series(int a, int n) — To display the sum of the series given below:

    a - (a/2!) + (a/3!) - (a/4!) + …… n terms

    (b) void series(int n) — To display the sum of the series given below:

    1/2 - 2/3 + 3/4 - 4/5 + …… n terms

    Write a main method to create an object and invoke the above methods.


  • User Defined Methods

    Using switch statement write a menu driven program to overload a function series as follows:

    (a) void series() — To find and display the sum of the following series:
        S = 2 - 4 + 6 - 8 + 10 ….. - 20

    (b) void series(int n, int x) — To find and display the sum of the following series:
        S = (x2 / 1!) + (x4 / 3!) + (x6 / 5!) + ……. to n terms


Showing 61 - 62 of 62 Questions