Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a class Student with data members age and marks, both of type integer. Provide a parameterized constructor and a set member function to set

Create a class Student with data members age and marks, both of type integer. Provide a parameterized constructor and a set member function to set the data members. The age should be a positive number between 15 and 40 while the marks should be between 0 and 100. Create a class Invalid Range as and 100 exception handler of the Student class. The student class should throw an exception if any of its member functions attempts to assign an invalid value to the data members.

In the main program, create objects of class student, assign valid/invalid values to the data members and catch the exceptions accordingly

Step by Step Solution

3.30 Rating (150 Votes )

There are 3 Steps involved in it

Step: 1

Solution Code and output pragma once includeStudenth include using name... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Primer Plus

Authors: Stephen Prata

6th Edition

978-0321776402, 0321776402

More Books

Students also viewed these Programming questions

Question

What does a derived class inherit from a base class?

Answered: 1 week ago