Answered step by step
Verified Expert Solution
Question
1 Approved Answer
General Instruction: Create a project in IntelliJ IDEA with the naming convention as follows: Class code-ID number-Last name, First name (e.g. 9300-2200000-Dela Cruz, Juan)
General Instruction: Create a project in IntelliJ IDEA with the naming convention as follows: Class code-ID number-Last name, First name (e.g. 9300-2200000-Dela Cruz, Juan) Within this project, create a package named pexam. Create the sub-packages problem1, problem2, and problem3 inside pexam package. All the classes for part 2 of this exam must be placed in the respective sub-packages. The main classes (containing main method) will follow the convention: Initial letter of first name, followed by the family name, and the problem number (Pascal case). For example, the name Juan Dela Cruz with problem 1 will result to the class name of JDelaCruz1, the class for problem 2 will be JDelaCruz2, JDelaCruz3 for problem 3, and so on. Problem 1: (15 points) Create a program that will scan all open ports (from 1 to 1024) of a computer (localhost or any computer within a network). Note that you are to make the first line in your main method with the statement: String host = "localhost"; So that if I want to have another host to check then I simply need to edit the value of the variable with the desired host and run your program. Warning: Don't be surprised if you will have to wait f a couple of minutes/hours (in other words a long time) before you can get an output from running the program. Once a single result has been printed, stop the program from executing and proceed to problem 2. You just need to check that your program is printing the desired result. Sample output 1: (for host variable assigned with "localhost") localhost: 135 is open localhost: 445 is open Sample output 2: (for host variable assigned with "www.slu.edu.ph") www.slu.edu.ph:80 is open www.slu.edu.ph:443 is open www.slu.edu.ph:554 is open Problem 2: (25 points) Rewrite your program in problem 1 such that each check to a port on the specified host will be performed by a runnable or callable object. Note that you are to maintain the first line in your main method with the statement: String host = "localhost"; Note: Name the class for the runnable/callable object as Port Checker. Problem 3: (40 points) Create a server that will wait for a client to connect to it and do the following in order: a. Wait for a password (string) from the client b. Evaluate the string sent by the client according to the following criteria (in order): 1. If the password is less than 6 characters, return the string "maigsi" (e.g. civic, aa@11) If the password is more than 12 characters, 2. return the string "mahaba" 3. If the password has 6-12 characters (comprised of letters and digits only), but contains a non-letter and a non-digit character(s), return the string "may kakaibang karakter" (e.g. c#1vic, m adam, aa 11@aa) 4. If the password has 6-12 characters (comprised of letters and digits only), but the number of letters is greater than the number of digits, return the string "maletra" (e.g. abcde123) 5. If the password has 6-12 characters (comprised of letters and digits only), but the number of letters is less than the number of digits, return the string "manumero" (e.g. abc1234) 6. If the password has 6-12 characters (comprised of letters and digits only), and the number of letters is equal to the number of digits, return the string "katanggap-tanggap" (e.g. abc123) c. Repeat the whole process until the client sends a password that evaluates to "katanggap-tanggap" AND IT IS A PALINDROME. Before totally exiting, the text "paalam" should be sent to the client. Notes: The server program must cater to a single client only You may either use telnet or a separate program to serve as a client but your submission should only include the server program. Your server program should use port number 5000.
Step by Step Solution
★★★★★
3.49 Rating (149 Votes )
There are 3 Steps involved in it
Step: 1
import javanet import javaio public class JDelaCruz1 public static void mainString ar...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started