Question: Write a program named Symmetry.java, within this class, define a method symmetricNumber method that accepts an integer n as a parameter and prints a symmetric

Write a program named Symmetry.java, within this class, define a method symmetricNumber method that accepts an integer n as a parameter and prints a symmetric sequence of n numbers with descending integers ending in 1 followed by ascending integers beginning with 1, as in the table below: Call Output symmetricNumber(1); 1 symmetricNumber(2); 1 1 symmetricNumber(3); 2 1 2 symmetricNumber(4); 2 1 1 2 symmetricNumber(5); 3 2 1 2 3 symmetricNumber(6); 3 2 1 1 2 3 symmetricNumber(7); 4 3 2 1 2 3 4 symmetricNumber(8); 4 3 2 1 1 2 3 4 symmetricNumber(9); 5 4 3 2 1 2 3 4 5 symmetricNumber(10); 5 4 3 2 1 1 2 3 4 5 Notice that for odd numbers the sequence has a single 1 in the middle while for even values it has two 1s in the middle. Include main method in this class and test your method with the following calls: symmetricNumber(1) symmetricNumber(2) symmetricNumber(5) symmetricNumber(6) symmetricNumber(9) symmetricNumber(10) symmetricNumber(12) 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!