Question: Java - Testing letterOperation In this assignment, we are given a file Letter.class with errors in it, but we cannot open or look at the

Java - Testing letterOperation

In this assignment, we are given a file Letter.class with errors in it, but we cannot open or look at the file. We are supposed to make "testers" in LetterTester.java to find these unknown errors. I need help writing some more testers. There is no required amount.

Java - Testing letterOperation In this assignment, we are given a file

The function letterOperation takes a char and rotates it by some int amount. We only rotate uppercase and lowercase letters, while leaving any other symbol unchanged. When we move the letters past the alphabet, the letter rotation wraps around to the other end of the alphabet. This is clear with a few examples:

a + 1 ? b 
d - 3 ? a
a - 1 ? z 
A - 1 ? Z
A - 27 ? Z
! + 999 -> !

Rotating the char a positively by int 1 will give you the char b. To represent letters in computers, UNIX uses numbers. For example, a is really the integer value 97. Thats why we can do arithmetic with chars. This might still be confusing -- you may want to look ahead at the Caesar Cipher section to see how letterOperation works in the larger context.

Stop and take a look at this table: https://www.asciitable.com/

This is the basic ASCII encoding. Other languages than English use different encodings between characters and numbers.

While there is a magnitude of testing software and paradigms in software engineering, we are not formally teaching those. Instead, the objective of this section is to write a thorough tester in preparation for the programming task.

Your Task

We provide four implementations of letterOperation called op1, op2, op3, and op4 within Letter.class. Each op function implements letterOperation in a faulty way. Below are their method signatures.

public static char op1(char a, int rotation);
public static char op2(char a, int rotation);
public static char op3(char a, int rotation);
public static char op4(char a, int rotation);

You will test each method with a tester program written in a new class called LetterTester.java.

Given the four similar methods, write a series of method calls to each of those methods. Notice the behavior of each method. One thing that works correctly for one test may not work correctly for the next test, be careful.

Continue to write method calls to each op functions, and seeing what you get in return. Check the return value. As you work on these cases, think about what are some inputs that can cause the program to behave wrong due to an incorrect implementation.

Think about your argument types. What is the range of values that those types can be?

Applications Places Terminal [cs8bs] cs8bsjw@its-cseb230-11.ucsd.edu:/home/linux/ieng6/cs8bs/cs8bsjw/psal -X File Edit View Search Terminal Help 1 public class LetterTester public static void main (String[] args) System.out.println ("This is the LetterTester."); 4 (Letter.opl('a', 1)-b) System.out.println("[op1] FAILED. a1 should be b."); System . out.println ("???1] SUCCEEDED."); 10 12 13 14 ? 14,2 All

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!