{"id":355,"date":"2015-04-02T00:55:06","date_gmt":"2015-04-01T13:55:06","guid":{"rendered":"http:\/\/casestudyhelp.com\/sample-questions\/?p=355"},"modified":"2018-01-29T23:12:22","modified_gmt":"2018-01-29T12:12:22","slug":"java-assignment-help","status":"publish","type":"post","link":"https:\/\/casestudyhelp.com\/sample-questions\/java-assignment-help\/","title":{"rendered":"Java Assignment Help"},"content":{"rendered":"<p style=\"text-align: justify;\">CMP 561 Algorithm Analysis<\/p>\n<p style=\"text-align: justify;\">Objective: \uf0b7 Find the data structure which yields a better CPU efficiency than java.util.ArrayList in a search-oriented operation\/application. Listed below are data structures that you can select from.<br \/>\nName<br \/>\nSynchronization<br \/>\nOrder<br \/>\nDuplicated Records<br \/>\nVector<br \/>\nSynchronized<br \/>\nQueue<br \/>\nYes<br \/>\nHashtable<br \/>\nSynchronized<br \/>\nRandom<br \/>\nYes<br \/>\nHashMap<br \/>\nUnsynchronized<br \/>\nRandom<br \/>\nYes<br \/>\nLinkedHashMap<br \/>\nUnsynchronized<br \/>\nLeast recently used<br \/>\nYes<br \/>\nTreeMap<br \/>\nUnsynchronized<br \/>\nNatural<br \/>\nYes<br \/>\nHashSet<br \/>\nUnsynchronized<br \/>\nRandom<br \/>\nNo<br \/>\nLinkedHashSet<br \/>\nUnsynchronized<br \/>\nLeast recently used<br \/>\nNo<br \/>\nTreeSet<br \/>\nUnsynchronized<br \/>\nNatural<br \/>\nNo<br \/>\nThe attached program, ByArrayList.java, calculates and displays the time needed to perform some search operations. This program searches for records by the 2-character state code. The data records are stored in qz4Data.csv file. Each data record\/line consists of 5 attributes\/fields, separated by commas:<br \/>\n\uf0b7 ID (Unique, no duplicates)<br \/>\n\uf0b7 Age<br \/>\n\uf0b7 State (2-character abbreviation)<br \/>\n\uf0b7 Gender (M or F)<br \/>\n\uf0b7 Status (0: not processed; 1: processed; 2: approved)<br \/>\nShown below are some sample runs of ByArrayList:<br \/>\nC:\\ Java ByArrayList<br \/>\nCPU time used: 10401 ms<br \/>\nC:\\ Java ByArrayList<br \/>\nCPU time used: 12047 ms<br \/>\nC:\\ Java ByArrayList<br \/>\nCPU time used: 10937 ms<br \/>\nYou are tasked to:<br \/>\nA. Develop a program to perform the identical operation as ByArrayList.java program, using a data structure which gives a better CPU efficiency.<br \/>\nB. Provide a comment file in MS Word or pdf format to summarize your conclusion.<br \/>\nC. Give a 2-minute presentation. You need to \uf0b7 Show the difference between the outputs generated from ByArrayList and your program. \uf0b7 Show the key statements that generate your program output.<br \/>\n\uf0b7 Be prepared to answer questions.<br \/>\nPlease name your .java file as: YourLastNameQz4.java and YourLastNameQz4<br \/>\nCMP561 Quiz #4 Page 2<br \/>\nQuiz #4 Grading Policy<br \/>\nDeducted<br \/>\nWhy<br \/>\n5%<br \/>\nSubmitted a solution that is identical or similar to the one submitted by others.<br \/>\n5%<br \/>\nSubmitted a solution that has nothing or little to do with the requirements.<br \/>\n3%<br \/>\nSubmitted an incomplete solution.<br \/>\n3%<br \/>\nSubmitted a file that cannot be compiled.<br \/>\n2%<br \/>\nSubmitted a program that generates a run-time error\/exception.<br \/>\n2%<br \/>\nSubmitted a program generates an incorrect output.<br \/>\n2%<br \/>\nDid not submit a comment file.<br \/>\n2%<br \/>\nDid not give a presentation.<br \/>\n2%<br \/>\nThe presentation showed that you did not complete the program by yourself.<br \/>\n1%<br \/>\nFailed to answer at least one question during the presentation.<br \/>\n1%<br \/>\nSubmitted one or more binary files.<br \/>\n1%<br \/>\nSubmitted one or more files without your name.<br \/>\n1%<br \/>\nDid not follow the file naming instruction.<br \/>\n1%<br \/>\nComment file does not provide a conclusion.<br \/>\n1%<br \/>\nThe conclusion has little or nothing to do with the requirements.<br \/>\n1%<br \/>\nThe conclusion is inconsistent with the program output.<br \/>\n\/**<br \/>\nThis program uses java.util.ArrayList to store data records for search operations. It shows the time needed to search records by the 2-character state code.<br \/>\n**\/<br \/>\nimport java.util.*;<br \/>\nimport java.io.*; public class ByArrayList {<br \/>\npublic static void main(String []args) throws IOException<br \/>\n{<br \/>\nString line;<br \/>\nString []pattern = { &#8220;VA&#8221;, &#8220;MD&#8221;, &#8220;CT&#8221;, &#8220;DC&#8221;, &#8220;CA&#8221;, &#8220;FL&#8221;, &#8220;OH&#8221;, &#8220;AZ&#8221;, &#8220;NY&#8221;, &#8220;NJ&#8221; };<br \/>\nArrayList &lt;Qz4Data&gt; records = new ArrayList&lt;Qz4Data&gt; ();<br \/>\nBufferedReader inFile = new BufferedReader(new FileReader(&#8220;qz4Data.csv&#8221;));<br \/>\nwhile ((line = inFile.readLine()) != null)<br \/>\nrecords.add(new Qz4Data(line));<br \/>\ninFile.close();<br \/>\nlong startTime = System.currentTimeMillis(); \/\/ start time<br \/>\nfor (int k=0; k &lt; 200; ++k)<br \/>\nfor (int i=0; i &lt; pattern.length; ++i)<br \/>\nfor (Qz4Data s : records)<br \/>\ns.getState().equals(pattern[i]);<br \/>\nlong endTime = System.currentTimeMillis(); \/\/ end time<br \/>\nSystem.out.print(&#8220;CPU time used: &#8221; + (endTime &#8211; startTime) + &#8221; ms&#8221;);<br \/>\n} \/\/ main<br \/>\n} \/\/ ByArrayList<br \/>\nclass Qz4Data<br \/>\n{<br \/>\nString ID, state, gender;<br \/>\nint age, status;<br \/>\nQz4Data() {}<br \/>\nQz4Data(String l)<br \/>\n{<br \/>\nStringTokenizer st = new StringTokenizer(l, &#8220;,&#8221;);<br \/>\nID = st.nextToken(&#8220;,&#8221;).trim();<br \/>\nage = Integer.valueOf(st.nextToken(&#8220;,&#8221;));<br \/>\nstate = st.nextToken(&#8220;,&#8221;).trim();<br \/>\ngender = st.nextToken(&#8220;,&#8221;).trim();<br \/>\nstatus = Integer.valueOf(st.nextToken(&#8220;,&#8221;));<br \/>\n}<br \/>\npublic String getID() { return ID; }<br \/>\npublic String getState() { return state; }<br \/>\npublic String getGender() { return gender; }<br \/>\npublic int getAge() { return age; }<br \/>\npublic int getStatus() { return status; }<br \/>\npublic void setAge(int a) { age = a; }<br \/>\npublic void setState(String s) { state = s; }<br \/>\npublic void setStatus(int s) { status = s; }<br \/>\n} \/\/<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center;\"><strong>To get answer chat with online assignment adviser<\/strong><\/p>\n<p style=\"text-align: justify;\" align=\"center\"><a title=\"hire best assignment experts online\" href=\"https:\/\/casestudyhelp.com\/MyOrder.php\"><img decoding=\"async\" src=\"https:\/\/casestudyhelp.com\/images\/hire-best-assignment-experts-online.gif\" alt=\"Hire Your Assignment Writing Expert for Collage\/University\" \/><\/a><\/p>\n<p style=\"text-align: justify;\" align=\"center\">\n<p style=\"text-align: center;\"><strong>Ask Your\u00a0<a title=\"Java Assignment Help Online\" href=\"https:\/\/casestudyhelp.com\/computer-assignment\/java-assignment-help-from-java-expert.html\" target=\"_blank\">Java Assignment Help Online<\/a><\/strong><strong>?<\/strong><br \/>\n<strong>Check out our\u00a0<a title=\"Java Programming Assignment Help Service\" href=\"https:\/\/casestudyhelp.com\/computer-assignment\/java-programming-assignment-help.html\" target=\"_blank\">Java Programming Assignment Help Service<\/a><\/strong><br \/>\n<strong>Find Your\u00a0<a title=\"computer science assignment topics\" href=\"https:\/\/casestudyhelp.com\/computer-assignment\/\" target=\"_blank\">computer science assignment topics<\/a><\/strong><\/p>\n<script type=\"text\/javascript\" charset=\"utf-8\" src=\"http:\/\/w.sharethis.com\/widget\/?wp=6.2.9\"><\/script>","protected":false},"excerpt":{"rendered":"<p>CMP 561 Algorithm Analysis Objective: \uf0b7 Find the data structure which yields a better CPU efficiency than java.util.ArrayList in a search-oriented operation\/application. Listed below are data structures that you can select from. Name Synchronization Order Duplicated Records Vector Synchronized Queue Yes Hashtable Synchronized Random Yes HashMap Unsynchronized Random Yes LinkedHashMap Unsynchronized Least recently used Yes [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[191],"tags":[196,17,195,13,8],"_links":{"self":[{"href":"https:\/\/casestudyhelp.com\/sample-questions\/wp-json\/wp\/v2\/posts\/355"}],"collection":[{"href":"https:\/\/casestudyhelp.com\/sample-questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/casestudyhelp.com\/sample-questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/casestudyhelp.com\/sample-questions\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/casestudyhelp.com\/sample-questions\/wp-json\/wp\/v2\/comments?post=355"}],"version-history":[{"count":3,"href":"https:\/\/casestudyhelp.com\/sample-questions\/wp-json\/wp\/v2\/posts\/355\/revisions"}],"predecessor-version":[{"id":2830,"href":"https:\/\/casestudyhelp.com\/sample-questions\/wp-json\/wp\/v2\/posts\/355\/revisions\/2830"}],"wp:attachment":[{"href":"https:\/\/casestudyhelp.com\/sample-questions\/wp-json\/wp\/v2\/media?parent=355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/casestudyhelp.com\/sample-questions\/wp-json\/wp\/v2\/categories?post=355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/casestudyhelp.com\/sample-questions\/wp-json\/wp\/v2\/tags?post=355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}