Question: JAVA// read description given thanks:) given sequence driver import java.text.DecimalFormat; public class SequenceDriver { public static void main(String[| args) { DecimalFormat df = new Decima|Format(*##.#);

JAVA// read description given thanks:)  JAVA// read description given thanks:) given sequence driver import java.text.DecimalFormat; public
class SequenceDriver { public static void main(String[| args) { DecimalFormat df =
given sequence driver

import java.text.DecimalFormat;

public class SequenceDriver {

public static void main(String[| args) {

DecimalFormat df = new Decima|Format(*##.#");

int[] nums = {1,3,5,9,12, 15,4,7,4,2, 12);

Sequence am = new Sequence(nums);

System.out.println("The original array:");

System.out.println(am.toString());

System.out.println("InSwapping first and last:"); am.swapFirstAndLast();

System.out.printIn(am.toString());

System.out.println("InShifting all elements to the right and the last becomes first:");

System.out.println("Code must have a single for loop""); am.shift();

System.out.printin(am.toString());

System.out.println(" All of the even values");

intl evenValues = am.evens):

print(evenValues);

System.out.printIn("InThe shifted array with the middle elements) removed."); am.removeMiddle():

System.out.printIn(am.toString());

System.out.println("InRepeated - the shifted array with the middle element(s) removed."); am.removeMiddle():

System.out.printIn(am.toString());

System.out.println(" A check to see if the array is sorted");

boolean ans = am.inOrder();

if (ans ==true)

System.out.println("All elements are in order");

System.out.println("InFind the second largest element");

int second = am.findSecondLargest();

System.out.println("The second largest value was " + second);

System.out.println("InSum two arrays. Test it with both of the arrays below");

intl other1 = {2,4,6);

int[] other1Added = am.sum(other1);

System.out.println("Summing with {2,4,6}");

print(other1Added);

int[] other2 = {2,4,6,1,1,4,5,6,7,7,8,9};

int[] other2Added = am.sum(other2);

System.out.printIn("Summing with {2,4,6,1,1,4,5,6,7,7,8,9}");

print(other2Added);

}

public static void print(int[ arr) {

for (int i=0;i

System.out.print(arr[i] + " ");

System.out.println();

}

}

Write a JAVA program for the UML diagram of the blueprint Sequence and description of the methods in the blueprint provided. You are already given the Sequence driver program. -make sure to match the blueprint to String() - prints the array on one line swapFirstAndLast() - swaps the first and last element in the original array shift() - shifts all of the elements to the right and the last element becomes the first one. It alters the original array. It must have a single for loop evens() - returns a new array that has only the even values in it removeMiddle() - removes the middle element if the array length is odd or the middle two elements if the length is even. Alters the original array inOrder() - checks to see if the array is sorted. Returns a boolean and prints where, in the array. the unsorted elements first appear findSecondLargest) - returns the second largest value. You can assume that it is unique (there are no duplicate) sum (int[] other) - add each element in other to the same indexed element in this array. If the lengths are not the same, assume missing elements are zero. Return the new array. Does not change the original one. getValues() \& setValues() - getter and setter for the class See sample output. -make sure it outputs to match the sample out The original array: 13591215474212 Swapping first and last: 12359121547421 Shifting all elements to the right and the last becomes first: Code must have a single for loop 11235912154742 All of the even values 1212442 The shifted array with the middle element(s) removed. 112359154742 Repeated - the shifted array with the middle element(s) removed. 112354742 A check to see if the array is sorted The problem occurred first with 12 and 3 Find the second largest element The second largest value was 7 Sum two arrays. Test it with both of the arrays below Summing with {2,4,6} 316954742 Summing with {2,4,6,1,1,4,5,6,7,7,8,9} 31696511987789

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!