Question: 1 . Write a Java program A 2 p 1 . java with a public class A 2 p 1 and no named packages that
Write a Java program Apjava with a public class Ap and no named packages that accepts one command line argument a which is assumed to be positive integer at least Calculate and print an integer list starting from a and ending until some integer appears a second time by iteratively applying a math function f to the value of a The math function f is defined as fxx if x is odd and fxx if x is even. The iteration will stop when some value is reached twice. For example: When a is the integer list should be and the length of this list is The length of the list should also be printed. You program can, but does not have to store all elements of the list in memory at once. A sample run can look like the following those shown in blue color are typed by the user:
kwang@computer~temp$java Ap
Iterated list for is:
Length of the list:
Write a Java program Apjava with a public class Ap and no named packages that accepts a command line argument m that is assumed to be a multiple of egetc Generate a string of m random upper case English characters and store them in a char array. Design three additional methods other than the main method each of which is supposed to convert onethird of the m chars in your array in place into a backwardoffset lower case version ieAzBaCbYxZy Print out the string ie all array elements both before and after conversion on two separate lines. You can choose which onethird of the array each of the three methods will convert, as long as their combined work converts all m chars in the array. Can you imagine how you would change your program if four additional methods should be created to do the conversion, each of which converts onefourth of the m chars? What about five methods? Six methods? Just submit the threemethod version. A sample run can be seen later.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
