Create a rational number class

Assignment Help Basic Computer Science
Reference no: EM13220051

Create a Rational Number class. A Rational number has 2 parts, an integer numerator and an integer denominator. Add two constructors (negative denominators must be moved to the numerator), getters, setters, a print method, and an input method. Data should print as numerator/denominator. Data can be read in as two integer values separated by a space. Add methods, using overloaded operators, for addition, subtraction, multiplication, division. Code friend methods to do equality, less than relationship test, and output (overload the << operator). Code a main method to test all the class and friend methods. Be sure to test relationship methods for both true and false. Run 3 times with 2/3 and ½ ½ and 16/32 3/-5 and 2/1. Rational Operations: a/b + c/d = (a*d + b*c) / (b*d) a/b - c/d = (a*d -b*c) / (b*d) (a/b) * (c/d) = (a*c) / (b*d) (a/b) / (c/d) = (a*d) / (c*b) (a/b) = = (c/d) means (a*d) = = (c*b) (a/b) < (c/d) means (a*d) < (c*b)

Reference no: EM13220051

Questions Cloud

Explain traces of iron and titanium : traces of iron and titanium. If the sapphire were found to contain 0.155 g of oxygen, what is the mass of the gemstone?
Is buying a new car your best option : Economic considerations, including ROI, risks, cost benefits (tangible and intangible), and net present value (NPV) for the next 5 years Organizational factors, in this instance, you and your business needs for the car.
How would a substancial appreciation in the european euro : how would a substancial appreciation in the european euro in the foreign exchange market affect the quantity of imports of European products by the US How would such an appreciation of the European euro affect travel by Americans to Europe
Human resource departments responding to challenge of shrm : What are the main strategic reward options available to organization and why are reward systems potentially a problem for SHRM and what are the main ways that SHRM can integrate reward within SHRM?
Create a rational number class : Create a Rational Number class. A Rational number has 2 parts, an integer numerator and an integer denominator. Add two constructors (negative denominators must be moved to the numerator), getters, setters, a print method, and an input method.
Explain substance must evaporate to freeze : What mass (in grams) of this substance must evaporate to freeze 200g of water initially at 15 degrees C? (The heat of fusion of water is 334 J/g; the specific heat of water is 4.18 J/g-K.)
Write a class that maintains the top 10 scores : but use a singly linked list instead of an array Part 2: Implement the stack and queue with a single class interfaces with a unique class that is derived from class LinkedDeque (Code Fragment 5.21)
Write a program that accepts a temperature : Write a program that accepts a temperature in Fahrenheit from a user and converts it to Celsius by subtracting 32 from the Fahrenheit value and multiplying the result by 5/9. Display both values. Save the class as FahrenheitToCelsius.java.
Explain what is the molecular formular of phosphorus : the mass density of phosphorus vapour is 0.6388 kg per meter cube. What is the molecular formular of phosphorus under these conditions

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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