CEN 254 - Midterm Exam Details There are 11 questions with different levels of difficulty from the categories below: • Java Primer • ArrayList • LinkedList • Stack • Queues • BST All questions should...

Solve them accordingly


CEN 254 - Midterm Exam Details There are 11 questions with different levels of difficulty from the categories below: • Java Primer • ArrayList • LinkedList • Stack • Queues • BST All questions should be solved using the category they belong. How to solve ? • Write your name, surname, and the department at the first line of each solution file in comments. • For each question you should read the input data from the “input.txt” file and write the result to the “output.txt” file. • The filename containing the main method must be solver.java • Do not use java libraries for LinkedLists, Stacks, Queues and BST, but implement by yourself. • Each question should be solved according to the question type • Write the explanation of all questions in a word document using this template. (Rename it after you download). Explain only the algorithm you implement for solving the question, do not explain LinkedList Stack , Queues or BST classes. • Each question should be in different project and under the default package. • DO not submit the entire project folder, or .class files. • See the sample solution https://drive.google.com/file/d/1jcI_xEVj43TmQsjm137tDXnNH5WgFLJv/view?usp=sharing How to submit ? You have two submissions: • Submit explanations as text word document file though Turnitin (you will get an email from Turnitin). • Submit both explanation and solutions as a rar/zip file on LMS at Midterm Submission section using this template. (Rename it). Do not change the name of folders inside it (Question 1, Question 2, Question 3 ….. ) Deadline: Start Time: 19.05.2020 End Time : 31.05.2020 , 23:59 Evaluation: For each question 1. Explanations : 50 points 2. Java solutions: 50 point 3. Compilation error: -50 points 4. Wrong format submission: -20 points (Pay attention to the format you submit) If any Plagiarism will be detected, the grade will FF grade and official procedures taken. Turnitin ans Moss software are used to detect plagiarism. So, before submitting copy-paste solution I want you to read the student guide about disciplinary sanctions for plagiarism. https://drive.google.com/open?id=1VLEwGE02NdEvREQe4rYgiNgb6k9_WSA_ https://theory.stanford.edu/~aiken/moss/ http://epoka.edu.al/mat/Student-Guide-2018-2019.pdf QUESTIONS Section 1: Java Primer Question no. 01 Letter Grades The University converts grades into Letter grades. And, at the end of every semester, they keep report of each course. They count the number of students receiving each grade for every course. Question: The grades are converted into letter grades using the conversion table on the right. Write a program that is going to read n student grades. And then, it will count the number of students receiving each grade. Input specification You will be given an integer number (n) at the beginning where 1 ≤ n ≤ 100. Then in the following line, you will be given n integers which are between 0 and 100. Output specification Show each letter grade followed by the number of students receiving that grade. Show the letter grades in increasing order starting from A. Sample Input 7 62 29 85 71 64 94 67 Sample Output A 1 B 1 C 1 D 3 E 0 F 1 Explanation: Here is the list of grades for each letter: A: 94 B: 85 C: 71 D: 62, 64, 67 E: No grade F: 29 Question no. 02 Secret Message Question: There are two friends who want to send short secret messages to each other. They found a special coding system which can be solved only by these two boys. The system: There is a string of characters. There is a special role of "*" sign which removes the previous letter in the string, k "*" signs remove k previous letters. Solution: There are two strings 'E' and 'D'.'E' is the given encrypted text line. The program should check 'E' so that if next element of 'E' is not '*' then writes the element into decrypted 'D', if not than remove the last element of 'E' without adding the '*' sign. Input specification There is one line of text which can contain any letters and symbols. Maximum length of text can be 255 characters. Output specification Print the secret message without any '*' characters. Sample Input I Sample Input II mx*erw*ho*abe*a lok*okl* u*ay*t t*tho*p*e e*sku*y Sample Output I Sample Output II merhaba look at the sky Section 2: ArrayList Question no. 03 Swimming Contest - 2 In swimming contests, the swimmers jump/fall into water from platforms of different heights while performing acrobatics. They are evaluated by many judges. Every judge gives a point between 0 and 10. When calculating the average of the swimmer, usually two of the evaluations (Max and min) are discarded and the average is calculated out of the rest of the judges. But this year, the organization committee has decided to discard the middle grade. There will be 5 juries, and you are asked to calculate the average grade by discarding the middle grade. Question: Write a program that is going to read swimming information for n swimmers. Then, your program should calculate and show the top m medalists. Input specification You will be given two integers in the first line: n, the number of people and m: the number of top swimmers to show where 1 ≤ m ≤ n &le 10,000. Then, in the following n lines you will have the information for swimmers. In every line, first you will be given the name of swimmer and that is followed by 5 points given by the judges. The names contain at most 15 (only 26 English) letters and no special characters or space. Output specification Show the name of top m swimmers. If there are several swimmers with the same average, show the people in ascending name order. Sample Input I 3 2 Shaun 8.4 5.6 7.2 9.2 8.1 George 5.4 8.7 6 9.9 7.6 Kim 7.5 5.2 5.9 9.1 8.5 Sample Output I Shaun George When the middle grades are discarded the swimmers have the following averages: 1. Shaun: 7.6 2. George: 7.5 3. Kim: 7.175 Question no. 04 Student Scholarships Question: University has processed the student applications and according to several criteria, scholarship for each student has been decided. The admission office takes the ids and the percentage of scholarships for n students. Later, m students ask about their scholarships. Show the number of students who have 75% or more scholarships among the m students. Input specification: You will be given two numbers n and m. Then the following n lines will have ids and scholarship amounts of n students. The following m lines will have the ids of m students where 1 ≤ m < n ≤ 5e4, ids are integers between 1 and 1e8 and scholarship percentages are integers between 0 and 100. output specification: show one integer. sample input 6 3 11 0 2 80 6 30 4 0 7 0 10 90 2 4 10 sample output 2 explanation: there are 6 students and 3 of them have asked about their results. student with the id 4, has no scholarship. student with the id 2, has 80% scholarship, and student with the id 10, has 90% scholarship. so, there are 2 students who has 75% or more scholarship. section 3: linkedlist question no. 05 national elections - 1 every fourth year, national elections are held throughout the country. after voting, people sign the register notebook. and then, to prevent multiple votes, their right hand index finger is dyed with an indelible ink. this year government wants to change the system to computerized system. after voting the people will be registered to the computer. for this purpose, the lists from different regions are collected in the city center. and full sorted list is going to be prepared for the database. question: write a program that reads n people information (name, surname, personal identification number (pin)) from two different regions. then, your program will merge the two lists and sort people information according to pins in ascending order to produce one big list. finally, the program will show the k th positioned person's information from the sorted list. input specification the input will have two sections. • the list from the first region • the list from the second region the first line of the first region contains two integers (n and k) where n denotes the number of people and k denotes the position of the person to show in the output. each of the following n lines will have space separated people information: • name: at most 12 chars string containing only english letters. • surname: at most 12 chars string containing only english letters. • pin: 9 digit integer number after the first list, there will be an integer number (m) and the following m lines will have people information from the second region where 1 ≤ n ≤ 5,000; 1 ≤ m ≤ 5,000 and 1 ≤ k ≤ 10,000. output specification show kth person's information from the merged and sorted list. (positions start from 1) sample input i 6 3 rodrigo chilton 495008016 despina roark 431711128 vashti sutton 358575755 kathy valencia 111493853 byron miller 805827373 rodrigo kinney 436512022 5 shamika cone 197767850 felix regalado 606171045 stuart pitre 772541445 viola johnston 231606490 marcy fusco 393310572 n="" ≤="" 5e4,="" ids="" are="" integers="" between="" 1="" and="" 1e8="" and="" scholarship="" percentages="" are="" integers="" between="" 0="" and="" 100.="" output="" specification:="" show="" one="" integer.="" sample="" input="" 6="" 3="" 11="" 0="" 2="" 80="" 6="" 30="" 4="" 0="" 7="" 0="" 10="" 90="" 2="" 4="" 10="" sample="" output="" 2="" explanation:="" there="" are="" 6="" students="" and="" 3="" of="" them="" have="" asked="" about="" their="" results.="" student="" with="" the="" id="" 4,="" has="" no="" scholarship.="" student="" with="" the="" id="" 2,="" has="" 80%="" scholarship,="" and="" student="" with="" the="" id="" 10,="" has="" 90%="" scholarship.="" so,="" there="" are="" 2="" students="" who="" has="" 75%="" or="" more="" scholarship.="" section="" 3:="" linkedlist="" question="" no.="" 05="" national="" elections="" -="" 1="" every="" fourth="" year,="" national="" elections="" are="" held="" throughout="" the="" country.="" after="" voting,="" people="" sign="" the="" register="" notebook.="" and="" then,="" to="" prevent="" multiple="" votes,="" their="" right="" hand="" index="" finger="" is="" dyed="" with="" an="" indelible="" ink.="" this="" year="" government="" wants="" to="" change="" the="" system="" to="" computerized="" system.="" after="" voting="" the="" people="" will="" be="" registered="" to="" the="" computer.="" for="" this="" purpose,="" the="" lists="" from="" different="" regions="" are="" collected="" in="" the="" city="" center.="" and="" full="" sorted="" list="" is="" going="" to="" be="" prepared="" for="" the="" database.="" question:="" write="" a="" program="" that="" reads="" n="" people="" information="" (name,="" surname,="" personal="" identification="" number="" (pin))="" from="" two="" different="" regions.="" then,="" your="" program="" will="" merge="" the="" two="" lists="" and="" sort="" people="" information="" according="" to="" pins="" in="" ascending="" order="" to="" produce="" one="" big="" list.="" finally,="" the="" program="" will="" show="" the="" k="" th="" positioned="" person's="" information="" from="" the="" sorted="" list.="" input="" specification="" the="" input="" will="" have="" two="" sections.="" •="" the="" list="" from="" the="" first="" region="" •="" the="" list="" from="" the="" second="" region="" the="" first="" line="" of="" the="" first="" region="" contains="" two="" integers="" (n="" and="" k)="" where="" n="" denotes="" the="" number="" of="" people="" and="" k="" denotes="" the="" position="" of="" the="" person="" to="" show="" in="" the="" output.="" each="" of="" the="" following="" n="" lines="" will="" have="" space="" separated="" people="" information:="" •="" name:="" at="" most="" 12="" chars="" string="" containing="" only="" english="" letters.="" •="" surname:="" at="" most="" 12="" chars="" string="" containing="" only="" english="" letters.="" •="" pin:="" 9="" digit="" integer="" number="" after="" the="" first="" list,="" there="" will="" be="" an="" integer="" number="" (m)="" and="" the="" following="" m="" lines="" will="" have="" people="" information="" from="" the="" second="" region="" where="" 1="" ≤="" n="" ≤="" 5,000;="" 1="" ≤="" m="" ≤="" 5,000="" and="" 1="" ≤="" k="" ≤="" 10,000.="" output="" specification="" show="" kth="" person's="" information="" from="" the="" merged="" and="" sorted="" list.="" (positions="" start="" from="" 1)="" sample="" input="" i="" 6="" 3="" rodrigo="" chilton="" 495008016="" despina="" roark="" 431711128="" vashti="" sutton="" 358575755="" kathy="" valencia="" 111493853="" byron="" miller="" 805827373="" rodrigo="" kinney="" 436512022="" 5="" shamika="" cone="" 197767850="" felix="" regalado="" 606171045="" stuart="" pitre="" 772541445="" viola="" johnston="" 231606490="" marcy="" fusco="">
Jul 05, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here