Create a class named 'Rectangle' with two data members- length and breadth and a function to calculate the area which is 'length*breadth'. The class has three constructors which are:
1 - having no parameter - values of both length and breadth are assigned zero.
2 - having two numbers as parameters - the two numbers are assigned as length and breadth respectively.
3 - having one number as parameter - both length and breadth are assigned that number.
Now, create objects of the 'Rectangle' class having none, one and two parameters and print their areas.
Given class Triangle (in files Triangle.h and Triangle.cpp), complete main() to read and set the base and height of triangle1 and of triangle2, determine which triangle's area is larger, and output that triangle's info, making use of Triangle's relevant member functions.
Ex: If the input is:
3.0 4.0
4.0 5.0
where 3.0 is triangle1's base, 4.0 is triangle1's height, 4.0 is triangle2's base, and 5.0 is triangle2's height, the output is:
Triangle with larger area:
Base: 4.00
Height: 5.00
Area: 10.00
Write a C++ program that displays the row numbers of a matrix containing at least two even
numbers. First, the program should create a 2D array (5 rows, 5 columns). Then, ask the user to
input values in the matrix or 2D array. After that, program should display row number (or index)
which has less than 2 prime numbers. If no row (of the matrix) contains at least two prime
numbers then the program should display the message “No row found containing two prime
numbers”.
Write a program that creates and then reads a matrix of 5 rows and 5 columns of type int. while
reading; the program should not accept values greater than 100. For any entered value greater
than 100, the program should ask for input repeatedly. After reading all numbers, the system
should find the smallest number in the matrix and its location or index values. The program
should print the smallest number and its location (row and column) and also print their count.
Write a C++ program that creates a 2D array having 4 rows and 4 columns. Then, ask the user to
input values for the 2D array or matrix. After that, the program should calculate transpose of a
matrix. Transpose is basically calculated by changing rows of matrix into columns and columns
into rows. After calculating, display the final matrix.
(1) Write a program that will ask for a price.
(2) If the price is greater than 1000, compute a 10% discount from the original price. Display the computed discount.
(3) If not, just display the original price.
make a c++ program that will calculate body mass index using if-else condition.
Using class name studgrade with public data members and functions, create a program that will allow user to enter students A's grades in her five(5) major subjects, compute and display for the average grade of the student.
An array containing 10 predefined double values are already provided for you in the code editor. Print each of the element out in separate lines, starting from the last array element down to the first.
Each outputted value must also only show up to two decimal places.
Output
Multiple lines containing a float number.
5.10
5.50
4.00
4.02
3.00
3.66
2.50
2.20
1.21
1.40
Write a program using string functions that determine if the input word is a palindrome. A
palindrome word is a word that produces the same word when it is reversed.
Sample Input/output Dialogue:
Enter a word: AMA
Reversed: AMA
“It is Palindrome”
Enter a word: MAYOR
Reversed: ROYAM