Good Morning!
I'm still learning
Java at University trying to do the exercises the teacher gives us (uncorrected, so feel free to tell me if there is a website where I would be able to practice Java)
I'm still studying collections and I was wondering, following the following, code
how to write an instance c1 of Concret named "compListe" including s1 and an element instance of c1 of Atome of value 14?
Class Composant is abstract and defined the characteristics of a named given composant. It is characterized by a name and realize two interfaces Named and Valuable defined below. Two composants are equals if they have same name and same value.
Class Atome is a composant characterized by a name and a double value. An atome is equal to another atome if they have same value. The name of an atome is not given at creation. it is formed by its parent's name. followed by "_" and its value.
Abstract class Composite is defined by the characteristics of a complex composant having a collection of named elements of type Atome or Coposite. The class composite forbidden dupplicates. It realizes the interface ComposantManagement. Two objects are equals if they have same name and same elements.
Class Concret is a sublass of Composite which forbidden doublon and which is characterized by a number of double type. (by default = 1). Class Concret sort out the elements by their value and by increasing rate. The value of an instance of Concret is the maximal value of its element weighted by by the number of instanciation.
I tried:
Am I right ading such an Atome?
Thanks in advance!