You must read this input file (IncomeRec.txt) and store the records of gross incomes into appropriate arrays. 2. Your program should then be able to process the following commands. i.e. program should provide user with the following menu. ▪ 1. Print the entire list. ▪ 2. Print list sorted by Gross income. ▪ 3. Print list of employees which match a given lastname initial ▪ 4. Calculate: a) the Tax corresponding to the provided gross income of each employee using Table 1; and b) the Net Income and c) Print in a file called IncomeTax.txt where the tax and Net income are displayed in separate columns. [NB. The tax is calculated according to the Tax Calculation Table provided and the Net Income = Gross income – Tax] ▪ 5. Exit program by enter 5
Consider the class of points in the xy plane. The location of each point is determined by the real numbers (x, y) specifying the cartesian coordinates. The class definition is: #include using namespace std; class point{ public: point(); point(double value_x, double value_y); double get_x() const; double get_y() const; void print() const; void move(double dx, double dy); private: double x, y; }; point::point(){ x = 0.0; y = 0.0;} point::point(double a, double b){ x = a; y = b; } void point::print() const{ cout< A = point(1, 2); A.print(); A.move(4, -5); A.print(); pointB(3.2, 4.9); cout << B.get_x() <<""<< B.get_y() << endl ; point C("day", "young"); C.print(); C.move("s","ster"); C.print(); return 0;
Write a C++ generic bubblesort function using templates that takes as parameters an array and its size. You may assume that the compared objects have a < operator already defined. Test your template function with a built-in type and a user-defined type.
Study the myMAX function provided below. You are required to create a C++ template based myMAX function and test it on different built-in data types.
//Make a template out of this function. Don't forget the return type.
int myMax(int one, int two)
{
int bigger;
if(one < two)
bigger = two;
else
bigger = one;
return bigger;
}
int main()
{
int i_one = 3, i_two = 5;
cout <<"The max of "<< i_one <<" and "<< i_two <<" is "
<< myMax(i_one, i_two) << endl;
//Test your template on float and string types
return 0;
}
Use of this pointer to find the Area of Right angel triangle:
1. Declare a class Triangle.
2. Create a constructor which sets the length and width of triangle.
3. Calculate the Area of triangle in function Area (), return the reference using this pointer.
4. Make another function Compare () which compares two calculated Areas and prints the
larger area, again return the reference using this pointer.
5. Use two different objects in main for calculating two different areas pass them to compare
Function for comparison.
Code the following diagram Progression Class should be taken as abstract class,
think carefully before implementation. Correct Approach will give you maximum
marks.
Class progession
Fields:long first
Long cur
Methods:Progession()
Long firstvalue()
Long nextvalue()
Void print progession()
Inherited classes of progression :
1) class ArithProgression
Fields:long inc
Methods:ArithProgression()
ArithProgression(long)
Long nextvalue()
2) class GeomProgression
Fields:long base Methods:GeomProgression()
GeomProgression(long)
Long nextvalue()
3)class FibonacciProgression
Fields:long prev
Methods:FibonacciProgression()
FibonaciiProgression(long, long)
Long nextvalue()
To complete our program, we define the main function, which performs a simple
test of each of the two classes.
1) Define a class called student that has the following data members:
- int student number
- string student name
- double student average
The following member functions:
- Constructor that initialize the data members with default values.
- set and get functions for each data member
- Print function to print the values of data members.
Define a class called graduatestudent that inherits data members and functions
from the class student, and then declare the following data members :
- int level
- int year
Member functions:
- constructor
-set and get functions for each data member
- Print function.
Define a class called master that inherits data members and functions from
graduatestudent class, and then declare the following data member:
- int newid.
Member function:
- constructor
- set and get function for the data member
- Print function.
Write a driver program that:
- Declare object of type student with suitab le values then print it
we want to store the marks of a student and print his final sgpa grade. create a base class Marks to convert the marks to grade. create derived classes Test-1 to store the marks of 1st test, Test-2 to store the marks of 2nd test, and SEE_marks to store the marks of final exam. Print the final SGPA after designing the appropriate input and output functions
Due to upcoming end of financial year, you are being called in to write a program which will read in an input file called IncomeRec.txt, which contains a list of Annual (Gross) income records of employees in a firm, and produce various reports as outlined. Input File: The input file called IncomeRec.txt contains a list of Annual (Gross) income records of employees in a firm. You will assume that this firm contains at most 200 active staff. Each record is on a single line and the fields are separated by a single space. The names of the fields are: • Employee Lastname (initial) - char • FNPF# - integer • Age - integer • Gross_Income - integer • Resident - cha
Mr. James wanted to calculate his interest at the Bank of Sierra Leone, with a specific amount deposited, Time and Rate. Write C++ console program of functions to calculate the interest of Mr. James. The console application should asked the user to input values of Time, Rate and Amount deposited.