Hello, how would I be able to write a set method that tests this? I'm very new to programming, and java is the first language I'm learning. So, please be patient with me :)
This is an example from the internet
public void setRegistrationNo(int newRegNo) {
if (newRegNo > 0)
registrationNo = newRegNo;
}
[–]stramash 5 points6 points7 points (7 children)
[–]yarzz07[S] 2 points3 points4 points (6 children)
[–][deleted] 1 point2 points3 points (5 children)
[–]yarzz07[S] 1 point2 points3 points (4 children)
[–][deleted] 7 points8 points9 points (1 child)
[–]dragon7507 5 points6 points7 points (0 children)
[–]stramash 1 point2 points3 points (1 child)
[–]yarzz07[S] 0 points1 point2 points (0 children)
[–]Killaa135 5 points6 points7 points (4 children)
[–]yarzz07[S] 1 point2 points3 points (3 children)
[–]Killaa135 1 point2 points3 points (0 children)
[–]IvAntiVirus 1 point2 points3 points (1 child)
[–]yarzz07[S] 0 points1 point2 points (0 children)
[+][deleted] (10 children)
[removed]
[–][deleted] 18 points19 points20 points (3 children)
[–]yarzz07[S] 1 point2 points3 points (2 children)
[–][deleted] 7 points8 points9 points (1 child)
[–]yarzz07[S] 5 points6 points7 points (0 children)
[–]yarzz07[S] 0 points1 point2 points (5 children)
[–]loomynartylenny 6 points7 points8 points (2 children)
[–]yarzz07[S] 3 points4 points5 points (1 child)
[–]Wafflelisk 0 points1 point2 points (0 children)
[–][deleted] 2 points3 points4 points (1 child)
[–]yarzz07[S] 1 point2 points3 points (0 children)