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

  Implement a recursive algorithm

In your implementation, the internal recursive call should be of the form permutations (n -1) rather than permutations (k + 1) as we have used in the present algorithm.

  Compute c on both a single core shared memory

Assume that we are going to compute C on both a single core shared memory machine and a 4-core shared-memory machine. Compute the speedup we would expect to obtain on the 4-core machine, ignoring any memory issues.

  Which of the following is not a type of constructor

Which of the following is not a type of constructor? A. Copy constructor B. Friend constructor

  Accomplish this via the cli

As you can perform this in the GUI it is also important to understand how to accomplish this via the CLI. Please explain the process for assigning attributes to a file or folder.

  Combination of electrical states in the inputs

What table shows the electrical state of a digital circuit's output for every possible combination of electrical states in the inputs?

  Write a pseudocode to represent the logic of a program

Write a pseudocode to represent the logic of a program that allows the user to enter two values. the program outputs the product of the two values.

  Write a program that displays all three digit

Write a program that displays all three digit numbers: abc, that if subtracted by cba will deliver a number that contains the same digits: a, b, c, but in a different order.

  Names and majors of students

Print the names and majors of students who are taking one of the College Geometry courses. (Hint: You'll need to use the "like" predicate and the string matching character in your query.)

  Telecommunication networks frequently interconnect

Telecommunication networks frequently interconnect an organization with its customers and suppliers. Select the best fit for answer?

  Describe the web-based information technologies

Describe the Web-based information technologies

  Draw the schematic for a 4-bit version of this circuit

Consider the design of a bit-serial adder. This circuit uses a single full adder to add tow binary numbers presented in serial fashion, 1 bit at a time.

  Analyze these data and draw appropriate conclusions

Each hand truck is used four times and the data that follow are obtained. Analyze these data and draw appropriate conclusions. Use α = 0.05.

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