Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the Calc.java program below. Calc currently implements one function add which adds two integers. Use the Test-Driven Development (TDD) methodology to add additional functionality

Consider the Calc.java program below. Calc currently implements one function add which adds two integers. Use the Test-Driven Development (TDD) methodology to add additional functionality to subtract two integers, multiple two integers, divide two integers, and set an integer exponent to another integer. The process is to create a failing JUnit test, modify the class to make that test pass, then perform any refactoring needed. Repeat this process until each piece of functionality is added and all tests pass. Remember, TDD defines the requirements as the test themselves. You may write the actual code in an IDE and take screenshots or write the code manually in the document you submit. public class Calc { public static int add(int a, int b) { return a + b; } } a. 2. Building off of Problem 1, use TDD to further extend the Calc class. That is, the customer wants to add one additional feature as detailed below. Create a user story to allow users to save the calculated value in memory and used in consecutive calculations. b. Write the JUnit test or tests needed to satisfy this user story. Explain how the Calc class must be refactored to satisfy your JUnit test or tests. C.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Android 4 Application Development

Authors: Reto Meier

3rd Edition

1118223853, 9781118223857

More Books

Students also viewed these Programming questions