Answered step by step
Verified Expert Solution
Question
1 Approved Answer
THE FOLLWING PROGRAM MUST BE WRITTEN IN JAVA , ITS A CHAPTER ONE ASSIGNMENT SO YOU MUST ONLY USE METHODS IN CHAPTER 1 !!!! AND
THE FOLLWING PROGRAM MUST BE WRITTEN IN JAVA , ITS A CHAPTER ONE ASSIGNMENT SO YOU MUST ONLY USE METHODS IN CHAPTER 1 !!!! AND THE OUTPUT SHOULD BE BOTH THE FOLLOWING :
2.9760461760461765 3.2837384837384844
THE FOLLOWING IS MY CODE I GOT THE FIRST OUTPUT CORRECT, THE SECOND ONE I DID NOT
public class Exercise1 {
public static void main(String[] args) {
double pi1 = 4.0 * (1 - (1.0 / 3) + (1.0 / 5) - (1.0 / 7) + (1.0 / 9) - (1.0 / 11)); System.out.println(pi1);
double pi2 = 4.0 * (1 - (1.0 / 3) + (1.0 / 5) - (1.0 / 7) + (1.0 / 9) * (1.0 / 11)); System.out.println(pi2); } }
1.7 Approximate ? ) ? can be computed using the following formula ?=4(1--+ 3 5 7 9 +--11 + write a program that displays the result of 4 (1-3 + 5-7 + 9-11) and 4 (1-1 -?+??+?.Use 1.??nstead of 1 in your program
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started