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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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