General Instruction: Create a project in IntelliJ IDEA with the naming convention as follows: Class code-ID...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Answer rating: 100% (QA)
import javanet import javaio public class JDelaCruz1 public static void mainString ar... View the full answer
Related Book For
Modern Database Management
ISBN: 978-0133544619
12th edition
Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Part 1 of the Final Project, due at the end of this unit, requires you to describe and draw a flowchart of the sales or purchasing process at your organization (or one of your choice). This...
-
Interpret the graph COVID-19 LITERACY SCALE 90 80 70 60 666 6 50 40 30 20 10 01 02 Q3 04 Q5 06 07 Q8 a9 Q10 Q11 Q12 Q13 Q14 Q15 Q16 Q17 Science Non-Science Figure 1. COVID-19 LITERARY SCALE
-
How much tension must a cable withstand if it is used to accelerate a 1200-kg car vertically upward at 0.70 m/s2?
-
Distinguish between physical changes and chemical changes.
-
Refer to the information from QS 21-18. Compute the variable overhead spending variance and the variable overhead efficiency variance and classify each as favorable or unfavorable. Data From QS 21-18...
-
Manno Corporation has the following information available concerning its postretirement benefit plan for 2010. Service cost $40,000 Interest cost 47,400 Actual and expected return on plan assets...
-
The topic is Database Management Systems What is the purpose of a database? What are the contents of a database? What is a database management system (DBMS)? What are the components of a database...
-
A concrete corporation had cost of goods sold of $1,550,000 for the third quarter. The beginning inventory at cost was $155,000, and the ending inventory at cost amounted to $180,900. The inventory...
-
In 2018, Pear LTD, a company producing smart phones, generated 1,000,000 in revenues. At the beginning of 2018 the company had 100,000 worth of electronic components in stock. Subsequently, in the...
-
discuss three important concepts applicable to your work experience, profession, and/or career plans for the future. Describe how each applies. What part of the course (background materials,...
-
Over the last few years, fewer people have been attending homecoming at a small college, but the expense of the event is growing, meaning that the homecoming committee is being faced with the...
-
Discuss product development in terms of both product and service development i.e differences and similarities. What's the MVP (Minimum Viable Product) concept in product/service development and how...
-
Reyn, an employee of Monado Enterprises, receives a yearly bonus directly related to Monado's EBITDA. As a stereotypical American capitalist, Reyn loves to make as much money as possible. Does Reyn...
-
Discuss in terms of the processes for each one or how it works? When is each framework used -- business purpose for its use? Discuss in detail each framework's advantages and disadvantages? Which...
-
Let U1, U2, ... be a sequence of i.i.d. U(0, 1) random variables. Let N be such that .}: IIU; < e-}. Verify that N follows the Poisson distribution with parameter A. (One may do this by relating to a...
-
Explain what is meant by vicarious liability and when it is available?
-
JSON is widely used in the context of NoSQL databases. What is its primary role?
-
SQU2006 and SQL:2008 introduced a new keyword, MERGE. Explain how using this keyword allows one to accomplish updating and merging data into a table using one command rather than two.
-
When a student has not chosen a major at a university, the university often enters a value of "Undecided" for the major field. Is "Undecided" a way to represent the null value? Should it be used as a...
-
Go to the PMI Web site and examine the link Membership. What do you discover when you begin navigating among the various chapters and cooperative organizations associated with the PMI? How does this...
-
Go to http://www.pmi.org/business-solutions/casestudies and examine some of the cases included on the Web page. What do they suggest about the challenges of managing projects successfully? The...
-
Using your favorite search engine (Google, Yahoo!, etc.), type in the keywords project and project management. Randomly select three of the links that come up on the screen. Summarize what you find.
Study smarter with the SolutionInn App