Question: Using Eclipse and Java, write a class that is named with your full name in camel case (e.g., public class JohnBobby {}), containing the following
Using Eclipse and Java, write a class that is named with your full name in camel case (e.g.,
public class JohnBobby {}), 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 getID()
. This method returns your ID as a string.(first name)
5.int getStudentNumber()
. This method returns your ID student number.(assume 7 digits)
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 John Bob, if I executed:
For example, for my name John Bobby, the following client code would behave as
such:
JohnBobby j = new JohnBobby();
System.out.println(j.getFullName());
System.out.println(j.getFirstName());
System.out.println(j.getLastName());
System.out.println(j.getID());
System.out.println(j.getRotatedFullName(2));
System.out.println(j.getRotatedFullName(-5));
I would expect to get the output:
John Bobby
John
Bobby
John
ohn BobbyJo
BobbyJohn
Then, create a JUnit test class called Test... followed by your name (e.g., public class Test
JohnBobby {}), 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.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
