Informatics 115, Fall 2022
Due: Thursday night by 11:59 PM, October 13, 2022 Professor Iftekhar Ahmed
Reading/tutorial: http://www.vogella.com/tutorials/JUnit/article.html
Using Eclipse and Java, write a class that is named with your full name in camel case (e.g., “public class IftekharAhmed {}”), containing the following methods:
1. String getFullName(). This method returns your full name, with spacing, as a string.
2. String getFirstName(). This method returns your first name as a string.
3. String getLastName(). This method returns your last name as a string.
4. String getUCInetID(). This method returns your UCInetID as a string.
5. int getStudentNumber(). This method returns your UCI student number.
6. String getRotatedFullName(int shift). This method returns your name, rotated
(with wrap-around), by ’shift’ characters. Positive numbers rotate to the left, and negative numbers rotate to the right. For example, for my name “Iftekhar Ahmed”, if I executed:
For example, for my name “Iftekhar Ahmed”, the following client code would behave as such:
IftekharAhmed j = new IftekharAhmed();
System.out.println(j.getFullName());
System.out.println(j.getFirstName());
System.out.println(j.getLastName());
System.out.println(j.getUCInetID());
System.out.println(j.getRotatedFullName(2));
System.out.println(j.getRotatedFullName(-5));
I would expect to get the output:
Iftekhar Ahmed
tekhar AhmedIf
AhmedIftekhar
Then, create a JUnit test class called “Test…” followed by your name (e.g., “public class Test IftekharAhmed {}”), containing methods to test each of the above methods. For each of the above methods 1 – 5, write one test-case method that contains one execution of the tested method and checks its expected value. For method 6, provide two separate test case methods: one with a positive shift invocation of the method, and one with a negative shift invocation of the method.
To turn in, create one .zip file that contains only these two .java files. Upload this .zip file to the CANVAS by due date.
CS Help, Email: tutorcs@163.com