Coding object oriented language

Department of Computer Science

 

Don't use plagiarized sources. Get Your Custom Essay on
Coding object oriented language
Just from $13/Page
Order Essay

CS 115-Assignment 3

 

Submit source files (.cpp)

 

Question 1 [10].  (Template) Design a generic function that returns a minimum element from an array. The function should have two parameters. One is the array of a generic type, and the other is the size of the array. Test the function with an array of int, double, and string values.

 

 

Question 2 [10]. Use pointers to write a function that finds the largest element in an array of integers. Use {6, 7, 9, 10, 15, 3, 99, -21} to test the function.

 

Question 3 [15].  A class Student can have three member variables: name, age, and an array of grades of two exams marks [5]. The grades can be integers (0-100), doubles (0.0-100.00) and characters (A-F, where F denotes grades less than 50). Write a class template to accommodate all five types of grades. The class template must have two constructors (no-arg constructor, and a constructor that takes 7 parameters: name, age and grades of 5 exams). Write a function to read an object from console, and another function to print the object to the console. Implement the class template by creating three objects with three different types (int, double and char) of grades, and printing the objects on the console.

 

Question 4 a) [8]. Write two overloaded functions that return the sum of values at even locations of an array with the following headers:

 

int sumOfEven(const int* array, int size);

double sumOfEven(const double* array, int size);

 

Write a test program that reads five integers or double values, invokes this function, and displays the sum of values at even locations.

 

Question 4 b) [7]. Consider the Student class as defined in Question 3 above with grades as integers. Create a vector (in unsorted order) of 5 objects of the class, and implement the sort function to sort the vector with respect to (i) name (ii) age variables in ascending order.

or

 

Question 4 b) [7]. Consider the Student class as defined in Question 3 above with grades as integers. Create a set that stores 5 objects of the class in ascending order with respect to (i) name (ii) age variables.

 

Page 1 of 1

 

Essay Assign
Calculate your paper price
Pages (550 words)
Approximate price: -

Our Advantages

Plagiarism Free Papers

All our papers are original and written from scratch. We will email you a plagiarism report alongside your completed paper once done.

Free Revisions

All papers are submitted ahead of time. We do this to allow you time to point out any area you would need revision on, and help you for free.

Title-page

A title page preceeds all your paper content. Here, you put all your personal information and this we give out for free.

Bibliography

Without a reference/bibliography page, any academic paper is incomplete and doesnt qualify for grading. We also offer this for free.

Originality & Security

At Essay Assign, we take confidentiality seriously and all your personal information is stored safely and do not share it with third parties for any reasons whatsoever. Our work is original and we send plagiarism reports alongside every paper.

24/7 Customer Support

Our agents are online 24/7. Feel free to contact us through email or talk to our live agents.

Try it now!

Calculate the price of your order

We'll send you the first draft for approval by at
Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

We work around the clock to see best customer experience.

Pricing

Flexible Pricing

Our prices are pocket friendly and you can do partial payments. When that is not enough, we have a free enquiry service.

Communication

Admission help & Client-Writer Contact

When you need to elaborate something further to your writer, we provide that button.

Deadlines

Paper Submission

We take deadlines seriously and our papers are submitted ahead of time. We are happy to assist you in case of any adjustments needed.

Reviews

Customer Feedback

Your feedback, good or bad is of great concern to us and we take it very seriously. We are, therefore, constantly adjusting our policies to ensure best customer/writer experience.