The coordinates of a point are a pair of numbers that define its exact location on a two dimensional plane. Create a class named Coordinate that will represent a two dimensional point. Include two data fields for the x and y axis, a constructor that will require arguments to initialize the data values. Overload the + operator and - operator such that we can add, subtract, coordinates and return doubles, respectively. Write a main() that demonstrates that your class and function work correctly.
At the peak of COVID-19, most worker started working from home. Salaries of workers were reduced by 30%. Assuming income tax was also reduced by 50% from the previous rate of 15% and workers were paid on the number of hours worked in a month and each worker is supposed to work a total of 170 hours in a month. All overtime has been cancelled. If a worker does not meet the 170 hours’ threshold for a month, 5% is deducted from the salary. Assuming the hourly rate is GHC 10, Write a c++ program for the scenario narrated above. Your program should:
a) request for an employee’s name, the number of hours worked in a
month
b) define a function called payRole, your function should compute a
worker’s salary and income tax and any deductions if any
c) your program should display the results in “b” above.
d) explain the logic behind the code especially the function
Execute this code with THREE pushes and ONE pop stack s; s.push(1); s.push(2); s.push(3); cout << s.pop( ); Suppose that s is represented by a linked list. Draw the state of the private member variables of s after the above code:
_______
head_ptr | |
|_______|
Write a program to find the greatest of two given m two different classes using friend function.
WAP in C++ to find the biggest of three numbers using friend function.
WAP in C++ to find a Fibonacci scries using copy constructor.
Write a function which takes two integers as parameter and return the largest number. Demonstrate the function using a program (call that function). Display the largest number in main function
Suppose that the input is 10 -6 12 -5 -4 0. What is the output of the following code?
int num;
int sum = 0;
cin >> num;
while (num != 0)
{
if (num>0)
sum = sum + num;
else
sum = sum - num;
cin >> num;
}
cout << ” Sum = ” << sum << endl;