Level : MediumJumbled WordProblem Description In this problem a jumbled -up word is given and you have to create all english valid words (Valid means that word should belong to a given dictionary) . For example , if doog is a jumbled word then "good" is a valid word that can be created .But "dog" and "god" are not valid words as they are not of the same length as " doog". You have to write a function called getValidWord to get the list of valid words - The Prototype of the function is: public ArrayList getValidWord(String word, String[] dictionary). where word is the given jumbled-up word and dictionary is the dictionary of words. The method getValidWord() returns an ArrayList of valid words. Constraints: If no valid words found then the method getValidWord() should return null. If the input String array dictionary is passed empty then the method getValidWord() should return null Example 1 Input : -------------------------------------------------------------------------------- String word="noom"; String[] dictionary = { "good", "god", "dog", "mono", "moon", "loss", "boss", "mania", "imaan", "anima", "maani","tour","route","outer","invain","anemea","aneema" }; ArrayList finalList = getValidWord(word,dictionary); Output : -------------------------------------------------------------------------------- The function will return "mono, moon". Example 2 Input : -------------------------------------------------------------------------------- String word="aanim" ; String[] dictionary = { "good", "god", "dog", "mono", "moon", "loss", "boss", "mania", "imaan", "anima", "maani","tour","route","outer","invain","anemea","aneema" }; ArrayList finalList = getValidWord(word,dictionary); Output : -------------------------------------------------------------------------------- The function will return "anima, imaan, maani, mania" Example 3 Input : -------------------------------------------------------------------------------- String word="aanim"; String [] dictionary={}; ArrayList finalList = getValidWord(word,dictionary); Output : -------------------------------------------------------------------------------- The function will return "null" For Java solutions Package Name : test.jumbledword File Name : JumbledWord.java Class Name : JumbledWord Function Names : public ArrayList getValidWord(String word, String[] dictionary) General Instructions The package names, class names, method signatures to be used are mentioned in the problem statement. Do not use your own names or change the method signatures and fields. You can add any number of additional methods. Level : EasySalary HikeProblem Description Consider the database of the Employee Department. The database contains three tables, the structure of the table is given below. Write a method "salaryhike" which takes dateofjoin as input and performs the following operation. Retrieve all the employee records from the table hr_empdetails who has joined before the input dateofjoin and update the salary based on the department percentage wise which show in the below table. Department Name Percentage hr 5 production 6 sales 7 marketing 8 Table Structure: Note : The sql script to create table will be provided to you. 1. Table Name: hr_emp_department This table contains the information about department details. Fields: -------------------------------------------------------------------------------- Field Name Data Type deptid int Primary Key deptname VARCHAR(30) Values to be inserted: -------------------------------------------------------------------------------- deptid deptname 1 hr 2 production 3 sales 4 marketing 2. Table Name: hr_empdetails This table contains the information about employee details. Fields: -------------------------------------------------------------------------------- Field Name Data Type empid int Primary Key empname VARCHAR(20) doj Date deptid int, References hr_emp_department.deptid Sample Data -------------------------------------------------------------------------------- empid empname doj deptid 1 philip 2005-01-12 1 2 sandy 2003-01-12 2 3 martin 2002-01-12 3 4 mathew 2006-01-12 4 3. Table Name: hr_emp_salaries This table contains the information about employee salary details. Fields: -------------------------------------------------------------------------------- Field Name Data Type empid int, References hr_empdetails.empid salary int Sample Data -------------------------------------------------------------------------------- empid salary 1 10000 2 20000 3 30000 4 40000 The Prototype of the function(s) are public void salaryhike(Connection con, String dateofjoin) where the function salaryhike is used to update the salary for all the employee who has joined before the given date. con - represents the SQL Connection object for the database connectivity dateofjoin - represents the employee date of join The function will update all the employee salary who has joined before the given date, salary hike is based on the department percentage wise which show in the above table Given Class Name: DBConnection public static Connection getConnection() : This method returns the database connection object. public static void closeConnection(Connection conn) : This method close the database connection. Example 1 Input: -------------------------------------------------------------------------------- dateofjoin = "2005-10-21" Output -------------------------------------------------------------------------------- The method will update the salary for those employee id (1, 2, 3). empid salary 1 10500 2 21200 3 32100 Note : Follow these steps to create tables: 1. Create the tables in your Database. Use the script file createTable.sql to create the tables. (Open the script in the editor pane and click Run to create the tables). 2. Create a new file with .sql extension. 3. Write the sql queries in that file, save and run to execute query. For Java Solutions Package Name : test.salaryhike File Names : DBConnection.java, EmployeeSalary.java Class Names : DBConnection Function Names : public static Connection getConnection(), public static void closeConnection(Connection connection) Class Names : EmployeeSalary Function Names : public void salaryhike(Connection con, String dateofjoin) General Instructions The package names, class names, method signatures to be used are mentioned in the problem statement. Do not use your own names or change the method signatures and fields. Level : MediumStudent MarksA school management system wants to find the students total mark, grade and result by giving his/her marks scored in each subject as the input and display the result. The management is decided to allot the grade depending on their average marks as follows. Average Marks Grade 40>= and < 50 D 50>= and < 60 C 60>= and < 70 B 70 > A Perform the following operation by using following jsp pages. List of pages student_input.jsp student_pass.jsp student_fail.jsp student_input.jsp Top The "student_input.jsp" file contains four text fields with the names "regno", "mark1", "mark2" and "mark3". Input the values in the corresponding text fields and submit the form with the values. Validate all the mark fields and regno, if the text fields are empty and contains other than integer redirect to the "student_input.jsp" page. If the all the mark values are >= 40 then redirect to "student_pass.jsp" else "student_fail.jsp". Input Type Name Validation Registration No text regno Not Null(contains only integer) Mark1 text mark1 Not Null(contains only integer) Mark2 text mark2 Not Null(contains only integer) Mark3 text mark3 Not Null(contains only integer) Submit the form submit submit Form form studentinfo Note : Your own name can also use for form alone Note: Create a session variable "registerno" and assign the value of the register number once its validated and before submitting to the next page. There should be only one form in the jsp page which contains all the above specified elements within it. student_pass.jsp Top If the page "student_input.jsp" contains all valid inputs and the all marks values >= 40 then redirect to "student_pass.jsp". Create a session variable result and assign the value as "pass". If the user directly visits "student_pass.jsp" page it has to redirect to "student_input.jsp" Input Type Name Validation Registration No text regno Not Null(contains only integer) Mark1 text mark1 Not Null(contains only integer) Mark2 text mark2 Not Null(contains only integer) Mark3 text mark3 Not Null(contains only integer) Total Marks text totalmark Not Null(contains only integer) Grade text grade Not Null(contains only alphabets) Form form studentinfo Note : Your own name can also use for form alone Note: There should be only one form in the jsp page which contains all the above specified elements within it. student_fail.jsp Top If the page "student_input.jsp" contains all valid inputs and if any one of the input value of the marks is < 40 then redirect to "student_fail.jsp". Create a session variable "result " and assign the value as "fail". If the user directly visits this page it has to redirect to "student_input.jsp" Input Type Name Validation Registration No text regno Not Null(contains only integer) Mark1 text mark1 Not Null(contains only integer) Mark2 text mark2 Not Null(contains only integer) Mark3 text mark3 Not Null(contains only integer) Total Marks text totalmark Not Null(contains only integer) Form form studentinfo Note : Your own name can also use for form alone Note: There should be only one form in the jsp page which contains all the above specified elements within it. Example 1 Input -------------------------------------------------------------------------------- Webpage : student_input.jsp regno="0522" mark1="50" mark2="55" mark3="56" Output -------------------------------------------------------------------------------- Webpage : student_pass.jsp regno =0522 mark1 = 50 mark2 = 55 mark3 = 56 total = 161 Grade = B session values registerno = "0522" and result = "pass". Example 2 Input -------------------------------------------------------------------------------- Webpage : student_input.jsp regno="0210" mark1="26" mark2="40" mark3="42" Output -------------------------------------------------------------------------------- Webpage : student_fail.jsp regno =0210 mark1 = 26 mark2 = 40 mark3 = 42 total = 108 session values registerno = "0210" and result = "fail". General Instructions The package names, class names, method signatures to be used are mentioned in the problem statement. Do not use your own names or change the method signatures and fields. You can add any number of additional methods. Level : EasyCheck TagOne person found a HTML source page containing wrong tags, i.e., there may present opening tag without proper consecutive ending tag and closing tag without opening tag. Write a program to find total number of the wrong tags present in the HTML source page. The prototype of the function is int getWrongTags(String tag) Here the parameter tag is the source HTML tag as string. The function returns the total number of wrong tags present in the input. For wrong input return -1. Constraint The input should be non empty otherwise return -1 Example 1 Input -------------------------------------------------------------------------------- tag = "< Top < financial leaders, < faced with the biggest crisis to hit the global economy in at least a decade, are pledging to strengthen their regulation of banks and other financial institutions while anxiously hoping the slump in the United States will be a short one.>" Output -------------------------------------------------------------------------------- getWrongTags() returns 2 Explanation: The tags present at 1st and 7th position of the string have no ending tags, so that 2 wrong tags are present. And there is no wrong closing tag, i.e., zero. Hence total number of wrong tags is 2. Example 2 Input -------------------------------------------------------------------------------- tag = "< Top < financial leaders, < faced >>>with > << the biggest crisis to hit the global economy in at least a decade, are pledging to strengthen their regulation of banks in the United States will be a short one." Output -------------------------------------------------------------------------------- getWrongTags() returns 3 Example 3 Input -------------------------------------------------------------------------------- tag = null Output -------------------------------------------------------------------------------- getWrongTags() returns -1 For Java solutions Package Name - test.checktag File Name - CheckTag.java Class Name - CheckTag Function Name - public int getWrongTags(String tag) General Instructions The package names, class names, method signatures to be used are mentioned in the problem statement. Do not use your own names or change the method signatures and fields. You can add any number of additional methods.