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

  Program read weight of package of breakfast cereal in ounces

Write a program which will read the weight of package of a breakfast cereal in ounces and output weight in metric tons as well as number of boxes

  Program a robot to run mile-long steeplechase

Program a robot to run mile-long steeplechase where steeples are made from beepers instead of wall segmesnts. the robot must jumb the steeples in this race by picking the beepers that make up the steeples.

  Specific changes made for different countries-sites directed

Why were these specific changes made for different countries at whom the sites were directed? Is there anything else you would consider changing.

  Function to responds- to click anywhere on page-display box

Write a function that responds to a click anywhere on the page by displaying an alert dialog. display the event name if the user held shift during the mouse click.

  Pseudocode to create thread-safe countdownevent by locks

Write pseudocode to implement a thread-safe CountdownEvent using locks and condition variables by implementing the following methods (lists 4 methods) and then "implement a Barrier using a CountdownEvent.

  Write stored function that takes in zipcode as parameters

Write a stored function called zip_exist that takes in a zipcode.zip%Type parameter and returns a Boolean. The function will return TRUE if the zipcode passed into it exists.

  Program for insertion sort and selection sort algorithms

Write a program involving the insertion sort, merge sort and selection sort algorithms.

  Write application to use random-number to create sentences

Write an application that uses random-number generation to create sentences. Use four arrays of strings called article, noun, verb and preposition.

  Creating code for method tostring

Fill in the code for method toString, which must return a string containing the name, account number, and balance for the account.

  Design pseudocode to enter names of two primary colors

Design a pseudocode program that prompts the user to enter the names of two primary colors to mix. If the user enters anything other than "red", "blue", or "yellow".

  Program to print total balances forward and total withdrawal

At the end of report, print total balances forward, total deposits, total interest earned, total withdrawals and total final account balances.

  Write code to find largest value found in parking tickets

Without using any additional variables, write some code that results in mostTickets containing the largest value found in parkingTickets.

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