ELEC 1520 Homework 8 – 2D Arrarys & Intro to Classes – 5 files for program 1 and 3 files for program 2 – Fully commented code with 4 screenshots – Perfect Solution – Instant Delivery

Lab Price = $19
Please feel free to send us your queries at: support@iqrajavaid.com
Payment methods

Add to Cart

Buy Now

View Cart


Problem Statement
ELEC 1520 Homework – 2D Arrarys & Intro to Classes
Total Points Possible, 150
Submission Instructions
There are two programs in this assignment. Create a folder named elec_1520_h8_your_name. Substitute your first and last name for “your_name” in the folder name.
Inside the elec_1520_your_name folder, create two folders named problem1 and problem2. Place the source code files for each problem in the respective folders. Source code files are .cpp and .h files.
Compress the elec_1520 parent folder as a zip file with a .zip extension. Right click on the folder and select Send to -> Compressed (zipped) folder. Upload the .zip file to Canvas.
Problem 1 – 2D Array Row and Column Summation
Write a C++ program that prompts the user to enter the number of rows and columns for a 2D array. Dynamically allocate a two-dimensional array of integers. The program should randomly fill the array with values in the range -99 to +99. The program will calculate the sum of each row and the sum of each column.
Program output:
• 2D array values, neatly formatted and aligned into columns
• The row sums
• The column sums
• Write the above to cout and to an output file
Don’t forget to clean up by deallocating memory and closing files. Don’t forget to label your output.
Error Checking
• Program should recover from cin failure, prompting user to enter data until the correct data type is read.
• If the user enters a value for rows or columns, outside the range of [1, 15], prompt the user to enter an in-range value. In other words, keep prompting the user until valid values are read from the keyboard input.
• Verify memory was allocated
• Verify the output file opened
Required Functions (at a minimum, you may have more)
• Dynamic array allocation must occur in its own function. The function parameters are rows and columns. The return type is int**.
• Function to print a 2D array. The input parameters are the array, the rows, the columns, and an ostream reference. The ostream parameter allows this function to be used to write to different output streams.
• Function to calculate the sums of all rows. The input parameters are the 2D array (filled with random values), the number of rows and columns. The function should return a pointer to an array containing the sum of each row. Example: If the array has 5 rows, then there will be 5 row sums.
• Function to calculate the sums of each column. The input parameters are the 2D array (filled with random values), the number of rows and columns. The function should return a pointer to an array containing the sum of each column. Example: If the array has 8 columns, then there will be 8 column sums.
Required Files
• main.cpp (should only contain the main function)
• array2d.h
• array2d.cpp
• helper.h
• helper.cpp (these for non-array functions like handling keyboard input)
Problem 2 – Game Character Class
Problem Statement
Create a class that represents a game character object. The game character has the following attributes:
Position: x coordinate, y coordinate
Velocity: x direction, y direction
Lifeforce energy
The characters move in a pixel-based game where all positions are integer values and all velocities are integers. All data members must be private.
Lifeforce energy is stored as a floating point value
The class must have a minimum of two constructors:
• Default constructor – all data members are initialized to zero
• Constructor with the following parameters: x position, y position, x velocity, y velocity, and life force energy.
• You may create additional constructors.
There must be a setter and getter function for each data member.
There must be an output function that has one parameter, an ostream object reference.
Files
• The class is declared in its own header file.
• The class functions are declared in their own cpp file.
• main.cpp
Submit a main.cpp file that contains code and comments testing each of the class functions.
Global Constants and Global Variable Usage
No global constants nor global variables are to be used in your programming solution. All information must be passed to and from functions. Usage of global constants or global variables will result in a 30% grade reduction.
Grading
Grading Criteria – Problem 1
Points Possible
array2d.h file – function prototype declarations, file prototype block comments, file header comments.
10
array2d.cpp file – Points are awarded for correctly implementing the required array functions. Grading is based on functions producing the correct results, implementation quality, comments, and style.
40
main.cpp file – Only contains main function The main function contains code for calling the array and helper functions, freeing memory, closing files, seeding random number generator, and declaring local variables. File should contain appropriate comments.
10
helper.h – function prototype declarations, file prototype block comments, file header comments.
10
helper.cpp
20
Total, Problem 1
90
Grading Criteria – Problem 2
Points Possible
Class declaration
10
Class function definitions
35
main
15
Total, Problem 2
60
Problem 1 Learning Outcomes (for instructor use)
Learning Outcome
L01 – Understand and use the basic programming principles of C++
Multiple functions, multiple files.
LO2 – Build programs that designate specific requirements of data types, data structures, and numeric representations of data
Requires a 2D integer array data structure.
LO3 – Identify and correct syntax, compilation, and logic errors in programs
Requires students to perform all of these when developing a working program.
LO5 – Construct program data for use in various memory spaces (global, stack, heap), pointers and memory allocation
Requires a dynamically allocated 2D integer array, and 1D integer arrays for sums.
LO6 – Deploy standard library
APIs for string manipulation and
math utilities
Requires standard library random number generation function, and
seeding random number generator
LO7 – Design code
functionalities that perform
input/output programming
Requires cin input validation, fail bit query, clearing stream flags, and
clearing input stream data. Requires output file handling.
Problem 2 Learning Outcomes (for instructor use)
Learning Outcome
LO2 – Build programs that
designate specific requirements
of data types, data structures,
and numeric representations of
data
Create a class with two constructors, getter and setter functions.
LO3 – Identify and correct
syntax, compilation, and logic
errors in programs
Requires students to perform all of these when developing a
working program.
LO7 – Design code
functionalities that perform
input/output programming
Requires use of ostream object
Relevant Material
Screenshots
H8: Problem 1 - File
H8: Problem 1 – File
H8: Problem 1 - Output
H8: Problem 1 – Output
H8: Problem 1 - File
H8: Problem 2 – File
H8: Problem 2 - Output
H8: Problem 2 – Output
Instructions
* If you want to purchase multiple products then click on “Buy Now” button which will give you ADD TO CART option.Please note that the payment is done through PayPal.
* You can also use 2CO option if you want to purchase through Credit Cards/Paypal but make sure you put the correct billing information otherwise you wont be able to receive any download link.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at support@iqrajavaid.com.
* As soon as the payment is received, download link of the solution will automatically be sent to the address used in selected payment method.
* Please check your junk mails as the download link email might go there and please be patient for the download link email. Sometimes, due to server congestion, you may receive download link with a delay.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at support@iqrajavaid.com and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side. Afterall, we are humans.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at support@iqrajavaid.com.
* MOST IMPORTANT Please use the tutorials as a guide and they need NOT to be used for any submission. Just take help from the material.
******************************************** Good Luck ***************************************************
Privacy Policy
We take your privacy seriously and will take all measures to protect your personal information.
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
Refund Policy
Incase you face any issues with the tutorial, please free to contact us on support@iqrajavaid.com
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.
Payment Details
Lab Price = $19
Please feel free to send us your queries at: support@iqrajavaid.com
Payment methods

Add to Cart

Buy Now

View Cart