Define a fraction adt to represent and store rational number

Assignment Help Basic Computer Science
Reference no: EM131312960

Python provides a numeric class for working with floating-point values. But not all real numbers can be represented precisely on a computer since they are stored as binary values. In applications where the precision of real numbers is important, we can use rational numbers or fractions to store exact values. A fraction, such as , consists of two parts, both of which are integers. The top value, which can be any integer value, is known as the numerator. The bottom value, which must be greater than zero, is known as the denominator.

(a) Define a Fraction ADT to represent and store rational numbers. The ADT should include all of the common mathematical and logical operations. In addition, your ADT should provide for the conversion between floatingpoint values and fractions and the ability to produce a string version of the fraction.

(b) Provide a Python implementation of your Fraction ADT.

Reference no: EM131312960

Questions Cloud

Discuss the sustainability of the fossil fuel industry : Write a short review of an environmental law. Explicitly introduce the major provisions in the law. Discuss the sustainability of the fossil fuel industry and the problem of their use as we move into the future.
Briefly describe how your machine works : Describe a TM that solves the acceptance problem. Provide a brief but complete English description of how the machine works.
Assignment on conflict resolution : Conflict resolution is a necessary skill for any manager or leader. In this assignment, you will examine the difference between conflict and competition. You will also explore ways of determining when conflict resolution is necessary and explain w..
Applying concepts you learned in the required readings : Research a company that has moved some of its operations overseas. Discuss how this has directly affected the American workforce.  Applying concepts you learned in the required readings, discuss who has benefited more from this practice: the Unite..
Define a fraction adt to represent and store rational number : The ADT should include all of the common mathematical and logical operations. In addition, your ADT should provide for the conversion between floatingpoint values and fractions and the ability to produce a string version of the fraction.
Develop healthy-city initiative suitable for implementation : Develop a 4 page healthy-city initiative suitable for implementation by your city. What kinds of disasters, both natural and man-made, are most likely to occur in your area?
Graph the yield to maturity against the time to maturity : Graph the yield to maturity against the time to maturity.-  Is this yield curve consistent with any of the yield curve theories? Explain.
Skills that public personnel managers : Predict two (2) trends that are likely to impact public service in the future. Next, choose two (2) skills that public personnel managers may seek in response to these trends. Provide a rationale and support your position with appropriate academic..
Creates a new empty activities calendar initialized : addActivity( date, activity ): Adds the given activity description to the calendar for the given date. The date must be within the valid date range for the calendar.

Reviews

Write a Review

 

Basic Computer Science Questions & Answers

  Convert the star schema to a snowflake schema

Using these principals, convert the star schema to a snowflake schema. What impact (if any) does this have on the size of the fact table for this problem?

  Design a multidimensional database using a star schema

Describe the ideal background for an employee who is going to manage the data warehouse.

  Determine the number of gates needed to implement

Determine the number of gates needed to implement an eight-bit carry-lookahead adder assuming that the maximum fan-in for the gates is four.

  Why does a car wheel need to be balanced please expansion

Why does a car wheel need to be balanced. Please expalian

  Search the web for steganographic tools

Search the Web for steganographic tools.

  Testing is so essential to the development of a new system

Discuss why testing is so essential to the development of a new system; list the different types of testing that can be completed and why each one is critical. Can testing be overlooked to speed up the development effort?

  Three years for applications of information security

Five articles within the past three years for applications of information security, within healthcare organizations.

  Opening conference-walk around and closing conference

Under what conditions can an employee be denied access to the opening conference,walk around, and closing conference? please explain in 100 words or more list references

  Derive and analyze the resulting euler equation

Derive and analyze the resulting Euler equation. One of the difficult aspects of investment theory with adjustment costs is empirical implementation. As the value function and hence its derivative is not observable, (8.4) cannot be directly estima..

  Find the relationships for the impulse response

the roots are both real. Express your answers in terms of hyperbolic functions (sinh, cosh) to best show the properties of the system response.

  Think of a security policy

Think of a security policy you may have encountered either at school or in the workplace. Why do you suppose it was set up that way? Do you think it was effective? Would you arrive at the same solution if you were a network manager?

  Explain ieee link layer protocol

Explain IEEE link layer protocol 802.3as, by stating its purposes and features.

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