Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

open X 1 2 6 9 : Write JUnit test case for accessor method - 2 2 5 % Use this partial definition of a

open X1269: Write JUnit test case for accessor method-2
25% Use this partial definition of a Student class to solve this exercise.
public class Student
i
// create a new student with name and birth year
public Student (String name, int birthYear)
// returns the name of the student
String getwame()
I/ stores the name of the student
void setName(String name)
// sets the birth year of the student
boolean setBirthYear(int year)
I/ returns the birth year of the student
int getBirthYear()
// returns the student's age by subtracting today
// age from the birth year
}
int getAge()
And consider these lines of code that create three instances of Student objects.
1 Student futureCEO = new Student(BGates,1955);
2 Student firstCoder = new Student(ALovelace,1815);
3 Student hiddenEngineer = new Student(KJohnson,1918);
Write a JUnit test case that checks that the first coder was born earlier than the hidden engineer (i.e., the birth year for "A Lovelace " is less thar year for "K Johnson").
Your Answer:
Feedback
void testiwo()
i
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions