2023 Java Programming 1 Create a class called Project8 and implement the following methods | Assignment Collections

Computer Science 2023 simple java program

2023 Java Programming 1 Create a class called Project8 and implement the following methods | Assignment Collections

Java Programming

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

 

When next Guess and lastGuess are almost identical, nextGuess is the approximated square root.

        The initial guess can be any positive value (e.g., 1). This value will be the starting value for lastGuess. If the difference between nextGuess and lastGuess is less than a very small number, such as 0.0001, you can claim that nextGuess is the approximated square root of num. If not, nectGuess becomes lastGuess and the approximation process continues.

d.      (Convert form decimal to other bases) Write a method that converts decimal numbers to other bases (binary, octal, hexadecimal).

 

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

 

 


 

A sample run is as follows:

8! is: 40320

Value of pi is 3.1415826535898224

Square root of 16 is 4.000000000000051

125 in Binary is 1111101

125 in Octal is 175

125 in Hexadecimal is 7D

 

We give our students 100% satisfaction with their assignments, which is one of the most important reasons students prefer us to other helpers. Our professional group and planners have more than ten years of rich experience. The only reason is that we have successfully helped more than 100000 students with their assignments on our inception days. Our expert group has more than 2200 professionals in different topics, and that is not all; we get more than 300 jobs every day more than 90% of the assignment get the conversion for payment.

Place Order Now

#write essay #research paper #blog writing #article writing #academic writer #reflective paper #essay pro #types of essays #write my essay #reflective essay #paper writer #essay writing service #essay writer free #essay helper #write my paper #assignment writer #write my essay for me #write an essay for me #uk essay #thesis writer #dissertation writing services #writing a research paper #academic essay #dissertation help #easy essay #do my essay #paper writing service #buy essay #essay writing help #essay service #dissertation writing #online essay writer #write my paper for me #types of essay writing #essay writing website #write my essay for free #reflective report #type my essay #thesis writing services #write paper for me #research paper writing service #essay paper #professional essay writers #write my essay online #essay help online #write my research paper #dissertation writing help #websites that write papers for you for free #write my essay for me cheap #pay someone to write my paper #pay someone to write my research paper #Essaywriting #Academicwriting #Assignmenthelp #Nursingassignment #Nursinghomework #Psychologyassignment #Physicsassignment #Philosophyassignment #Religionassignment #History #Writing #writingtips #Students #universityassignment #onlinewriting #savvyessaywriters #onlineprowriters #assignmentcollection #excelsiorwriters #writinghub #study #exclusivewritings #myassignmentgeek #expertwriters #art #transcription #grammer #college #highschool #StudentsHelpingStudents #studentshirt #StudentShoe #StudentShoes #studentshoponline #studentshopping #studentshouse #StudentShoutout #studentshowcase2017 #StudentsHub #studentsieuczy #StudentsIn #studentsinberlin #studentsinbusiness #StudentsInDubai #studentsininternational