## Ex 07, short questions

Moderatoren: pmueller, SE - Design and Construction

Ben Kohr
Windoof-User
Beiträge: 34
Registriert: 14. Apr 2015 17:41

### Ex 07, short questions

Hi,

two short questions:

- May we use case classes for SimpleUniversity and ComplexUniversity? The debug Strings produced by the administration tool are more understandable if we do so.
- The method declaration in Student should be "matriculationNumber", right? I declared it that way now.

Best,
Ben

pmueller
Moderator
Beiträge: 87
Registriert: 25. Jan 2018 11:14

### Re: Ex 07, short questions

Hi,
Ben Kohr hat geschrieben:
16. Jun 2018 14:44
- The method declaration in Student should be "matriculationNumber", right? I declared it that way now.
Yes.
Ben Kohr hat geschrieben:
16. Jun 2018 14:44
- May we use case classes for SimpleUniversity and ComplexUniversity? The debug Strings produced by the administration tool are more understandable if we do so.
Do you mean the classes themselves or the Types they should contain?

Best,
Patrick

Ben Kohr
Windoof-User
Beiträge: 34
Registriert: 14. Apr 2015 17:41

### Re: Ex 07, short questions

Thanks!

I mean the classes contained in SimpleUniversity and those contained in ComplexUniversity.

Best,
Ben

nknauber
Erstie
Beiträge: 11
Registriert: 25. Apr 2018 16:48

### Re: Ex 07, short questions

I have an additional question regarding this. In the assignment it is stated, that within TSimpleUniversity there should be a trait corresponding to Student with the following methods declared:
sedc_ex_07.PNG (20.67 KiB) 1153 mal betrachtet
Is it on purpose, that there is a second method courses that returns a Sequence typed to an additional class named Courses? If so, how do we know what this additional class "Courses" should look like?

pmueller
Moderator
Beiträge: 87
Registriert: 25. Jan 2018 11:14

### Re: Ex 07, short questions

Hi,

there should only be one method "courses". I have updated the exercise sheet.
Ben Kohr hat geschrieben:
19. Jun 2018 14:59
I mean the classes contained in SimpleUniversity and those contained in ComplexUniversity.
You may use case classes for these.

Best,
Patrick

emod02
Neuling
Beiträge: 9
Registriert: 27. Apr 2018 19:35

### Re: Ex 07, short questions

Another question regarding task 1.2 with the ComplexUniversity Class.
Should the types for Student, CourseOfStudies, Room and Course mix up the methods of both, TComplexUniversity and TSimpleUniversity?

So that this code will be possible?:

Code: Alles auswählen

	val cUni = new ComplexUniversity
val r1 = cUni.Room("Room1", "Building1")
val hurr = r1.building()
val durr = r1.number()


pmueller
Moderator
Beiträge: 87
Registriert: 25. Jan 2018 11:14

### Re: Ex 07, short questions

Hi,
emod02 hat geschrieben:
21. Jun 2018 16:46
Another question regarding task 1.2 with the ComplexUniversity Class.
Should the types for Student, CourseOfStudies, Room and Course mix up the methods of both, TComplexUniversity and TSimpleUniversity?

So that this code will be possible?:

Code: Alles auswählen

	val cUni = new ComplexUniversity
val r1 = cUni.Room("Room1", "Building1")
val hurr = r1.building()
val durr = r1.number()

Yes.

Best,
Patrick

emod02
Neuling
Beiträge: 9
Registriert: 27. Apr 2018 19:35

### Re: Ex 07, short questions

Hi,

Okay. And we should not mix it up in TComplexUniversity, as I understood it rigth?

Then I'm totally lost.

I have no clue, how I should create an instance of the mixed up traits of the super classes TComplexUniversity and TSimpleUniversity in the ComplexUniversity class.
Maybe someone can give me a hint into the right direction?

Greets Dominik

pmueller
Moderator
Beiträge: 87
Registriert: 25. Jan 2018 11:14

### Re: Ex 07, short questions

Hi,

just as a heads up: in this exercise you will most likely produce code that is not accepted by the parses of IDEs(at least IntelliJ), but by the scala compiler.
So maybe you should try compiling your solution with sbt or scalac directly before dismissing it.

Best,
Patrick

topracer
Mausschubser
Beiträge: 53
Registriert: 10. Jan 2014 19:14

### Re: Ex 07, short questions

pmueller hat geschrieben:
22. Jun 2018 09:32
just as a heads up: in this exercise you will most likely produce code that is not accepted by the parses of IDEs(at least IntelliJ), but by the scala compiler.
So maybe you should try compiling your solution with sbt or scalac directly before dismissing it.
Thank you for this hint, I was quite confused that IntelliJ complained about classes inheriting from multiple traits, but it still compiles and works fine!