a program that will ask for students grades in the prelim(30%), midterm(30%), and finals(40%) terms compute for the final_grade and determine whether remarks are passed or failed. passing grade is 60. print the name, grade, and remarks of the student
Write a program to assign the values to base class members at the time of creation of derived class object. The base class members are private members. Display the values of both base and derived class using function overriding concept.
#include
using namespace std;
class List
{
public:
int item;
int pos=0;
List* nextNode;
};
void Print_Reverse_List(List* node)
{
if (node == NULL)
return;
Print_Reverse_List(node->nextNode);
cout << node->item << " ";
}
void Insert_Element(List** head, char data)
{
List* node = new List();
node->item = data;
node->nextNode = (*head);
(*head) = node;
}
void PrinList(List *node){
List *temp = node;
while(temp !=NULL){
cout<item<<" ";
node->pos ++;
temp = temp->nextNode;
}
cout<<"\n";
}
void search_Element(List *node, int x){
List *temp = node;
while(temp !=NULL){
int data = temp->item;
if (data==x){
cout<<"\nElement found\n";
}
temp = temp->nextNode;
}
cout<<"\n";
}
int Length(List *node){
return node->pos;
}
YOUR TASK:
Create default, parameterized and copy constructor for the above code and create a manu to test the functions inside the main function.
Create a class student which stores name, date-of-birth and date-of-joining of a student. The data members date-of-birth and date-of-joining should be the objects of another class called 'date'. Input the data for 10 students and display it.
WAP to declare a class which stores a complex number. Include a member function which compares the modulus of the two complex class objects and returns the object with higher value. Include a parameterized constructor which arguments with same name as that of the class data members.
A customer makes a purchase at the store. The tax rate is 8% on all purchases
except groceries. The store offers a 5% discount to seniors 60 and over. You
should ask the user three questions: what they have bought (use a menu
displaying bread, milk, or soap), what the purchase price is, and how old they are.
Your goal is to print a formatted invoice with the following line items: price, tax,
discount, and total. The discount should only be printed if applicable.
You should test your program with 5 data sets: with and without tax and with and
without the senior discount. The fifth data set makes an invalid choice of the
menu item, in which case your program should not ask any more questions and
output an error message.
Create a class employee which stores name, id and salary of an employee. Derive two [5]
classes ‘regular’ and ‘part-time’ from it. The class ‘regular’ stores TA, DA and grade-pay
and class ‘part-time‘ stores number of hours and pay-per-hour for an employee. Display
all the information for a regular and a part-time employee, using the concept of virtual
function.
For the program given below, write statements to call display function from base and
derived class in main.
class base
{
int x;
public:
base (int a){x=a;}
void display ( )
{ cout <<x<<"\n";}
};
class derived :public base
{ int d;
public:
derived (int a, int b): base (a)
{ d=b; }
void display ( )
{cout <<d;}
};
int main ( )
{ derived D(10,20);
return 0;
}