Create class has constructor to reduce function of fraction

Assignment Help Programming Languages
Reference no: EM1362737

Q1) Create a class RationalNumber (fractions) with the following functionality:

? Has a constructor that prevents a 0 denominator in a fraction and calls the reduce function to simplify the fraction
? Has a default constructor
? Has a private member function that reduces a fraction (see below)
? Has accessor and mutator functions for both numerator and denominator
? Has a function that displays the fraction in appropriate format. For example, the fraction 3/1 should be displayed as 3 and 7/2 as 3 1/2

This class should be implemented in two files, a header (.h) file and a source (.cpp) file. There should be a third file that contains a main function. In the main function, create and display at least three fractions including one that is reduced by the constructor, one with a denominator of 1 and one with a numerator greater than the denominator.

Reference no: EM1362737

Questions Cloud

Discuss production and trade : Show international trade theory says that relative product prices would differ if there was no trade between the countries and what is the basis for this theory?
Anorexia-bulimia and binge-eating : Anorexia, bulimia and binge-eating have been common problems since the end of World War II. As early as the 'roaring '20s,' changes in what is fashionable, with regards to body shape and control, have evolved.
Variable overhead efficiency variance calculations : V Company's product has a labor standard of 2 hours per unit. For 2011, it estimates its production will be 200,000 units (400,000 DLHs). It budgets total overhead at $900,000, which results in a fixed overhead rate of $1.50 per hour.
Is bridget making utility-maximizing choice : The price of wine is $10 per bottle, and the price of cheese is $4 per pound. The last bottle of wine added 50 units to Bridget's utility, while the last pound of cheese added 40 units. Is Bridget making the utility-maximizing choice.
Create class has constructor to reduce function of fraction : Create a class RationalNumber (fractions) with the following functionality: Has a constructor that prevents a 0 denominator in a fraction and calls the reduce function to simplify the fraction
Purpose of depreciation : Discuss the purpose of depreciation. Does the book value of a fixed asset cost minus accumulated depreciation tell a user what the asset is worth?
Vitamin pills-positive and negative effects : How might taking vitamin pills have both positive and negative effects on your body, based on your diet?
Accumulated retained earnings impact book value : Explain how accumulated retained earnings impact the book value of a firm's stock. Give two reasons why the market book share prices might be different. Be specific.
Prioritizing projects : Companies often prioritize projects in the following four categories: Absolutely essential, Highly necessary, Economically justified, and All other. Provide one example for each category. Why do firms do this type of categorization?

Reviews

Write a Review

Programming Languages Questions & Answers

  Explaining object hierarchy in object-oriented programming

Study the concept of inheritance and the object hierarchy in object-oriented programming, and write a paper comparing these concepts with the concept of inheritence.

  Write a full program to convert seconds into hours

Write a full program (starting from #include) that takes as input the number of seconds after midnight and displays the time in hours.

  Design application that would output payment coupons

Design the application that would output 12 payment coupons for each of the 15 apartments in each of the 20 buildings. Each coupon should contain the building number.

  Program to track which user is logged onto which computer

Write a computer program that could be used to track, by lab, which user is logged onto which computer.

  Generate an object-oriented design for a system

Generate an object-oriented design for a system that keeps tracks of your CD and DVD collection. Identify each of the classes, associated data, and operations for the classes.

  Write program uses while loop to output all odd numbers

Write a program that uses while loop to perform the following steps: Output all the odd numbers between firstnum and secondnum inclusive.

  Build a student record managing system application

Build a student record managing system application

  Write a program to enter the number of apartment units

Write a program that prompts the user to enter the number of apartment units, the rent to occupy all the units, the increase in rent that result in a vacant unit.

  Calculating hit ratio for program having loops

Calculate hit ratio for program that loops 10 times from locations 0 - 64.

  Define four user-defined exceptions

You will need to define four user-defined exceptions; one for unknown movies, one for unknown member, one for unknown payment method.

  Questions on programing problem with the process of analysis

Questions on Programing Problem with the process of analysis and reflection that went on as you developed the project.

  Implement functions using x86 assembly

Implement a procedure that mimics a logic unit

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