{"id":3452,"date":"2020-11-09T12:24:44","date_gmt":"2020-11-09T12:24:44","guid":{"rendered":"http:\/\/onlineclassesguru.com\/?p=3452"},"modified":"2020-11-09T12:24:44","modified_gmt":"2020-11-09T12:24:44","slug":"software-construction","status":"publish","type":"post","link":"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/09\/software-construction\/","title":{"rendered":"Software Construction"},"content":{"rendered":"<style type=\"text\/css\"><\/style><p>Answer the following questions by typing answers right in a word document. For any code, make sure to<\/p>\n<p>convert the code into COURIER NEW font and submit the exam by the due date in Blackboard.<\/p>\n<p>1. What is the \u0093principle of proximity\u0094 with regards to variable declaration and use? Why is it a<\/p>\n<p>good idea to be following this principle with regards to variables? (10 points)<\/p>\n<p>2. What is the difference between variable span and the live time of a variable? Illustrate the<\/p>\n<p>difference using an example. What are good practices with regards to the length of the variable<\/p>\n<p>span and live time. (15 points)<\/p>\n<p>3. The following control statement helps determine the season based on the value of the<\/p>\n<p>temperature. Identify any issues with this control statement, fix them and see if there is any way<\/p>\n<p>to simplify it. (Type your code in Courier New font)<\/p>\n<p>if(temperature &gt;= 90)<\/p>\n<p>print(\u201cIt must be summer!\u201d);<\/p>\n<p>else if (temperature &lt; 90 &amp;&amp; temperature &gt;= 60)<\/p>\n<p>print(\u201cIt must be spring\u201d);<\/p>\n<p>else if (temperature &lt; 60 &amp;&amp; temperature &gt;= 40)<\/p>\n<p>print(\u201cIt must be early spring\u201d);<\/p>\n<p>else if (temperature &lt; 40 &amp;&amp; temperature &gt;= 20)<\/p>\n<p>print(\u201cIt must be mild winter\u201d);<\/p>\n<p>else if (temperature &lt; 20 &amp;&amp; temperature &gt;= 0)<\/p>\n<p>print(\u201cIt is a very cold winter\u201d);<\/p>\n<p>else if (temperature &lt; 0) print(&#8220;You must be living in North Dakota&#8221;); else if (temperature &gt;= 130 &amp;&amp; temperature &lt; -100) print(&#8220;You must be not be living on earth&#8221;); (20 points) 4. The following static method implements the binary search algorithm to search for a key in an array public static int binarySearch( int [] arr, int key ) { int start = 0; int end = arr.length &#8211; 1; int middle; while ( end &gt;= start )<\/p>\n<p>{<\/p>\n<p>middle = ( start + end )\/ 2; \/\/ element in middle of array<\/p>\n<p>if ( arr[middle] == key )<\/p>\n<p>{<\/p>\n<p>return middle; \/\/ key found at middle<\/p>\n<p>}<\/p>\n<p>else if ( arr[middle] &gt; key )<\/p>\n<p>{<\/p>\n<p>end = middle \u2013 1; \/\/ search left side of array<\/p>\n<p>}<\/p>\n<p>else<\/p>\n<p>{<\/p>\n<p>start = middle + 1; \/\/ search right side of array<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>return -1;<\/p>\n<p>}<\/p>\n<p>Create a flowchart for the code and label each of the nodes using<\/p>\n<p>numbers or letters. Next determine complexity of the code using the<\/p>\n<p>McCabe\u0092s Cyclomatic number and identify the various paths of code<\/p>\n<p>execution using the labels of the nodes (like A \u0096 B \u0096 D \u0096 E \u0096 G \u0096 H).<\/p>\n<p>(For this question, you are welcome to hand raw the flowchart and take<\/p>\n<p>a picture and embed the picture in the word document)<\/p>\n<p>(20 points)<\/p>\n<p>5. Use a table driven approach to simplify the logic of the following control structure of the<\/p>\n<p>getTax() method. This method calculates the tax amount based on the status and income.<\/p>\n<p>public double getTax()<\/p>\n<p>{<\/p>\n<p>double tax = 0;<\/p>\n<p>if (status == SINGLE)<\/p>\n<p>{<\/p>\n<p>if (income &lt;= SINGLE_CUTOFF1) tax = RATE1 * income; else if (income &lt;= SINGLE_CUTOFF2) tax = SINGLE_BASE2 + RATE2 * (income &#8211; SINGLE_CUTOFF1); else tax = SINGLE_BASE3 + RATE3 * (income &#8211; SINGLE_CUTOFF2); } else { if (income &lt;= MARRIED_CUTOFF1) tax = RATE1 * income; else if (income &lt;= MARRIED_CUTOFF2) tax = MARRIED_BASE2 + RATE2 * (income &#8211; MARRIED_CUTOFF1); else tax = MARRIED_BASE3 + RATE3 * (income &#8211; MARRIED_CUTOFF2); } return tax; } Here are the declarations of the constants and instance variables used in the above method. public static final int SINGLE = 1; public static final int MARRIED = 2; private static final double RATE1 = 0.15; private static final double RATE2 = 0.28; private static final double RATE3 = 0.31; private static final double SINGLE_CUTOFF1 = 21450; private static final double SINGLE_CUTOFF2 = 51900; private static final double SINGLE_BASE2 = 3217.50; private static final double SINGLE_BASE3 = 11743.50; private static final double MARRIED_CUTOFF1 = 35800; private static final double MARRIED_CUTOFF2 = 86500; private static final double MARRIED_BASE2 = 5370; private static final double MARRIED_BASE3 = 19566; private double income; private int status; (20 points)<\/p>\n<p><center><a href=\"http:\/\/onlineclassesguru.com\/orders\/ordernow\"><img decoding=\"async\" src=\"https:\/\/encrypted-tbn0.gstatic.com\/images?q=tbn:ANd9GcTyj99p60XCLyLk1htB7-1neRt8-2QdnenNlQ&usqp=CAU\"target=\"_http:\/\/onlineclassesguru.com\/orders\/ordernow\"\/><\/center><p>","protected":false},"excerpt":{"rendered":"<p>Answer the following questions by typing answers right in a word document. For any code, make sure to convert the code into COURIER NEW font and submit the exam by the due date in Blackboard. 1. What is the \u0093principle of proximity\u0094 with regards to variable declaration and use? Why is it a good idea&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3452","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v17.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Software Construction - onlineclassesguru<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/09\/software-construction\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Software Construction - onlineclassesguru\" \/>\n<meta property=\"og:description\" content=\"Answer the following questions by typing answers right in a word document. For any code, make sure to convert the code into COURIER NEW font and submit the exam by the due date in Blackboard. 1. What is the \u0093principle of proximity\u0094 with regards to variable declaration and use? Why is it a good idea...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/09\/software-construction\/\" \/>\n<meta property=\"og:site_name\" content=\"onlineclassesguru\" \/>\n<meta property=\"article:published_time\" content=\"2020-11-09T12:24:44+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin_admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/onlineclassesguru.com\/#website\",\"url\":\"https:\/\/onlineclassesguru.com\/\",\"name\":\"onlineclassesguru\",\"description\":\"Cheap Professional coursework and reaction papers help\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/onlineclassesguru.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/09\/software-construction\/#webpage\",\"url\":\"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/09\/software-construction\/\",\"name\":\"Software Construction - onlineclassesguru\",\"isPartOf\":{\"@id\":\"https:\/\/onlineclassesguru.com\/#website\"},\"datePublished\":\"2020-11-09T12:24:44+00:00\",\"dateModified\":\"2020-11-09T12:24:44+00:00\",\"author\":{\"@id\":\"https:\/\/onlineclassesguru.com\/#\/schema\/person\/1831fa4d28e47b468621cf27932f5742\"},\"breadcrumb\":{\"@id\":\"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/09\/software-construction\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/09\/software-construction\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/09\/software-construction\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/onlineclassesguru.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Software Construction\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/onlineclassesguru.com\/#\/schema\/person\/1831fa4d28e47b468621cf27932f5742\",\"name\":\"admin_admin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/onlineclassesguru.com\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/429c8d043f7a770af242b0031e8b9f2b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/429c8d043f7a770af242b0031e8b9f2b?s=96&d=mm&r=g\",\"caption\":\"admin_admin\"},\"url\":\"https:\/\/onlineclassesguru.com\/index.php\/author\/admin_admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Software Construction - onlineclassesguru","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/09\/software-construction\/","og_locale":"en_US","og_type":"article","og_title":"Software Construction - onlineclassesguru","og_description":"Answer the following questions by typing answers right in a word document. For any code, make sure to convert the code into COURIER NEW font and submit the exam by the due date in Blackboard. 1. What is the \u0093principle of proximity\u0094 with regards to variable declaration and use? Why is it a good idea...","og_url":"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/09\/software-construction\/","og_site_name":"onlineclassesguru","article_published_time":"2020-11-09T12:24:44+00:00","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin_admin","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/onlineclassesguru.com\/#website","url":"https:\/\/onlineclassesguru.com\/","name":"onlineclassesguru","description":"Cheap Professional coursework and reaction papers help","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/onlineclassesguru.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/09\/software-construction\/#webpage","url":"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/09\/software-construction\/","name":"Software Construction - onlineclassesguru","isPartOf":{"@id":"https:\/\/onlineclassesguru.com\/#website"},"datePublished":"2020-11-09T12:24:44+00:00","dateModified":"2020-11-09T12:24:44+00:00","author":{"@id":"https:\/\/onlineclassesguru.com\/#\/schema\/person\/1831fa4d28e47b468621cf27932f5742"},"breadcrumb":{"@id":"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/09\/software-construction\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/09\/software-construction\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/09\/software-construction\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/onlineclassesguru.com\/"},{"@type":"ListItem","position":2,"name":"Software Construction"}]},{"@type":"Person","@id":"https:\/\/onlineclassesguru.com\/#\/schema\/person\/1831fa4d28e47b468621cf27932f5742","name":"admin_admin","image":{"@type":"ImageObject","@id":"https:\/\/onlineclassesguru.com\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/429c8d043f7a770af242b0031e8b9f2b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/429c8d043f7a770af242b0031e8b9f2b?s=96&d=mm&r=g","caption":"admin_admin"},"url":"https:\/\/onlineclassesguru.com\/index.php\/author\/admin_admin\/"}]}},"_links":{"self":[{"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/posts\/3452"}],"collection":[{"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/comments?post=3452"}],"version-history":[{"count":2,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/posts\/3452\/revisions"}],"predecessor-version":[{"id":3454,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/posts\/3452\/revisions\/3454"}],"wp:attachment":[{"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/media?parent=3452"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/categories?post=3452"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/tags?post=3452"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}