Creating a program to search a record in array


Question 1) Define the class Counter having an attribute value. Provide a constructor which initializes value to zero. Also give following methods:

a) Increment (): that increment the value by one.

b) Decrement (): that decrement the value by one.

Question 2) Define the function Reset which takes a Counter type object as input and resets its value to zero. Make this function a friend of Counter class

Question 3) Define the class Student that has following attributes:

Name: allocated dynamically by a character pointer.

Rollno: an integer.

Marks: a double type array of 5 elements.

Percentage: a float

Include the constructor which takes values of Name, Rollno and Marks from user as input.

Also include following methods:

CalculatePercentage: It adds all 5 elements of array Marks and compute percentage according to formula Percentage =(Total marks/500)*100 and stores result in member variable Percentage.

Grade: It calls CalculatePercentage method and displays grade accordingly

Write the driver program to test your class.

Question 4) Write the program which takes the record of 10 students from user in the array and display all records.[use Student class, defined Q3]

Question 5) Define the pointer to student class to access contents of array defined in Q4. Allow user to search a record in array by means of Rollno

Question 6) Develop the class to represent the integer array. The member variables include an integer to represent the size of array and an integer pointer to represent the address of the first element of the array. The user is allowed to create the array at runtime using this class. Include suitable constructors (parameterized and copy). Also include the method which adds the contents of array.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Creating a program to search a record in array
Reference No:- TGS04778

Expected delivery within 24 Hours