Create a manipulator that formats floating-point values

Assignment Help Basic Computer Science
Reference no: EM131395894

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

a. Create a manipulator that formats floating-point values to display with three decimal places right-aligned in a field of 10 spaces. Write a main()function that instantiates an array of at least 10 Fraction objects, prompts the user for their values, and displays their floating-point values using the manipulator. Save the file as FractionManipulator.cpp.

b. Modify the Fraction class so that the insertion and extraction operators write and read the three parts of a Fraction (whole number, numerator, and denominator) separated by spaces. Use these operators when writing to and reading from a file. Make sure the Fraction class also contains data entry and display functions that allow user-friendly display on the screen (for example, with a slash between numerator and denominator) and data entry from the keyboard (with appropriate prompts). As a Fraction drill, write a program that prompts a student user to enter five Fraction objects for which each Fraction value is less than 1/2. Create a disk file that contains the Fractions the student creates. Save the file as FractionFile.cpp.

c. Write a program a teacher can use to review a student's progress. The program reads the Fraction objects previously created by the student and saved to disk. The program compares each Fraction to 1/2 and displays the Fraction answers that are incorrect (1/2 or more). At the end of the file, display a percent-correct score for the five student answers. Save the file as FractionGrader.cpp.

d. Teachers using the FractionFile and FractionGrader programs have discovered that students are "cheating" by learning one Fraction value that is less than 1/2, for example 1/3, and typing it for all five entries in the FractionFile program. Modify the program so that no duplicates are accepted and that five unique values are written to the data file. Save the file as FractionFileNoRepeats.cpp.

Reference no: EM131395894

Questions Cloud

Calculate the present value of a sum of money : Ruth wants to calculate the present value of a sum of money that she will receive after the demise of her grandparents. To calculate the present value, she should use the:
Fixed ratio of three boxes of strawberries : Walt consumes strawberries and cream but only in the fixed ratio of three boxes of strawberries to two cartons of cream. At any other ratio, the excess goods are totally useless to him. The cost of a box of strawberries is $10 and the cost of a ca..
Do you feel you missed out on anything because of gender : How has your sex (female) and the our society's gender roles (femininity) for your sex affected your life to this point?Do you feel you missed out on anything because of gender?What would you change about our society's gendered expectations for women..
Dealers association state of industry report : Download the latest national auto dealers association state of industry report 2014. using the data on new vehicles sale by month forest demand for new vehicles sales for the first three months for the next year.
Create a manipulator that formats floating-point values : Create a manipulator that formats floating-point values to display with three decimal places right-aligned in a field of 10 spaces. Write a main()function that instantiates an array of at least 10 Fraction objects, prompts the user for their value..
What is the process associated with becoming certified : What is the process associated with becoming certified? What is the estimated amount of time necessary to prepare for the certification exam?
Concept of price elasticity of demand : Why managers are interested in the concept of price elasticity of demand? Illustrate with examples Why are managers interested in the concept of consumer surplus? Illustrate with examples.
Concept of price elasticity of demand : Why managers are interested in the concept of price elasticity of demand? Illustrate with examples Why are managers interested in the concept of consumer surplus? Illustrate with examples.
Whether given are demonstrative - musical composition : Determine whether the following are demonstrative definitions, enumerative definitions, definitions by subclass, synonymous definitions, etymological definitions, operational definitions, or definitions by genus and difference.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Process-quality-capacity and inventory

The case study should show a relationship between the Christian values of Truett Cathy and how these Christian values influence the major operations decisions as described in Chapter 1 of the text: Process, Quality, Capacity and Inventory.

  Potentially acceptable vpn solution

State the general characteristics of one solution that meets the security and user requirements. Name the vendor(s) and VPN services. It is generally about 3 sentences.

  Modify binary_tree to take a parameter

Modify Binary_tree to take a parameter (or parameters) to indicate what kind of line to use to connect the nodes (e.g., an arrow pointing down or a red arrow pointing up). Note how this exercise and the last use two alternative ways of making a cl..

  What is the value of the checksum

What is the value of the checksum?

  What is flow control as a security measure

What is flow control as a security measure

  Which of these objects can correctly invoke the method value

Which of these objects can correctly invoke the method value Of ?

  What are the goals of lawmakers in the public sector

Describe some likely instances that demonstrate when the gathering of meta-data by businesses within this example industry may not be good for the customer. Use citations to support your arguments about how some action or result related to collec..

  What is the running time of your method

should handle at least one of the following common misspelling types: swapping two adjacent characters, inserting an extra character, deleting a single character, and replacing a character for another. What is the running time of your method?

  Develop the boolean expression for y4

Develop the Boolean expression for Y4 in the 3-to-8 decoder circuit shown below. Input C is the most significant bit. (You may use an apostrophe to indicate negation; e.g. Y = Y)

  Determine the range of air velocities

Determine the range of air velocities that would be required for the wind tunnel if Reynolds number similarity is desired and comment on the suitability of the velocities.

  Information security audits

Which of the following would be part of an bi-annual corporate audit (see a-e) and what type of information would be gathered including which polices if any would apply?

  Control flow and memory management

An exception aborts part of a computation and transfers control to a handler that was established at some earlier point in the computation.

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