You are given this class definition:
class Rectangle{
private:
double side1, side2; // Side lengths
public:
Rectangle(); // Default constructor, set side lengths = 0
Rectangle(double s1, double s2); // Overloaded constructor
// Set side lengths = s1 and s2
void setSide(double s1, double s2); // Change side lengths to s1 & s2
double area(); // Calculate the area of the rectangular
double perimeter(); // Calculate the perimeter of the rectangular
double diagonal(); // Calculate the length of the diagonal
bool isSquare(); // Check if the rectangle is a square
};Please complete this class.
Chess Game Knight’s travails.
You are required to do the following:
1. Explain how you can ensure that any move do not go off the board.
2. Choosing a search algorithm for finding the shortest path for the knight’s travails.
3. Defend your choice of an appropriate search algorithm to find the best possible move from the starting square to the ending square.
4. Creating a script for a board game and a knight.
5. Create a diagrammatical tree structure, to illustrate all possible moves of the knight as children in the tree structure.
Explain at least not less than five differences between data-oriented programming and object-oriented programming. In your explanations, include concepts of data-oriented design, object-oriented design, and use at least five examples which should include source codes to support your arguments.
a. Critically explain why you would consider the concept of using methods in your
program again running a couple of if else statements.
b. Declare a method with three arguments all of type int. The method should return the
greatest of the three arguments, however if any two or all three are the same, you
method should return that value ?
c. Embed you method in a complete program that requests for three variable all of type
int and display the conditions explained in “b” above.
d. Critically explain the logic behind the code?
Write a C++ application that can compute the letter grade of a student after accepting the student’s mid and final mark. The program should only accept mid result [0-40] and final [0- 60]. If the data entered violates thisrule, the program should display that the usershould enter the mark in the specified range. The program is also expected to run until the user refuses to continue.
Write a program segment to calculate and display the total yearly income of an employee which is calculated from his total salary and annual bonus. The user will be asked to enter the employee's monthly salary and year of service. The employee's year of service will determine the bonus he receives.
Write a function to calculate the distance a vehicle has traveled for a given time period
at a given speed. The distance travelled can be calculated from the following formula:
distance = speed * time period
For example, if a car travels at 110 km per hour for three hours, the distance travelled
is 330 km.
Declare an array to store the marks of 100 students and then write the code to input
data into the array.
Write a complete program that will convert Malaysian Ringgit to Japanese Yen and
Singapore Dollar. The user will have to input an amount in Malaysian Ringgit and the
program will then display its equivalent amount in Japanese Yen and Singapore Dollar