Requirements: 1) Create a Java Program that will accept input of an IP Address either as a string or in a series of four octets, display the listing of an error, and output the valid IP address if it passes through a series of error checks. 2) You will create two class files in your Java project in Eclipse (IPAddress and IPAddressDriver using the following UML: IPAddressDriver main(args : String[]) : void mainMenu(): void IPAddress() IPAddress(firstOctet, secondOctet, thirdOctet, fourthOctet) IPAddress(IPString) checkIPOctets() :boolean checkIPString() : boolean getErrorCode() : int getErrorDescription(): String printIPAddress(): void firstOctet : String secondOctet : String thirdOctet: String fourthOctet: String IPString: String errorCode: int errorDescription: StringCS219- Exam01 Wiemann 3) When the program executes, the driver program should display a Main Menu similar to the following: IP Address Main Menu ——————– 1) Input the default IP Address 2) Input the IP Address as octets 3) Input the IP Address as a string 4) Exit 4) Execution of the Main Menu should repeat until the use type a choice of ‘4’ and an error should be displayed if the end user types any other menu option except ‘1’, ‘2’, ‘3’, or ‘4’. 5) The IPAddressDriver class is responsible for displaying the Main Menu, accepting input from the end user, and outputting the results, however all business logic must be performed in the IPAddress class per the UML listed above! 6) An instance of the IPAddress class can be overloaded in one of three ways – a default IP Address of 128.0.0.1 (which requires nothing to be read in from the end user), passing the four octets to the instance of the class, or passing a string of an IP Address to the instance of the class – these items should correspond to menu options 1, 2, and 3 respectively. 7) For options 2 and 3, you will need to assign (in the IPAddress class) the error code and error description based upon the following list:CS219- Exam01 Wiemann errorCode errorDescription Example of the error 0 No Error encountered in the IP Address Valid Input… just return the message and errorCode of 0 1 First Octet was blank .121.23.45 2 Second Octet was blank 121..23.45 3 Third Octet was blank 12.34..56 4 Fourth Octet was blank 12.34.56. 5 First Octet had invalid characters AB.12.34.45 6 Second Octet had invalid characters 12.AB.34.45 7 Third Octet had invalid characters 12.34.AB.56 8 Fourth Octet had invalid characters 12.34.56.AB 9 First Octet was out of range 999.12.34.56 10 Second Octet was out of range 12.999.34.56 11 Third Octet was out of range 12.34.999.56 12 Fourth Octet was out of range 12.34.56.999 13 Inputted IP String was blank {nothing was typed by the end user} 14 Three dots were not typed in the inputted IP String 12.34.56 8) Note that for each octet in a valid IP Address that the range is from 0 – 255 (i.e. less than 0 or greater than 255 results in an error) 9) Name your project mrwJavaExam01 (where mrw is “your” initials) 10) See the next pages for a sample run session. 11)You will need to zip the contents of the entire project into a single zip file and upload the content of that zip file to the dropbox on or before the due date.CS219- Exam01 Wiemann Mock Run: IP Address Main Menu ——————– 1) Input the default IP Address 2) Input the IP Address as octets 3) Input the IP Address as a string 4) Exit Input choice: 1 Error Code 0- No error encountered in the IP Address The IP Address inputted is: 128.0.0.1 IP Address Main Menu ——————– 1) Input the default IP Address 2) Input the IP Address as octets 3) Input the IP Address as a string 4) Exit Input choice: 2 Input the first octet: 128 Input the second octet: 0 Input the third octet: 1 Input the fourth octet: 100 Error Code 0- No Error encountered in the IP Address The IP Address inputted is: 128.0.1.100 IP Address Main Menu ——————– 1) Input the default IP Address 2) Input the IP Address as octets 3) Input the IP Address as a string 4) Exit Input choice: 2 Input the first octet: AB Input the second octet: CD Input the third octet: EF Input the fourth octet: GH Error Code 5- First Octet had invalid characters IP Address Main Menu ——————– 1) Input the default IP Address 2) Input the IP Address as octets 3) Input the IP Address as a string 4) Exit Input choice: 3 Input the IP String: 128.128.255.121CS219- Exam01 Wiemann First octet: 128 Second octet: 128 Third octet: 255 Fourth octet: 121 Error Code 0- No Error encountered in the IP Address The IP Address inputted is: 128.128.255.121 IP Address Main Menu ——————– 1) Input the default IP Address 2) Input the IP Address as octets 3) Input the IP Address as a string 4) Exit Input choice: 3 Input the IP String: A.B.C.D First octet: A Second octet: B Third octet: C Fourth octet: D Error Code 5- First Octet had invalid characters IP Address Main Menu ——————– 1) Input the default IP Address 2) Input the IP Address as octets 3) Input the IP Address as a string 4) Exit Input choice: 3 Input the IP String: 123.456.789.12 First octet: 123 Second octet: 456 Third octet: 789 Fourth octet: 12 Error Code 10- Second Octet was out of range IP Address Main Menu ——————– 1) Input the default IP Address 2) Input the IP Address as octets 3) Input the IP Address as a string 4) Exit Input choice: 4CS219- Exam01 Wiemann Exam01 Rubric: Component Max Points Points Earned COMPILE/WARNINGS: Program is free of compile and/or warnings – program will not be graded if warnings/errors exist at time of compile in Eclipse. 0 0 SHOP STANDARD: IPAddressDriver and IPAddress Had a “Flower Box identifying name, course ID, etc. (highest grade can be earned on program is a 0 if not completed) 0 0 SHOP STANDARD: IPAddressDriver and IPAddress had an inline comment under the flower box to identify the purpose of the program (highest grade can be earned on program is a 0 if not completed) 0 0 SHOP STANDARD: IPAddressDriver and IPAddress had all variables declared with shop standard notation (i.e. Camel notation) (highest grade can be earned on program is a 0 if not completed) 0 0 SHOP STANDARD: IPAddressDriver and IPAddress had all variables with comments on them (highest grade can be earned on program is a 0 if not completed) 0 0 SHOP STANDARD: IPAddressDriver and IPAddress: Single letter variables were not used in the scope of the program as they do not describe the purpose of the variable (highest grade can be earned on program is a 0 if violated) 0 0 IPAddress Class accepted the default of 128.0.0.1 10 10 IPAddress Class accepted the input of the four octets 10 10 IPAddress Class accepted the input of the IP address typed by the end user as a string 10 10 Error checking was successful as typed by octets 20 20 Error checking was successful as typed by a string 10 10CS219- Exam01 Wiemann Error codes were returned by the IPAddress class to the driver 20 20 IPAddressDriver accepted input from the menu and error returned if not a valid choice 10 10 IPAddress Driver was only used to accept input, passed it to IPAddress, and returned values back to the IPAddressDriver class 10 10 Total Points: 100 100


0 comments