[SOLVED] CS3358 - Assignment - 1

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Homework1-w1jflc.zip (306.5 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
Rate this product

Write a C++ program to do the following :
1. Create two 2D Arrays ( Array_l , Array_2 ). Each array is of size 3 x 3.
2. Write a function to populate both arrays with distinct random numbers that are between 1 and 12.
3. Write a function to display both arrays.
4. Write a function to add Array_l to Array_2 and place the result in Array_3. Display Array_3.
5. Write a function to multiply Array_l by Array_2 and place the result in Array_3. Display Array_3.
6. Write a function to display the transposed of Array_l .
7. Write a function to display the determinant of Array_l.
8. Write a display the sum of elements of each row in Array_l.
9. Write a display the sum of elements of each column in Array_l.
10. Write a display the sum of both diagonal elements in Array_l.
11. Use a function to determine whether Array_l is a special array. special Array is an arrangement of distinct numbers (i.e. each number is used once), usually integers, in a array grid, where the numbers in each row, and in each column, and the numbers in the main and secondary diagonals, all add up to the same number.
12. Repeat steps 2 — 11 until the user terminates the program.

Note :
1- Use the following formula to find the determinant of 3 by 3 Array :
If Array : a b c
A=[d e f
g h i

Then
IAI = a(ei — fh) — b(di — fg) + c(dh — eg)
2 – Use the following formula in order to find the special number Special Number = ( n ( 02+1) ) / 2

4 3 8 -■15
4 4 4
15se 15 15 15s■ 15

At the beginning of your program ( and before the #include statement ), include the following :
Header comments (file documentation block) should be at the top of each file and should contain: Author / s, Due Date, Assignment Number, Course number and section, Instructor, and a brief description of the purpose of the code in the file. For example :
// Author / s : (Your names here!!)
1/ Due Date :
1/ Programming Assignment Number 1
1/ Spring 2018 – CS 3358 – Section Number
1/
1/ Instructor: Husain Gholoom.
1/
1/ <Brief description of the purpose of the program>
Variable names :
• Must be meaningful.
• The initial letter should be lowercase, following words should be capitalized, no other caps or punctuation ( i.e. weightInPounds ).
• Each variable must be declared on a separate line with a descriptive comment.
Named constants :
• Use for most numeric literals.
• All capitals with underscores ( i.e. TX_STATE_SALES_TAX )
• Should occur at top of function, or global (only if necessary)
Line length of source code should be no longer than 80 characters (no wrapping of lines).
Indentation :
• Use 2-4 spaces (but be consistent throughout your program).
• Indent blocks, within blocks, etc.
• Use blank lines to separate sections.

Comments for variables :
All variable definitions should be commented as follows:
int gender; // integer value for the gender,
// 1 = Male , 2 = Female ,
Rules :
1. Your program must compile and run using latest version of codeblocks under windows.
2. Your program must be documented according the style above . See the website for the sample programming style program.
3. Must use random number generator to generate the 3-digit number .
4. Must use at least 10 functions other than your main function.
5. You are not allowed to use global Arrays , global variables … etc. You are also not allowed to classes and pointers.
6. You must use the appropriate libraries in writing this program.
7. Must properly format the output as it is shown on the sample run below. Replace my name with your name
8. You must name your program as :
o SP18_3358_S#_LastName_FirstName_PG1.cpp II S# is section Number
Where LastName is your Last Name and FirstName is your First Name, and S# is your section number. For example , the file name should look something like :
SP18-3358_0_Gholoom_Husain_PG1.cpp ( not .cbp ) or SP18-3358_1_Gholoom_Husain_PG1.cpp ( not .cbp ) or SP18-3358_2_Gholoom_Husain_PG1.cpp ( not .cbp )
9. You must upload your programs no later than the starting of class time on the due date. No late assignments will be accepted. Everyone must upload their program electronically.
Use Tracks To upload your program.

10. You must also turn in hard copy of your source code no later than the starting of class time on the due date . should the hard copy consist of more than one page , then , the hard copy must be stapled. if you are unable to turn in a printout during class, you can take the program to the computer science department and hand it to the front desk personal (Comal 211 ) before the deadline. Make sure that the front office stamps the program. Make sure that include the date and time. Finally ,make sure that they place the program in my mailbox. One hard copy per group.
DO NOT slide your program under my office door — It will NOT be accepted
The following points will be deducted if :
• Incorrect file format such as uploading .cbp instead of .cpp , missing electronic copy , missing the hardcopy using .h and .cpp files , Compilation Errors , Using global variables, global arrays , vectors or global vectors … etc ( – 10 points )
• Other ( 0.5 point each ) :
• Logical Errors
• Unable to read the source code due to unclear printing
• Incorrect program file name.
• Incorrect output format.
• More than one hardcopy per group or Hard copy is not stapled.
• Incorrect Style such as but not limited to Missing output header , output footer , comments or program documentations , missing
roster number , missing section number, … etc

Sample Run
Welcome to my Array program . The function of the program is to
1. Create an 2 Arrays ( Array_1 , Array_2 ). Each Array is of size 3 x 3.
2. Populate both Arrays with distinct random numbers that are between 1 and 12. Display both Arrays.
3. Adding and multiplying Array_1 and Array_2.
4. Displaying the transposed and the determinate of Array_1 .
5. Displaying the sum of elements of each row of Array_1, displaying the sum of elements of each column of Array_1 , displaying the sum of both diagonal elements of Array_1.
6. Finally , determining whether or not Array_1 is special array.
7. Repeating the above steps until the user terminates the program. Array_1
8 1 6
3 5 7
4 9 2

Array_2
1 6 8
4 10 3
2 5 7

Sum of Array 1 and Array 2

9 7 14
7 15 10
6 14 9

Product of Array 1 and Array 2
24 88 109
37 103 88
44 124 73

Transpose of Array 1
8 3 4
1 5 9
6 7 2

 

Sum of numbers in first diagonal in Array 1 = 15
Sum of numbers in second diagonal in Array 1 = 15
The special number for Array 1 is 15
The above is Special Array
Would like to check another Array – Enter y or Y for yes or n I N for no y

Array_1
1 3 5
2 4 10
6 7 12
Array_2
9 1 3
6 10 2
4 5 7
Sum of Array 1 and Array 2
10 4 8
8 14 12
10 12 19
Product of Array 1 and Array 2
47 56 44
82 92 84
144 136 116
Transpose of Array 1
1 2 6
3 4 7
5 10 12

Data Structures Programming Assignment 1
Determinate of Array 1 = 36
Sum of numbers in Row # 1 in Array 1 = 9
Sum of numbers in Row # 2 in Array 1 = 16
Sum of numbers in Row # 3 in Array 1 = 25
Sum of numbers in Column # 1 in Array 1 = 9
Sum of numbers in Column # 2 in Array 1 = 14
Sum of numbers in Column # 3 in Array 1 = 27
Sum of numbers in first diagonal in Array 1 = 15
Sum of numbers in second diagonal in Array 1 = 17
The special number is 15
The above is not a special Array

Would like to check another Array – Enter y or Y for yes or n I N for no 5
Error *** Invalid choice – Must enter y I Y I nIN
Would like to check another Array – Enter y or Y for yes or n I N for no h
Error *** Invalid choice – Must enter y I Y I n I N
Would like to check another Array – Enter y or Y for yes or n I N for no n
This algorithm is implemented By Husain Gholoom

 

  • Homework1-w1jflc.zip