Java SquareRoot Factorial Pi and Decimal Conversion program Programming

Feb 3rd, 2012
Studypool Tutor
Price: \$10 USD

Tutor description

1. Create a class called Project8 and implement the following methods:
a. (factorial) write a method that calculates and return n!
b. (computing Π(pi)) You can approximate Π by using the following series:
Π = 4(1 – 1/3 + 1/5 – 1/7 + 1/9 – 1/11 + …. + 1/2n-1 – 1/2n+1)
Write a method called pi, that given n, calculates and return value of Π
c. (Approximating the square root) Implement the sqrt method. The square root of a number, num, can be approximated be repeatedly performing a calculation using the following formula:
nextGuess = (lastGuess + (num / lastGuess)) / 2
2. Write a main method to the following:

a. Calculates and prints value of Π for n=10000
b. Calculate and print square root of 16
c. Convert 125 to binary, octal, and hexadecimal

Word Count: 160
Showing Page: 1/1
package com.company;public class Program8 { private static double factorial(int n) { int factorial = 1; // this will be the result for (int i = 1; i <= n; i++) { factorial *= i; } return factorial; } private static double

Review from student

Studypool Student
" Top quality work from this guy! I'll be back! "

1823 tutors are online

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors