Define a class Student with the following specification:
PRIVATE DATA MEMBERS:
regno integer sname 20 character s1, s2. s3 float total float
PUBLIC MEMBER FUNCTIONS:
Student() Default constructor to initialize data members, s1 = s2 = s3 = 0
Student(rn, sn, m, p, c) Parameterized constructor accept values for regno, sname, s1, s2 and s3
calculate() Function to calculate the student total marks
putdata() Function to display all the data members of student
~student() Destructor to destroy the data objects
create a class Customer with the following members:
Member variables: cid(integers) and cbalance (float).
Member functions:
Default(empty) constructor: It assigns cid and cbalance value as zero(0). Finally it print "Default Assignment".
Parameterized constructor: It receives two arguments and assign it to cid and cbalance.
void display(): This method display the values of cid and cbalance which are separated by a space.
Main method:
Implement the below code in main method and check your program output.
int main()
{
int cid;
float cbalance;
cin>>cid>>cbalance;
Customer obj1;
Customer obj2(cid,cbalance);
obj1.display();cout<<endl;
obj2.display();
return 0;
}
Create a class Customer with following details
Class
Method and Variables
Description
Customer
User defined class
int
cid
Private integer variable to denote customer id
float
balance
Private float variable to denote customer balance
int
bid
Private integer variable to denote branch id
static int
countbr
Public static integer variable and it should be initialized as zero
void get()
Public get method get the input from users such as cid, balance and bid
void find()
Public find method to find and update the number of customer having account at branch number 22 in countbr variable
static void dispalay()
This public static method display the value of the variable countbr
int main()
{
int n;
………..
………….
return 0
}
Define a class Flight with the following specifications: Private Members a data member are Flight number of type integer A data member Destination of type string A data member Distance of type float A data member Fuel of type float A member function CALFUEL() to calculate the value of Fuel as per the following criteria
Distance Fuel
<=1000 500
more than 1000 and <=2000 1100
more than 2000 2200
Public Members
Declare the class Employee, consisting of data members are emp_number, emp_name, department, salary and net_salary. The member functions are GetEmpDetails() to accept information for an employee, Calculate_DA() to calculate DA=20% of salary and display() to display the information of a employee.
input
1001
charlie
dubai
12000
output
1001
charlie
dubai
14400
Design a pay roll system to find the employee total salary using single inheritance. The base class employee consisting of data members such as emp_number and emp_name. The derived class salary consisting of data members such as Basic_pay, HRA, DA, PF, Net_pay.
Design a class Market to calculate the total expenses. Use appropriate member functions
i) The quantity and price per item are the data member of the class which is input by the user
2) discount of 10% is offered if the expense is more than 5000.
3) Calculate the total expenses
4) Display total amount, discount and Amount to pay
Write a C++ code to overload the function sqr() . In the first call of the function sqr(), an integer 15 is passed. The compiler executes the integer version of the function and returns result 225. In the second call a float value 2.5 is passed to function sqr(). The compiler executes the float value of the function and returns the result 6.25. The selection of which function to execute is decided at the run time by the compiler according to the datatype of variable passed.
Create the class Circle with attribute radius to find the area of circle. Assign the values for data member using copy constructor and display the result. Finally free the resources of data objects using destructor member function. (Note: Area of circle = 3.14 * radius * radius
One box have some apples and another box have some oranges, develop a C++ program to find the sum of fruits and double the sum of fruits in the box using call by reference concept.