create a class Matrix the stores it in a safe 2D array .that is it it should check for array index bounds .a constructor should allow the programmer to specify the actual dimensions of the matrix. define number functions : putel() for taking 3 argument row index , column index and the element storing it in the corresponding location. getel() for taking 2 arguments row and column indexes and returns the elements from that location . overload the operators +,-,and * appropriately
create a person class with name as it's data member . provide 4 functions getname() to get input from user and putname() to display output. Write two virtual functions getdata() and outstanding() where both these functions takes no argument and getdata() returns no value but outstanding () returns a Boolean value. Derive student and professor from person. student class should contain GPA as its float type data member and overrides the virtual functions appropriately .in professor class provide number of publications as data member and overrides the virtual functions appropriately. write a main program to declare an array of pointers to person object and depending on the choice from user create a student object or professor object and store it in person array for n persons. display the details along with whether the person is outstanding or not
Write a Car class that has constant PI = 3.147, variable capacity, method numberOfRiders with a single parameter of integer type and return nothing and finally have private inner class called Engine. Write default, parameter and Copy constructor for both classes. The engine class has two inner variables fuleType and enginePower. Also write accessors and mutator method for both classes.
Draw UML diagram for Transport, Cars, Aeroplanes, Honda Civic, Tractor, ATR plane, Boeing 747 classes, showing their inheritanc.
Half Pyramid - 4
Given an integer
The first line of input is an integer
In the example, the given starting number is
10, and the number of rows in the pyramid is 5.So, the output should be
24
23 22
21 20 19
18 17 16 15
14 13 12 11 10
Sample Input 1
10
5
Sample Output 1
24
23 22
21 20 19
18 17 16 15
14 13 12 11 10
Sum of the series
Write a program to find the sum
The first line of input is an integer
If we take
X value as 2 in the series upto 5 terms.Then the series is 2 - 23 + 25 - 27 + 29
So, the output should be
410.
Sample Input 1
2
5
Sample Output 1
410
Hollow Rectangle - 2
Write a program to print a rectangle pattern of
The first line of input is an integer
In the given example,
3 rows and 10 columns.Therefore, the output should be
+----------+
| |
| |
| |
+----------+
Sample Input 1
3
10
Sample Output 1
+----------+
| |
| |
| |
+----------+
Sample Input 2
5
10
Sample Output 2
+----------+
| |
| |
| |
| |
| |
+----------+
In a town, the percentage of men is 52 and the rest are women(
The first line of input is an integer
The output should be an integer representing the total number of women in the town.
Given total population
80000. Then the number of women should be 80000 x 48 / 100 = 38400 So the output is 38400.
100000 .So the output is 48000Given
N number of days as input, write a program to convert N number of days to years (Y), weeks (W) and days (D).Note: Take 1 year = 365 days.
The input contains single integer
Print space-separated integers
Given
N = 1329. The value can be written as 1329 = 3 years + 33 weeks + 3 daysSo the output should be
3
33
3N=0
0
0
0Given a MxN matrix, write a program to replace all elements that do not belong to principal-diagonal & anti-diagonal with Zeros.
Principal-diagonal elements are the set of elements of a matrix that lie on the line joining the top left corner to the bottom right corner.
Anti-diagonal elements are the set of elements of a matrix that lie on the line joining the bottom left corner to the top right corner.Input
The first line of input will contain two space-separated integers, denoting MxN matrix.
The next M lines will contain N space-separated integers.
input:
5 5
4 3 7 6 4
4 4 7 7 6
9 5 8 5 9
3 6 6 2 4
3 7 4 4 3
output should be like this without square brackets :
4 0 0 0 4
0 4 0 7 0
0 0 8 0 0
0 6 0 2 0
3 0 0 0 3