Programming Homework Help

California Southern University Coding by Using Arrays Program

 

– Single dimensional arrays and loops
– Single dimensional arrays and functions
– Two 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 then to a two dimensional array with 3
columns. Display both arrays, the two-dimensional array display must look like a table with 3
columns. Each three number in sequence represents a side of a triangle. Therefore, you will have
six sets of three numbers each, which could represent three sides of a valid triangle. Use either
one of the arrays (single or two dimensional) to check each set to see if they could make a valid
triangle and if so compute the area of that triangle and copy the areas of valid triangles in another
single dimensional array. Use the array of areas to calculate the total of all areas and display
every area and the total of all areas. Use the same array to find which valid triangle has the
largest area and display the area.
Program input
None
Program output
1. Single dimensional array in one row
2. Two dimensional array in a table with 3 columns
3. Areas of every valid triangle
4. Total of all areas
5.  The largest area

Output Example
22 33 12 55 17 88 77 ……………………………..
22 33 12
55 17 88
77 … …
Triangle 1, area = ??
Triangle 2, area = ??
…………………….
…………………….
Total of all triangles is = ??? and the area of largest triangle is = ????
 

Requirement:
6. Must use arrays to save random numbers (see description)
7. Must use array to copy all valid areas
8. Must use a user defined function to generate random number
9. Must use function to calculate area of a valid triangle
10. Must use function to determine if triangle is valid
11. Must pass single dimensional array of areas to a function to calculate the total of all valid
triangles
12. Must pass array of areas to a function to find the largest area