Question: C++. Please follow the format in the picture below. Write a class named Circle that has a double data member named radius and a static

C++. Please follow the format in the picture below.

Write a class named Circle that has a double data member named radius and a static double data member named maxRadius. It should have a default constructor that initializes the radius to 1.0. It should have a constructor that takes a double and uses it to initialize the radius. It should have a method called calcAreathat returns the area of the Circle (use 3.14159 for pi). It should have a static set method for the maxRadius. It should also contain the definition of an exception class named IllegalRadius, which will contain a double data member called badRadius and a constructor that takes a double and uses it to initialize badRadius (see example on pages 995-6). The static maxRadius data member should be initialized to 10.0 (see example on page 710). The Circle constructor that takes a parameter should throw an IllegalRadiusException if the parameter exceeds the maxRadius.

Write a main function in a separate file. It should ask the user to input a value for the maximum radius and sets maxRadius to that value. It should then ask the user for a radius, and then create a Circle with that radius. Next it should print out the area of that Circle. Your function should use try/catch to handle the possible exception. If an IllegalRadius exception is thrown, the program should print out an error message as shown below.

Enter the maxRadius for Circles. 7.0 Enter the radius for a new Circle object. 6.0 The Circle object was successfully created. The area of the circle is 113.097.
Enter the maxRadius for Circles. 6.0 Enter the radius for a new Circle object. 7.0 The Circle object could not be created. A radius of 7 exceeds the maximum allowed radius.

The files must be named: Circle.hpp, Circle.cpp and circleMain.cpp

C++. Please follow the format in the picture below. Write a class

Contents of IntRange3. h 1 #ifnd ef INTRANGE3.H 2 #define INTRANGE3 H 4 #include 5 using namespace std 6 7 class IntRange3 9 private 10 nt input For user input 11 nt 1ower Lower 1imit of range 12 int upper I Upper limit of range 13 public: 14 I Exception class 15 class 0utOfRange 16 17 public int value; OutofRange (int 1) 18 19 20 21 22 I Hember functions 23 IntRange3 (int low, int high) value i; Constructor 24 lower 1ow upper high; 25 26 27 28 nt getInput() 29 30 31 32 cin >> input: if (input lower input upper) throw OutofRange (input) return input; 34 35 36 #endif 1 This program demonstrates the IntRange3 class 2 #1 nclude 3 #include "Int Range3.h" 4 using namespace std; 6 int main) 8 IntRange3 range(5, 10) 9 int userValue 10 1 cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!