Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import java.io.IOException; import java.io.PrintWriter; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestWatcher; import org.junit.runner.Description; import org.junit.runner.JUnitCore; import org.junit.runner.Result; public class Q1Test extends student.TestCase { static JUnitCore junitCore;

image text in transcribedimport java.io.IOException;

import java.io.PrintWriter;

import org.junit.Rule;

import org.junit.Test;

import org.junit.rules.TestWatcher;

import org.junit.runner.Description;

import org.junit.runner.JUnitCore;

import org.junit.runner.Result;

public class Q1Test extends student.TestCase {

static JUnitCore junitCore;

static Class> testClasses;

@Test

public void testCase1() {

setSystemIn("1", "2", "3");

Q1.main(null);

assertEquals("Please enter 3 integers: " + "min: 1 max: 3 ", systemOut().getHistory());

}

@Test

public void testCase2() {

setSystemIn("1", "3", "2");

Q1.main(null);

assertEquals("Please enter 3 integers: " + "min: 1 max: 3 ", systemOut().getHistory());

}

@Test

public void testCase3() {

setSystemIn("2", "1", "3");

Q1.main(null);

assertEquals("Please enter 3 integers: " + "min: 1 max: 3 ", systemOut().getHistory());

}

@Test

public void testCase4() {

setSystemIn("2", "3", "1");

Q1.main(null);

assertEquals("Please enter 3 integers: " + "min: 1 max: 3 ", systemOut().getHistory());

}

@Test

public void testCase5() {

setSystemIn("3", "2", "1");

Q1.main(null);

assertEquals("Please enter 3 integers: " + "min: 1 max: 3 ", systemOut().getHistory());

}

@Test

public void testCase6() {

setSystemIn("3", "1", "2");

Q1.main(null);

assertEquals("Please enter 3 integers: " + "min: 1 max: 3 ", systemOut().getHistory());

}

@Test

public void testCase7() {

setSystemIn("1", "1", "1");

Q1.main(null);

assertEquals("Please enter 3 integers: " + "min: 1 max: 1 ", systemOut().getHistory());

}

@Test

public void testCase8() {

setSystemIn("1", "1", "2");

Q1.main(null);

assertEquals("Please enter 3 integers: " + "min: 1 max: 2 ", systemOut().getHistory());

}

@Test

public void testCase9() {

setSystemIn("1", "2", "1");

Q1.main(null);

assertEquals("Please enter 3 integers: " + "min: 1 max: 2 ", systemOut().getHistory());

}

@Test

public void testCase10() {

setSystemIn("2", "1", "1");

Q1.main(null);

assertEquals("Please enter 3 integers: " + "min: 1 max: 2 ", systemOut().getHistory());

}

@Test

public void testCase11() {

setSystemIn("2", "2", "1");

Q1.main(null);

assertEquals("Please enter 3 integers: " + "min: 1 max: 2 ", systemOut().getHistory());

}

@Test

public void testCase12() {

setSystemIn("2", "1", "2");

Q1.main(null);

assertEquals("Please enter 3 integers: " + "min: 1 max: 2 ", systemOut().getHistory());

}

@Test

public void testCase13() {

setSystemIn("1", "2", "2");

Q1.main(null);

assertEquals("Please enter 3 integers: " + "min: 1 max: 2 ", systemOut().getHistory());

}

}

According to that test class follow the steps in the question

Question 1. Write your solution in file Q1.java. Use Q1Test.java to test your solution. Write a Java program which asks the user to enter three integer numbers. The program should print the maximum and minimum of those numbers. Example Please enter 3 integers max 8 min: 2 Please enter 3 integers 0 0 0 max: 0 min: 0

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_2

Step: 3

blur-text-image_3

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

Students also viewed these Databases questions

Question

Appreciate the services that consultants provide

Answered: 1 week ago

Question

Know about the different kinds of consultants

Answered: 1 week ago