Home / Expert Answers / Computer Science / problem-1-triangles-printing-program-write-an-application-that-displays-the-following-patterns-pa938

(Solved): Problem 1: (Triangles Printing Program) write an application that displays the following patterns ...



Problem 1: (Triangles Printing Program) write an application that displays the following patterns separately, one below the oProblem 2: (Calculating the Value of \( \pi \) ) write an application that calculates the value of \( \pi \) from the infinit

Problem 1: (Triangles Printing Program) write an application that displays the following patterns separately, one below the other. Use for loops to generate the patterns. All asterisks \( \left(^{*}\right) \) should be printed by a single statement of the form System.out.print \( \left({ }^{\prime \prime *}{ }^{\prime \prime}\right) \); which causes the asterisks to print side by side. A statement of the form System.out.printIn(); can be used to move to the next line. A statement of the form System.out.print(" "); can be used to display a space for the last two patterns. There should be no other output statements in the program. Sample Output Program Template Problem 2: (Calculating the Value of \( \pi \) ) write an application that calculates the value of \( \pi \) from the infinite series \[ \pi=4-\frac{4}{3}+\frac{4}{5}-\frac{4}{7}+\frac{4}{9}-\frac{4}{11}+\cdots \] Your application has to show the value of \( \pi \) approximated by computing the first 20 terms of this series. Also, try to run your program with 200,000 terms in the series. Program Template


We have an Answer from Expert

View Expert Answer

Expert Answer


Java code for the 4 patterns - - - -- - - - - - - - - - - - - - - - class Pattern { public static void main(String[] args) { final int ROWS = 10; // 1
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe