question archive A Student object should validate its own data

A Student object should validate its own data

Subject:Computer SciencePrice:2.89 Bought3

A Student object should validate its own data. The client runs this method, called
validateData(), with a Student object, as follows:
String result = student.validateData();
if (result == null)
else
System.out.println(result);
If the student's data are valid, the method returns the value null; otherwise, the method returns a string representing an error message that describes the error in the data. The client can then examine this result and take the appropriate action.
A student's name is invalid if it is an empty string. A student's test score is invalid if it lies outside the range from 0 to 100. Thus, sample error messages might be
"SORRY: name required" and
"SORRY: must have 0 <= test score <= 100".
Implement and test this method.

Option 1

Low Cost Option
Download this past answer in few clicks

2.89 USD

PURCHASE SOLUTION

Option 2

Custom new solution created by our subject matter experts

GET A QUOTE

rated 5 stars

Purchased 3 times

Completion Status 100%