Question: Java Application For this part of the learning activity, you will create a Java class that you will submit the .java file to this assignment

Java Application

For this part of the learning activity, you will create a Java class that you will submit the .java file to this assignment as homework.

The Class File

The Java class shall be an application that prints three lines of text. The first line of text printed by the application shall include your name. This should be the name (first and last) that you're using on Canvas. The second line of text printed by the script shall be some World Wide Web-verifiable fact. Wikipedia is a good resource to use for finding some verifiable fact. These facts shall be unique within the class. Use the forum posting in Part 1 of this assignment to ensure uniqueness of your fact. The third line will respond to input from the command-line. When a program is run, additional information can be given on the command-line, following the name of the application class, that is, the class with the application method. This information appears in the String array parameter of the application method. There are exactly four possible third-lines:

  1. No command-line arguments given. This text appears when there are no additional command-line arguments.
  2. The command-line arguments say "OOP". This text appears when there is one command-line argument, the text "OOP".
  3. The command-line arguments say "CptS 132". This text appears when there are two command-line arguments, the text "CptS 132", specifically, a four-character String, "CptS", followed by a three-character String, "132".
  4. The command-line arguments are not recognized. This text appears when there are command-line arguments which do not match any cases listed above.

For example, assuming my application class was named HW1 and the command-line was:

java HW1 OOP

my application could print out:

My name is John Doe. Java is the most populous island in the world. The command-line arguments say "OOP".

Additional requirements for the source code file:

  • The source code file shall compile.
  • The compiled file shall run as a Java application.
  • The application code shall appear in a public class.
  • There shall be a JavaDoc comment (documentation comment) for the class definition.
  • The class JavaDoc comment shall include your name (first and last) in the @author tag.
  • The class JavaDoc comment shall include the number and name of this assignment (Assignment 1: Class Tools) in the @version tag.
  • There shall be a JavaDoc comment for all non-private resources within the class. At this point, that will only include methods.
  • There shall be a comment immediately before (above) the code that prints your name. A short descriptive phrase is sufficient, e.g., "prints my name".
  • There shall be a comment immediately before (above) the code that prints the "interesting" fact. A short descriptive phase is sufficient, e.g., "my interesting fact".
  • There shall be a comment immediately before (above) the code that prints the line responding to the command-line arguments. A short descriptive phase is sufficient, e.g., "handle args".
  • All comments shall precede the associate Java code.
  • All comments shall align vertically with the associated Java code.

Note: When working with reference types, the == (two equal signs) operator does not check for equivalent values. It checks for identical instances.

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!