Advanced Programming and Concept
Assignment 4
Please Create a class called Series with the following static
methods:
• nSum(int n) returns the sum of all numbers from 0 to n.
• factorial(int n) returns the product of all numbers from 1 to n.
• fibonacci(n) returns the nth Fibonacci number.
• Please create a Driver class to test your Series class.
• Please add author information and program description and nec-
essary comments for your Series class.
2 Create your own Package: JAR file.
• When you have tested your Series class with Driver class, please
delete the Driver class.
• Please create a jar file with a descriptive name for your Series
class.
• Create a new project and add your Series library, then test the
three methods in your driver class of your new project.
3 When I grade, I will add your jar file to my project. Then,
I am going to use the following Driver Class to test your
package.
import packagename.Series;
public class Driver {
public static void main(String[] args) {
for(int i = 0; i <= 10; i++){
System.out.print(Series.nSum(i) + " ");
}
System.out.println("");
//Output: 0 1 3 6 10 15 21 28 36 45 55
for(int i = 0; i <= 10; i++){
System.out.print(Series.factorial(i)+" ");
}
System.out.println("");
//Output: 0 1 2 6 24 120 720 5040 40320 362880 3628800
for(int i = 0; i <= 10; i++){
System.out.print(Series.fibonacci(i) + " ");
}
//Output: 0 1 1 2 3 5 8 13 21 34 55
}
}
4 Submission
Run your program make sure it is working correctly.
Please submit your jar file
packagename.jar
to