I need help making a program for this using java
1 Introduction Create a java class Lab8.java that prints the output from lab7.java in a file called Lab7Output.txt. This lab assumes you completed lab 7. 2 Arrays (Same as Lab6) 2.1 Print array in order The first loop will print the array elements in order separated by commas. The last element should not be succeeded by a comma, however, the string "-". 2.2 Print array in reverse order The second loop will print the array elements in reverse order separated by commas. The last element should not be succeeded by a comma, however the string "-". 2.3 Print array with switched pairs The third loop will print the second element followed by the first element, the fourth element followed by the third element, the sixth element followed by the fifth element, etc. Elements should be separated with a comma except for the last element, it should be succeeded by the string "-". (Hint: use a loop counter that increments by 2.) 2.4 Special print The fourth loop should print the first element concatenated with the last element, the second element concatenated with the element before last, the third element concatenated the element before the element before the last, and so on. Each printed couple should be separated by a comma except for the last couple, they should be succeeded with the string "-". The sequence should look like: AJ, BI, CH, DG, EF |- (Hint: use a loop counter that ends at arraySize/2.)
3 Output and Formatting Your output should look exactly as the output given below in the file, Lab7Output.txt: Array in order A, B, C, D, E, F, G, H, I, J |- Array in reverse J, I, H, G, F, E, D, C, B, A |- Array with switched pairs B, A, D, C, F, E, H, G, J, I |- Special print AJ, BI, CH, DG, EF |- Failure to adhere to the above formatting will result in losing points. 4 Code Use the code given below for your implementation public static void main(String[] args) { //add proper exception handling //Fill this part (20 points) //Declaring an array of Strings, and assigning String values. String[] array = ("A", "B", "C", "D", "E", "F", "G", "H", "I", "J"); //Declaring and assigning array size int arraySize = array.length; //create file named Lab7Output.java // Fill this part (20 points) //Along with the code from lab6... //print array in order to file //Fill this part (10 points) //print array in reverse order to file //Fill this part (10 points) //print arrays with switched pairs to file //Fill this part (20 points) //print special, concatenate first with last, second with element before last, //third with element before the element before the last, etc. in file //Fill this part (20 points) }
I need help making a program for this using java
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
I need help making a program for this using java
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!