Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In week 4 we completed Chapter 13 Programming Exercise #10 Page 974. Make sure you have a working fractionType class before starting this assignment. The

In week 4 we completed Chapter 13 Programming Exercise #10 Page 974. Make sure you have a working fractionType class before starting this assignment. The template requirement from week 4 is not required for this assignment.

Your assignment this week is to make your fractionType class safe by using exception handling.

Use exceptions so that your program handles the exceptions division by zero and invalid input.

An example of invalid input would be entering a fraction such as 7 / 0 or 6 / a

An example of division by zero would be: 1 / 2 / 0 / 3

Use a custom Exception class called fractionException. The class must inherit from exception (see example in lecture and note the entire class can be implemented in the .h file as in the lecture).

Test your safe fractionType class with a main method that forces an invalid fraction and a divide by zero. The catch block in the main method must report which kind of error was encountered i.e. invalid fraction or divide by zero.

The following can be used to test an exception:

try {

fractionType num1(1,0);

fractionType num2(0,3);

fractionType num3;

cout

cout

cout

num3 = num1 / num2;

cout

}

catch (fractionException e) {

cout

}

Submission Guidelines:

Submit modified fractionType class (.h and .cpp file if exists)

Submit fractionException class (.h file and .cpp file if exists)

Submit main test .cpp program to test the exception handling

Directions

You are to write a C++ program that meets the instruction requirements above. Use the assignment template to insert the assignment deliverables outlined above.

Deliverables

A description of your program.

Your C++ source code (do not submit screen shots).

A screenshot of your program running.

A short reflection outlining your experience developing the program.

Assignment Rubric

Grading Criteria Assignments

Maximum Points

A description of the program was not submitted,

A screenshot of the program execution was not submitted,

A copy of the program code was not submitted, or

A reflection of your programming experience was not submitted.

1

Program accomplishes requested operations per instructions

40

The code works and meets all assignment specifications

30

The code is organized and easy to follow and output is clear and clean

20

Uses software tools correctly and efficiently

10

Total

100

Assignment Template

Program Description

Program Code

Program Execution

Reflection

image text in transcribed

10. Suppose that is overloaded as a member of the class temp. What is restriction on the far left operand of * when applying on objects of type temp? (3)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions