Question

Start of Checkpoint 25 The Task Add the following class to the Practical04 project. public class Prac4 public static int max3

New F L Choose ie Type de Types: Categories Swing Gu Forms Test Suite TestNG Test Case AWT GU Unit Tests Persetence Descrigti

COMP2741/COMP8741 Practical 4, Checkpoints 25-32 NetBeans will create a test class called Prac4Test in Test Packages. Note

please help me to solve this question, show the specific steps for me, thanks a lot !

Start of Checkpoint 25 The Task Add the following class to the Practical04 project. public class Prac4 public static int max3 (int numl, int num2, int num3) return-1; It contains a method stub called max3 which is supposed to return the largest of its three integer parameters. For example, int st Prac4.max3 (9,3, 4) System.out.println (st); // outputs "9" (without the quotes) Do not change the implementation of the max3 method just yet. Create the appropriate JUnit tests for the method. HINT: to create the JUnit tests in NetBeans, first save your source file, then right-click on the project icon and select New -> Other and choose Unit Tests from the Categories list and Test for Existing Class from the File Types list. As shown belovw
New F L Choose ie Type de Types: Categories Swing Gu Forms Test Suite TestNG Test Case AWT GU Unit Tests Persetence Descrigtion create憋舂縻pie An褱te吠cose for testng method, ef ㅎ single class Click Next 2 Exsting Cass To Test Test Packages Leves Geserated Code Source Code Tast Fiselz Package Privete Test Clees itelizer Clais Pindlic Hap For the "Class to Test" select Browse and select Prac4 from the Practical04 package Click Finish. Netbeans may prompt for which version of JUnit to use: Select JUnit 4.x. NOTE: you may be prompted to install a JUnit Package or you might not be prompted to select a JUnit version (as your version of NetBeans might have a different configuration). See you demonstrator for assistance. NOTE: The next time you create a test you can just select New->Test for Existing Class...
COMP2741/COMP8741 Practical 4, Checkpoints 25-32 NetBeans will create a test class called Prac4Test in "Test Packages". Note that JUnit tests generally do not print out the result of calling a method. They typically store the value in a variable and compare it with an expected result using one of the assert?? methods from the org.junit.Assert. classes. The test code generated by NetBeans (which you will need to add additional tests to) has this structure. Add more methods with the @Test annotation to comprehensively test the expected output of max3 Do not change the implementation of the max3 method just yet. To run your tests, right-click on the class Prac4 and select Test File. Show your code to a demonstrator and be prepared to explain why it is correct and why your tests are appropriate and comprehensive. At this point your method stub should fail most the tests. This completes checkpoint 25.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

//step 1

