Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

make a new file named Proj 1 2 Runner.java to meet the specifications given below. Note that you must not modify the code in the

make a new file named Proj12Runner.java to meet the specifications given below.
Note that you must not modify the code in the file named Proj12.java.
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 Proj12.java, the program must display the text shown below on the command line screen.
The input String values depend on the values of three 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 Madam, radar, and defied. The output for command-line argument values of racecar, Rotor, and level is shown below. Your program will be tested with different command-line arguments.
For this assignment, your code must examine three incoming String values and determine if each string is or is not a palindrome. For this assignment, a palindrome is defined as a string that has the same characters, forward and backward. Your program must return a three-element boolean array indicating if each string is a palindrome. Return true if the string is a palindrome, false if it is not a palindrome. (Note in the example shown below that the string Rotor is not a palindrome due to the case, upper and lower, of the characters at each end of the string.) Make sure that you return the boolean values in the correct order as shown below.
Your solution for this assignment must use one or more lambda expressions. Among other things, this means that your code must use one or more statements that contain the arrow (->) operator.
The following should display when run:
"Use command-line arguments.
Input values to student code = racecar,Rotor,level
Student's solution must use lambda expressions.
Call student's run method.
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.
Print your name here.
Display results returned from student's code.
racecar: true
Rotor: false
level: true
That's all folks."
Proj12.java (cannot be modify)
/*File Proj12.java
The purpose of this assignment is to assess the student's
ability to write programs that use lambda expressions and
the Predicate functional interface from the
java.util.function package.
***********************************************************/
// Student must not modify the code in this file. //
class Proj12{
public static void main(String[] args){
String x = "Madam";
String y = "radar";
String z = "defied";
if(args.length !=3){
System.out.println("Use default input values.");
}else{//get x, y, and z from args
System.out.println("Use command-line arguments.");
x = args[0];
y = args[1];
z = args[2];
};//end else
System.out.println(
"
Input values to student code ="+
x +","+ y +","+ z);
System.out.println(
"
Student's solution must use lambda expressions.");
//Instantiate an object from the student's code.
Proj12Runner obj = new Proj12Runner();
System.out.println("
Call student's run method.");
boolean[] result = obj.run(x,y,z);
System.out.println(
"
Display results returned from student's code.");
System.out.println(x +": "+ result[0]);
System.out.println(y +": "+ result[1]);
System.out.println(z +": "+ result[2]);
System.out.println("
That's all folks.");
}//end main
}//end class Proj12
//End program specifications.

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

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions

Question

What is the relationship between humans?

Answered: 1 week ago

Question

What is the orientation toward time?

Answered: 1 week ago