Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Beginning with the file that you downloaded named Proj 0 9 . java, make a new file named Proj 0 9 Runner.java to meet the

Beginning with the file that you downloaded named Proj09.java, make a new file named Proj09Runner.java to meet the specifications given below.
Note that you must not modify the code in the file named Proj09.java.
Proj09.java
/*File Proj09.java
The purpose of this assignment is to assess the student's
ability to write code dealing with Java streams. Student's
code must use streams to sort the String data in an
incoming array object in descending order and return the
sorted data in an object of type List.
***********************************************************/
// Student must not modify the code in this file. //
import java.util.*;
class Proj09{
public static void main(String[] args){
System.out.println("
Student must sort the data "+
"using a stream.");
String[] data ={"Not null"};
if(args.length <2){
//Use default strings
String[] temp ={"Tom","Dick","Harry"};
data = temp;
}else{
//Use command-line arguments as strings
data = args;
}//end else
//Display the data
System.out.println("Input data ="+ Arrays.asList(data));
//Instantiate an object from the student's code.
// Pass the data array as a parameter.
System.out.println("Execute the student's code.
");
Proj09Runner obj = new Proj09Runner(data);
//Execute the student's run method and display
// the returned List object containing the
// original data sorted into descending order.
List descendingOrder = obj.run();
System.out.println(
"Display List returned from student's code.");
System.out.println(
"
Sorted in Descending Order:
"+ descendingOrder);
}//end main
}//end class Proj09
//End program specifications.
Be sure to display your name in the output as shown below.
When you place both files in the same folder, compile them both, and run the file named Proj09.java, the program must display the text shown below on the command line screen.
The output values depend on the values of command-line arguments that are entered when the program is run. If no command-line arguments are entered, the program defaults to input values of Tom, Dick, and Harry. The output for command-line argument values of Bill, Joe, Bob, Tim, 33,45, and alice is shown below. Note: Numeric values entered as command-line arguments are strings.
Your solution for this assignment must use Java streams to sort the data.
The followiingg should display when the program is run:
Student must sort the data using a stream.
Input data =[Bill, Joe, Bob, Tim, 33,45, alice]
Execute the student's code.
I certify that this program is my own work and is not the work of others. I agree not to share my solution with others.
Replace this line with your name
Display List returned from student's code.
Sorted in Descending Order: [alice, Tim, Joe, Bob, Bill, 45,33]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases In Networked Information Systems 6th International Workshop Dnis 2010 Aizu Wakamatsu Japan March 2010 Proceedings Lncs 5999

Authors: Shinji Kikuchi ,Shelly Sachdeva ,Subhash Bhalla

2010th Edition

3642120377, 978-3642120374

More Books

Students also viewed these Databases questions