Question: This is the test class; 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 Q3Test extends

 This is the test class; import java.io.IOException; import java.io.PrintWriter; import org.junit.Rule;

This is the test class;

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 Q3Test extends student.TestCase {

static JUnitCore junitCore;

static Class> testClasses;

@Test

public void testCase1() {

setSystemIn("merhaba");

Q3.main(null);

assertEquals("Please enter a word: The resulting word is MerXabA ",

systemOut().getHistory());

}

@Test

public void testCase2() {

setSystemIn("istanbul");

Q3.main(null);

assertEquals("Please enter a word: The resulting word is IstaXbuL ",

systemOut().getHistory());

}

}

Question 3. Write your solution in file Q3.java. Use Q3Test.java to test your solution. Write a Java program which asks the user to enter a String. The program changes the middle character of the word into X character and turns the first and last characters of the word into uppercase letters P.S. You need to use charAt method of String Example Please enter a word: merhaba The resulting word is MerXabA Please enter a word: istanbul The resulting word is IstaXbuL

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!