File Edit View Navigate Source Refactor Run Debug Profile Team Tools Window Help ·Search (Ctrl+0 <default config> ava PizzaPr

step2

New File Choose File Type Steps Choose File Type 1. Project: max3 Filter: File Types: Categories: Unit Test Java Ju Test for

/**
* do not change the implementation
* of the max3 method yet
* supposed to return the largest among three numbers
*/
public class Prac4 {
  
public static int max3(int num1,int num2,int num3)
{
return -1;
}
}


import org.junit.Test;
import static org.junit.Assert.*;

/**
*
* @author
*/
public class Prac4Test {
@Test
  
public void test1()
{
int st = Prac4.max3(9, 3, 4);
assertEquals("The output must be 9. ",9,st);
  
  

}
@Test
  
public void test2()
{
int st = Prac4.max3(10, 23, 14);
assertEquals("The output must be 23. ",23,st);
  
  

}
}

//output

Tests passed: 0.00 % No test passed, 2 tests failed. (0.234 s) Prac4Test Failed e-4, test1 Failed: The output must be 9. expe

//if you need any help regarding this solution ........... please leave a comment ........ thanks

Add a comment
Know the answer?
Add Answer to:
please help me to solve this question, show the specific steps for me, thanks a lot ! Start of Checkpoint 25 The Task...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This assignment is designed to give you practice with Javadoc, creating unit tests and using Junit....

    This assignment is designed to give you practice with Javadoc, creating unit tests and using Junit. Be sure to follow all style and documentation requirements for THIS class. See the style and documentation requirements posted on Canvas. You are to name your package assign1 and your file Palindrome.java. Palindrome Class Palindrome testString : String + Palindrome (String) + isPalindrome (): boolean The method isPalindrome is to determine if a string is a palindrome. A palindrome, for this assignment, is defined...

  • Java, can you help me out thanks. CSCI 2120 Introduction For this assignment you will implement...

    Java, can you help me out thanks. CSCI 2120 Introduction For this assignment you will implement two recursive methods and write JUnit tests for each one. You may write all three methods in the same class file. You are required to write Javadoc-style documentation for all of your methods, including the test methods. Procedure 1) Write method!! a recursive method to compare two Strings using alphabetical order as the natural order (case insensitive, DO NOT use the String class built-in...

  • Please help me to answer the 5 programming questions and give some specific explanations, thanks a...

    Please help me to answer the 5 programming questions and give some specific explanations, thanks a lot !!! Question Consider a class hierarchy that includes a class called Creature, with subclasses called Unicorn and Dragon. The Creature class has a method called feelsLike, Not yet answered which is overridden in the Unicorn and Dragon class. Marked out of The feelsLike method of the Creature class returns "smooth", while the feelsLike method is overridden in the Unicorn class to return "fluffy"...

  • Be sure to submit homework via Canvas, not email. Ask questions via email or Canvas inbox....

    Be sure to submit homework via Canvas, not email. Ask questions via email or Canvas inbox. Late assignments will not be accepted. Important: please zip the complete NetBeans project file (not just the jar or .java file) before submitting to Canvas. If you just submit the jar or .java file, it will not be graded and if you later submit the NetBeans project it may be treated as a late submission. Please name the project after your name (e.g., HWSFirstNameLastName)....

  • signature 1. Create a new NetBeans Java project. The name of the project has to be...

    signature 1. Create a new NetBeans Java project. The name of the project has to be the first part of the name you write on the test sheet. The name of the package has to be testo You can chose a name for the Main class. (2p) 2. Create a new class named Address in the test Two package. This class has the following attributes: city: String-the name of the city zip: int - the ZIP code of the city...

  • Additional code needed: PartA: BurgerOrder class (1 point) Objective: Create a new class that represents an...

    Additional code needed: PartA: BurgerOrder class (1 point) Objective: Create a new class that represents an order at a fast-food burger joint. This class will be used in Part B, when we work with a list of orders. As vou work through this part and Part B, draw a UML diagram of each class in using the UML drawing tool 1) Create a new Lab5TestProject project in Netbeans, right-click on the lab5testproject package and select New>Java Class 2) Call your...

  • NO VECTORS PLEASE Start a simple Matrix template class In this lab, you’ll be writing a...

    NO VECTORS PLEASE Start a simple Matrix template class In this lab, you’ll be writing a template class to represent a matrix. Because it’s a template, your matrix class will be able to work with different types of underlying data. Start by creating a new file matrix.hpp. Inside this file, start to write your matrix template class. Here’s a start for the class definition: template <class T> class Matrix { private: int _rows; int _cols; T** data; public: Matrix(int rows,...

  • (Java with Netbeans) Programming. Please show modified programming code for already given Main class, and programming...

    (Java with Netbeans) Programming. Please show modified programming code for already given Main class, and programming for code for the new GameChanger class. // the code for Main class for step number 6 has already been given, please show modified progrraming for Main class and GameCHanger class, thank you. package .games; import java.util.Random; import java.util.Scanner; public class Main { public static void main(String args[]) { System.out.println("Welcome to the Number Guessing Game"); System.out.println(); Scanner sc = new Scanner(System.in); // Get upper...

  • Overview This checkpoint is intended to help you practice the syntax of operator overloading with member...

    Overview This checkpoint is intended to help you practice the syntax of operator overloading with member functions in C++. You will work with the same money class that you did in Checkpoint A, implementing a few more operators. Instructions Begin with a working (but simplistic) implementation of a Money class that contains integer values for dollars and cents. Here is my code: /********************* * File: check12b.cpp *********************/ #include using namespace std; #include "money.h" /**************************************************************** * Function: main * Purpose: Test...

  • i need this in C# please can any one help me out and write the full...

    i need this in C# please can any one help me out and write the full code start from using system till end i am confused and C# is getting me hard.I saw codes from old posts in Chegg but i need the ful complete code please thanks. Module 4 Programming Assignment – OO Design and implementation (50 points) Our Battleship game needs to store a set of ships. Create a new class called Ships. Ships should have the following...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT