Question: Student ID: Except the classes mentioned below, no other classes / packages are allowed to solve the following problems. Create a public class named Yourlastname

Student ID:
Except the classes mentioned below, no other classes/packages are allowed to solve the following problems.
Create a public class named Yourlastname_Yourfirstname_final(5 pts).
import java.util.Arrays;
import java.util.Sacanner;
import java.lang.IllegalStateException;
import
java.io.*;
import java.lang.Comparable;
import java.lang.IndexOutOfBoundsException;
Write a static method named problem1 that accepts two arrays of integer values. Find and return the union of two arrays. Each element must be unique in the union array. You may assume each array contains unique elements. Return the result. (15 pts)
Test case: array1 is {1,2,3,4,5}, array 2 is {4,5,6,7,8}, return {1,2,3,4,5,6,7,8}.
Write a static method named problem 2 that keeps asking the user for string literals. Throw IllegalStateException if the entered string literal is empty. When the user enters "stop", the loop should be terminated. Capitalize each word (the first letter must be upper case and the rest of letters must be lower case). Join all the words together and separate any two words by using "#".(15 pts)
Test case: if the entered words are "apple", "BANANA", "oRANGE", "stop", return "Apple#Banana#Orange".
Write a static method named problem 3 that accepts an array of string literals. Remove all the strings with length greater than 5. Return the result. (10 pts)
Test case: array is "python", "java", "javascript", "c++"}, return "java", "c++"}.
Write a static method named problem4 that receives a path of a text file. Read data from the given file. Handle the IOException and the FileNotFoundException. Calculate the sum of all the digits then write the result back to the file. (10 pts)
Test case: the text in the test.txt file is:
abc123cda345
cc34
56
Write 36 to the text file (because 1+2+3+3+4+5+3+4+5+6=36).
 Student ID: Except the classes mentioned below, no other classes/packages are

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!