Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task #4: Command Line Arguments Part A. Create a java class/file called CommandLines.java with a mainmethod. In the main method write a loop that traverses

Task #4: Command Line Arguments

Part A.

Create a java class/file called CommandLines.java with a mainmethod.

In the main method write a loop that traverses through the argsarray and prints the contents of each element in the followingformat:

args[0]: hello
args[1]: how

Save this java file in the User folder in your C drive.

Open the command prompt window and compile the program bytyping:

javacCommandLine.java

NOTE: MAKE SURE YOUR ARE IN THE CORRECT DIRECTORY (CHECK YOURPATH)

After a successful compilation of the program, run the followingcommand by writing the arguments-

java CommandLine argument-list

For example – java CommandLine My favorite color is Purple

Press Enter and you will get the desired output.

After performing the above steps, we will get the followingoutput:

args[0]: My
args[1]: favorite
args[2]: color
args[3]: is
args[4]: purple

part B.

Traverse through your array and print the names that contain thesubstring "ma" and whose length is less than 5

Test case:

kim andy mary jose khoi omar maryam henryemma

part C

Traverse through your array and calculate the average of all thenumbers less than 7

Test case:

2 11 10 4 5 7 14 4

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

Computer Performance Engineering 10th European Workshop Epew 2013 Venice Italy September 17 2013 Proceedings

Authors: Maria Simonetta Balsamo ,William Knottenbelt ,Andrea Marin

2013 Edition

3642407242, 978-3642407246

More Books

Students also viewed these Programming questions

Question

Have I comparison shopped for price and quality?

Answered: 1 week ago

Question

Explain the reasons why the insurance industry is regulated.

Answered: 1 week ago