1) Approximating %u03C0) %u03C0 can computed using the following formula: %u03A0
ID: 3536492 • Letter: 1
Question
1)
Approximating %u03C0) %u03C0 can computed using the following formula:
%u03A0 = 4 x(1-1/3 + 1/5 - 1/7 + 1/9 %u2013 1/11 + 1/13 +%u2026)
Write a program that displays the result the of 4 x(1-1/3 + 1/5 -1/7 + 1/9 -1/11 +1/13). Use 1.0 instead of 1 in your program
---------------------------------------------------------------------------------------
2)
(Game: scissor, rock, paper) Write a program that plays the popular scissor-rock-paper game. (A scissor can cut a paper, a rock can knock a scissor, and a paper can wrap a rock.) The program randomly generates a number 0, 1, or 2 representing scissor, rock, and paper. The program prompts the user to enter a number 0, 1, or 2 and displays a message indicating whether the user or the computer wins, loses, or draws. Here are sample runs:
Explanation / Answer
public class abc
{
public static void main(String argd[])
{
System.out.print(4*(1.0-(1.0/3)+(1.0/5)-(1.0/7)+(1.0/9)-(1.0/11)+(1.0/13)));
}}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.