Starting from:

$20

COEN243-Assignment 4 Strings/User‐Defined Classes Solved

1.           Write a user‐defined function in C++ to display the multiplication of row element of two‐ dimensional array A[5][6] containing integer. The function does not return any value. It will print the multiplication of each row. The array elements are taken from the user in the main function and then the function is called and the array is passed to the function.



 
 
 

Example. If A = [ 2 3 4 6 2 1 3 1 0 4 5 8 3 1 0 4 5 2 3 1 1 4 5 9

3 1 3 4 1 8 ]

It will print 288 0 0 540 288 in the output.

 

2.           ( We want to create a class called Edevice, which represents the electronic devices of company. A device is defined with the following attributes: category (string) (The possible values are” Smartphone”, “Tablet”, “Laptop” and “Smartwatch”), model number (int), color (string), status (boolean) (true for new and false for used), year built (int), price (double). The member functions of the class Edevic must perform the following operations:

 

•      Return (get) functions for all attributes 

•      Modify (Set) functions for all attributes 

 

To test your class, you need to create, a driver, which is the cpp file that contains the main function. Let’s call this, testdevice.cpp. In the main function, you should prompt the user to enter information about two devices, create two objects of the class Edevice with the information entered by the user, and finally, test the member functions of the class.

More products