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

  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