Write the usual interactive driver

Assignment Help Computer Engineering
Reference no: EM132151584

To test your Fraction class, you should, at a minimum, call the methods you created with the test cases you manually worked on in Step 1 of the lab. There are several approaches you can take:

1. Write the "usual" interactive driver, and manually enter the test cases.

2. Write a non-interactive driver, and test using just the public interface. So, in your driver, you might create two Fraction objects, add them (using the Fraction class's add() method), create a Fraction with the expected correct result (from your paper calculations in step 1 of the lab), and then check to make sure the Fraction returned from the add() method is equal() to the expected Fraction.

3. A third approach would be to write some additional methods in your Fraction class whose purpose is just to test the code. As these methods are internal to your Fraction class, they have access to the private fields. So, with this approach, you could write an addFractionTest() method that took six integers -- a numerator and denominator for one fraction, a numerator and denominator for a second fraction, and a numerator and denominator for the expected result. In your test method you'd create two fractions, add them using the add() method (the method you're testing), and then check the numerator and denominator of the resulting fraction.

Rather than repeating code, you are encouraged to write a testing method for each of the methods you are testing, and then call each of these methods with the test cases. For example, you could write the following method:

addFractionTest(Fraction fr1, Fraction fr2, Fraction expectedSumFr)
This method would take two Fraction objects as input, add, them, and then check to make sure the result (another Fraction object) was correct.

Reference no: EM132151584

Questions Cloud

What does the term focvs stands for in its application : Why should this concept be something considered as an entity "frames" and/or "reframes" its brand?
Write a script that checks if the value assigned : Write a script that checks if the value assigned to RandomNumber is between 0 and 10 (consider values of exactly 0 and exactly 10 to be in range).
How can technology be used for a greater social good : How can technology be used for a greater social good? Is technology inherently bad or good? Argue two points.
Competing hypothesis for the problem : How do you set up two competing hypothesis for the following problem: If the mean age of graduate students was 24 years of age
Write the usual interactive driver : Write the "usual" interactive driver, and manually enter the test cases.
Do you think there are enough available hotspots : Do you think there are enough available hotspots for wirelessly connect portable computing devices to the Internet?
Confidence interval for the population proportion : Find a 90% confidence interval for the population proportion of people who feel the president is doing an acceptable job.
Prove that a ternary tree of height h has at most : A ternary tree is either empty or consists of a node called the root and three ternary trees (called the left, middle, and right subtrees).
Simulate a sequence of 100 iid standard normal random : What test do I use for C? And how do I prove that the values in y are uncorrelated for B?

Reviews

Write a Review

Computer Engineering Questions & Answers

  What is the effective cpi of the given computer

Aerostation uses 1.5 GHZ processor with a claimed 1030-HIPS rating to execute a given program mix. What is the effective CPI of this computer?

  What kinds of ethical issues and information security

1. what types of ethical issues and information security issues are common in organizations?2. how can a company

  Which input-output control model would you use

All data from the sensors will be fed into a group of sufficiently high-powered computers so that plan managers and supervisors can control and monitor the various processes taking place. at type of interface would you use between the sensors and ..

  The web to find examples of the following site structures

Browse Web to find examples of the following site structures (A. Linear and B. Hierarchical) and describe how the content fits the structure.

  Identify at least three current software packages

Identify at least three current software packages, such as programming or application development tools, OSs, or DBMSs, distributed under the GPL s terms.

  What is it and how managed security services

what is it and how managed security services (MSSPs) can add value

  Examine the effect of caffeine on depression

His research hypothesis is that a moderate dose (25 mg) of caffeine will lower depression scores on a psychological test when compared with no caffeine.

  Gve five merits and demerits of partitioning a large hard

question 1 the unix operating system file system uses a file protection structure that differs from the file protection

  Design a minimum component circuit

The 68000 interrupt structure requires several external packages, if its full facilities are to be used. Suppose that only four interrupt levels are needed.

  Post the sales web link to your chosen computer

Post the sales web link to your chosen computer. List all of the external ports located on the computer and describe their functionality.

  How many assembly fixtures do we need

Utilization of the sub-assembly stations and the inspection station. Which one is the bottleneck of the process - What is the production rate of auto assemblies per hour and Make a time plot of the work-in-process inventory and comment on whether th..

  Questionalgorithm secreta0n - 1input an array a0n - 1 of n

questionalgorithm secreta0..n - 1input an array a0..n - 1 of n real numbersminval larr a0 maxval larr a0for i larr 1 to

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