Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have a question about Batch testing in java coding I got a stuck from here import java.util.Scanner; import java.io.File; import java.io.IOException; public class BatchTesting

I have a question about Batch testing in java coding

I got a stuck from here

import java.util.Scanner;import java.io.File;import java.io.IOException;public class BatchTesting{ public static void main(String[] args) throws IOException{  File file = new file("random.txt");  Scanner scan = new Scanner(file);  String rle = scan.nextLine();  System.out.println(rle);  char delimiter = scan.next().charAt(0);  decodeRLE(file);  close.file(); } private static String decodeRLE(String rle, char delimiter){  StringBuilder decodedRLECode = new StringBuilder();  // read through the RLE string  for (int i = 0; i 1; i++) {    // search for delimiter in the rle string    if (rle.charAt(i) != delimiter) {      // if the rle string is a digit      if (rle.charAt(i) >= '0' && rle.charAt(i) '9') {        int counter = rle.charAt(i) - '0'; // get the counter        char pattern = rle.charAt(i + 1); // get the pattern to print        for (int j = 0; j // decode the pattern and append to output        }        i = i + 1; // increment counter      } else {        decodedRLECode.append(rle.charAt(i)); // if delimiter is not given, print the decoded rle      }    }  }  return decodedRLECode.toString(); // return the decodedRLE }}

image text in transcribedimage text in transcribedimage text in transcribed
What to Do? 1) Use your test plan from the RLE encoding lab to create a collection of data files to use with your driver program. The data file will contain several input values along with the expected output values. Make sure these data files will thoroughly test the decodeRLE() method as well as the driver method. a) Likely you'll want to put each input value on its own line. 2) Write a program that will act as a driver program to batch test the decodeRLE() method. Make your driver program interactively ask for the data's filename, read one at a time all the values from the data file, output the results on the screen and keep asking for a filename until the user chooses to stop. 3) You must use my decodeRLE() method, not your own. You can call it by simply saying RLE.decodeRLE() with the correct set of parameters. (It's just like when we call any Mathmethod.) The compiled byte code is provided for you; no, I will not provide the java source le to you. Just put the .class le into the same folder as your driver program and just use my method! Hints and guidelines: Remember that every program needs instructions. Add the Instructions method in the same way as you have in the past. Remember that this method really needs to have instructions in it! That is, a description of what this program does, how to enter values, etc. Remember to validate all input to make sure the values are acceptable. Write an interactive program. That is, give prompts, accept input, verify values, give error messages where necessary, and allow for corrections. If you want to compare a string entered against the literal \"Stop" then simply test it using the equality method, e.g., command.equals(\"$top\"}. Make good use of control abstraction. Be more concerned with what you want to do, than how to do it. It breaks the problem down into smaller pieces. each of which are easier to solve. Make good use of methods. Do not be afraid to use many methods. Boolean value returning methods are very useful in this and all programs. Remember: Each method does one simple task only. Use constants where you can. Remember to write method header comments with each of your methods. Make sure you fully test each of your methods at each step. public static String dooodomtStrinq rle, char delimiter) Decodes any string encoded using RLE encoding. Characters that have not been encoded in the rst place need no decoding and are simply transferred to the output string. However, once a delimiter is discovered in the rle string {this part was encoded from the original}, the next thing that follows should be a number and the character after that will be the character that is used in the expansion. For example, if the rle string is "b'83b" and the delimiter is \""' then there will be 8 3's in the expansion, thus, "baaaaaaaab". We will assume that the encoded portion of an RLE string is well formed. That is. when a delimiter is found, the immediate next characters will be one or more digits followed by any non-digit character. which will he used in the expansion. Parameters: rle - a string that contains an RLE encoding delimiter - the character that signals the next series of characters need to be decoded Returns: the decoded string

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions