Create a fractionexception class

Assignment Help Basic Computer Science
Reference no: EM131396044

You have been developing a Fraction class for Teacher's Pet Software. Each Fraction contains a numerator, denominator, a whole number portion, and has access to several functions you have developed, including overloaded operators. Complete these tasks:

a. Create a FractionException class. The class contains a Fraction object and a string message explaining the reason for the exception. Include a constructor that requires values for the Fraction and the message. Also include a function that displays the message.

b. Modify each Fraction class constructor and data entry function so that it throws a FractionException whenever a client attempts to instantiate a Fraction with a zero denominator.

c. Write a main()function that asks the user to enter values for four Fractions. If the user attempts to create a Fraction with a zero denominator, catch the exception, display a message, and force the Fraction to 0 / 1. Display the four Fraction objects. Save the file as FractionException1.cpp.

d. Write a main()function that asks the user to enter values for four Fractions. If the user attempts to create a Fraction with a zero denominator, catch the exception, display a message, and force the user to reenter the Fraction values. Display the four Fraction objects. Save the file as FractionException2.cpp.

e. Write a main()function that asks the user to enter values for four Fractions. If the user attempts to create a Fraction with a zero denominator, catch the exception, display a message, and terminate the program. Save the file as FractionException3.cpp.

Reference no: EM131396044

Questions Cloud

Proper application of each step of each analysis : Calculus analysis and the Kantian analysis,step by step, and tell me the answer to which each analysis leads. You will be graded on the proper application of each step of each analysis, including the reasoning behind each.
Cereal market after the storm : In the market for breakfast cereal, the market is currently in equilibrium. Suddenly there is a storm that destroys the wheat that farmers had been growing for the cereal manufacturer. What will happen to the cereal market after the storm?
Examine the major effects that government policies : Examine the major effects that government policies have on production and employment. Predict the potential effects that government policies could have on your company.
Write an explanation of why experiment must be redesigned : As the statistician in the group, you decide that a Mann-Whitney U test is appropriate.- Write an explanation of why the experiment must be redesigned.
Create a fractionexception class : Create a FractionException class. The class contains a Fraction object and a string message explaining the reason for the exception. Include a constructor that requires values for the Fraction and the message. Also include a function that displays..
Perform a mann whitney u test and write a conclusion : Suppose your friend in given problem arranged for three more cars, labeled the 9 cars A-I, changed a to .05, and conducted the "quiet" test. The results are shown in the accompanying table. Perform a Mann-Whitney U test and write a conclusion.
Write a report on network design and management trends : You will research and report on network design and management trends over the last three years (present year minus 2) in the areas of virtualization and security.
My grandmothers dumpling : Which kind of process is this essay? In other words, what is the author's purpose: Could a reader recreate the dumplings based on reading this? Or is the writer describing the process?
Create a bankaccountexception class : Modify each BankAccount class constructor and data entry function so that it throws an exception whenever a client attempts to instantiate a BankAccount with an account number that is less than 1000 or greater than 9999.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Strategic plan part-new product or service

Write a 1,200- to 1,500-word paper in which you explain the importance of innovation in your selected business's vision, mission, and values, and determine your business model for this new division. Include the following:

  Write a search to determine whether 4 is on your list

What is the value in the array element when the index contains 2?

  Novel mobile ip scheme

Consider a novel Mobile IP scheme in which a mobile station announces its permanent (home) IP address to agents in foreign networks. These agents, in turn, announce this information to other routers using their regular routing protocol update mess..

  Convincing technology decision makers

Identify a business problem and develop an IT solution. Analyze the business and customer needs, so that you can advocate for an IT solution.

  Build an entity relationship model

Build an entity relationship model

  Create a website consisting of many pages

create a website consisting of many pages organized in groups of pages linked off of the main page. The website hierarchy and key page namesare given

  Promote travel programs hosted by the library

As a volunteer at your local public library, you are helping to promote travel programs hosted by the library. The head librarian has created a document with specifics for an upcoming program called Timeless Travel Tips.

  Determine the interval of heights

The mean height of a sample of 100 high school seniors is 68 inches with a standard deviation of 4 inches. Determine the interval of heights such that the probability is 90% that the mean height of the entire population lies within that interval.

  Marginal benefit and the total cost of exercising

The optimal amount of exercise is determined by weighing the: a. marginal benefit and the total cost of exercising. b. marginal cost and the total benefit of exercising. c. marginal benefit and the marginal cost of exercisin

  What’s the margin of error for this interval

If the researcher had calculated a 99% confidence interval, would the margin of error be larger or smaller? Explain.

  Difference between a static and a final static variable

Difference between a static and a final static variable in Java? Unable to differentiate between a final and a final static member.

  Identify how it supports business processes

Identify how IT supports business processes

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd