{"id":12153,"date":"2021-10-29T02:48:18","date_gmt":"2021-10-29T02:48:18","guid":{"rendered":"https:\/\/assignmenttutors.net\/blog\/?p=12153"},"modified":"2021-10-29T02:48:18","modified_gmt":"2021-10-29T02:48:18","slug":"writing-a-code-by-using-arrays-and-functions","status":"publish","type":"post","link":"https:\/\/assignmenttutors.net\/blog\/writing-a-code-by-using-arrays-and-functions\/","title":{"rendered":"writing a code by using arrays and functions"},"content":{"rendered":"<p>Assignment objectives:<\/p>\n<p><span class=\"textLayer--absolute\">&#8211;<\/span>\u00a0<span class=\"textLayer--absolute\">Single dimensional arrays and loops<\/span><br \/>\n<span class=\"textLayer--absolute\">&#8211;<\/span>\u00a0<span class=\"textLayer--absolute\">Single dimensional arrays and functions<\/span><br \/>\n<span class=\"textLayer--absolute\">&#8211;<\/span>\u00a0<span class=\"textLayer--absolute\">Two dimensional array<\/span><br \/>\n<span class=\"textLayer--absolute\">Problem Description:<\/span><br \/>\n<span class=\"textLayer--absolute\">You should have most of the codes form your previous home works.<\/span><br \/>\n<span class=\"textLayer--absolute\">Write a program that generates a sequence of 18 random numbers between 1 and 99. Assign the<\/span><br \/>\n<span class=\"textLayer--absolute\">18 numbers first to a single dimensional array and then to a two dimensional array with 3<\/span><br \/>\n<span class=\"textLayer--absolute\">columns. Display both arrays, the two-dimensional array display must look like a table with 3<\/span><br \/>\n<span class=\"textLayer--absolute\">columns. Each three number in sequence represents a side of a triangle. Therefore, you will have<\/span><br \/>\n<span class=\"textLayer--absolute\">six sets of three numbers each, which could represent three sides of a valid triangle. Use either<\/span><br \/>\n<span class=\"textLayer--absolute\">one of the arrays (single or two dimensional) to check each set to see if they could make a valid<\/span><br \/>\n<span class=\"textLayer--absolute\">triangle and if so compute the area of that triangle and copy the areas of valid triangles in another<\/span><br \/>\n<span class=\"textLayer--absolute\">single dimensional array. Use the array of areas to calculate the total of all areas and display<\/span><br \/>\n<span class=\"textLayer--absolute\">every area and the total of all areas. Use the same array to find which valid triangle has the<\/span><br \/>\n<span class=\"textLayer--absolute\">largest area and display the area.<\/span><br \/>\n<span class=\"textLayer--absolute\">Program input<\/span><br \/>\n<span class=\"textLayer--absolute\">None<\/span><br \/>\n<span class=\"textLayer--absolute\">Program output<\/span><br \/>\n<span class=\"textLayer--absolute\">1.<\/span>\u00a0<span class=\"textLayer--absolute\">Single dimensional array in one row<\/span><br \/>\n<span class=\"textLayer--absolute\">2.<\/span>\u00a0<span class=\"textLayer--absolute\">Two dimensional array in a table with 3 columns<\/span><br \/>\n<span class=\"textLayer--absolute\">3.<\/span>\u00a0<span class=\"textLayer--absolute\">Areas of every valid triangle<\/span><br \/>\n<span class=\"textLayer--absolute\">4.<\/span>\u00a0<span class=\"textLayer--absolute\">Total of all areas<\/span><br \/>\n<span class=\"textLayer--absolute\">5.<\/span>\u00a0The largest area<\/p>\n<p><span class=\"textLayer--absolute\">Requirement:<\/span><br \/>\n<span class=\"textLayer--absolute\">6.<\/span>\u00a0<span class=\"textLayer--absolute\">Must use arrays to save random numbers (see description)<\/span><br \/>\n<span class=\"textLayer--absolute\">7.<\/span>\u00a0<span class=\"textLayer--absolute\">Must use array to copy all valid areas<\/span><br \/>\n<span class=\"textLayer--absolute\">8.<\/span>\u00a0<span class=\"textLayer--absolute\">Must use a user defined function to generate random number<\/span><br \/>\n<span class=\"textLayer--absolute\">9.<\/span>\u00a0<span class=\"textLayer--absolute\">Must use function to calculate area of a valid triangle<\/span><br \/>\n<span class=\"textLayer--absolute\">10.<\/span>\u00a0<span class=\"textLayer--absolute\">Must use function to determine if triangle is valid<\/span><br \/>\n<span class=\"textLayer--absolute\">11.<\/span>\u00a0<span class=\"textLayer--absolute\">Must pass single dimensional array of areas to a function to calculate the total of all valid<\/span><br \/>\n<span class=\"textLayer--absolute\">triangles<\/span><br \/>\n<span class=\"textLayer--absolute\">12.<\/span>\u00a0<span class=\"textLayer--absolute\">Must pass array of areas to a function to find the largest area<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Assignment objectives: &#8211;\u00a0Single dimensional arrays and loops &#8211;\u00a0Single dimensional arrays and functions &#8211;\u00a0Two dimensional array Problem Description: You should have most of the codes form your previous home works. Write a program that generates a sequence of 18 random numbers between 1 and 99. Assign the 18 numbers first to a single dimensional array and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[],"class_list":["post-12153","post","type-post","status-publish","format-standard","hentry","category-computer-science"],"_links":{"self":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts\/12153","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/comments?post=12153"}],"version-history":[{"count":2,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts\/12153\/revisions"}],"predecessor-version":[{"id":12156,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts\/12153\/revisions\/12156"}],"wp:attachment":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/media?parent=12153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/categories?post=12153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/tags?post=12153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}