• Post Reply Bookmark Topic Watch Topic
  • New Topic

Instantiate question  RSS feed

 
Pierre Gadar
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 2 class, one class Person with attributes(name, age) and a class main, i have to instantiate:
"Instantiate  age ∈  [0,100] " i don't know what it means, can you look at my code and tells if i did ok or not?
Thanks.



 
Les Morgan
Rancher
Posts: 779
19
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It has been a while since I've seen notation like that, but I take it as age is an element of the interval from 0 to 100.
 
Piet Souris
Master Rancher
Posts: 2044
75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Correct, and since [...] denotes a closed interval (a "segment") it means that both endpoints are included as well.

But that also probably means that in the Personne constructor, there must be a check to see if the value of age is indeed within that segment.
 
Campbell Ritchie
Marshal
Posts: 56545
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pierre Gadar wrote:. . . age ∈  [0,100] . . .
The notation varies from place to place, and that would mean something different here in UK. I am sure PS is correct, however. The ∈ symbol means “is an element of...” and the right operand is a way of constructing a set.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!