Liebe Alle,
hier unsere HÜ. Uns ist in der letzten Einheit wohl nicht alles ganz klar gewesen, daher gibt es einige Fragen.
*** Aufgabe 1a: *** /**/ p1 = .Person~New("Kurt","Ostbahn","45000") p2 = .Person~New("Jazz","Gitti",55000) SAY p1~firstName p1~familyName p1~salary SAY p1~firstName p1~salary p1~~increaseSalary(10000)~salary ::CLASS Person ::METHOD INIT EXPOSE firstName familyName salary USE ARG firstName, familyName, salary ::ATTRIBUTE firstName ::ATTRIBUTE familyName ::ATTRIBUTE salary ::METHOD increaseSalary EXPOSE salary USE ARG increase salary = salary + increase SAY p1~salary
Output: Kurt Ostbahn 45000 18 *-* SAY p1~salary 5 *-* SAY p1~firstName p1~salary p1~~increaseSalary(10000)~salary Error 97 running C:\U line 18: Object method not found. Error 97.1: Object "P1" does not understand message "SALARY".
Process finished with exit code -97 Frage: Warum bekommen wir diese Fehlermeldung?
*** Aufgabe 1b: ***
/**/
p1 = .Person~New("Kurt","Ostbahn","45000")
p2 = .Person~New("Jazz","Gitti",55000)
SAY p1~firstName p1~familyName p1~salary
SAY p1~firstName p1~salary p1~~increaseSalary(10000)~salary
::CLASS Person
::METHOD INIT
EXPOSE firstName familyName salary
USE ARG firstName, familyName, salary
::ATTRIBUTE firstName
::ATTRIBUTE familyName
::ATTRIBUTE salary
::METHOD increaseSalary
EXPOSE salary
USE ARG increase
salary = salary + increase
SAY "Hallihallo"
Output: Kurt Ostbahn 45000 Hallihallo Kurt 45000 55000 Frage: Warum ist es mit „Hallihallo“ möglich (vgl. zu Aufgabe 1a) ? Wieso ist „Hallihallo“ in der zweiten Ausgabezeile?
*** Aufgabe 2: ***
tmpColl = .stream ~new("meininput.txt")~~open
SAY "a" tmpColl~class~id":"
DO i OVER tmpColl
SAY "["i"]"
END
tmpColl~close
Output: a Stream:
Process finished with exit code 0 Frage: Wo soll mein input.txt gespeichert sein (Pfad), damit es im Output wiedergegeben wird?
*** Aufgabe 3: ***
shoppinglist = .list~of("orange", "banana", "apple", "almonds", "kiwi")
shoppinglistArray = shoppinglist~makeArray-- make array
say "This is my shopping list:"
say shoppinglistArray
shoppinglistArray = shoppinglist~makeArray~sort-- make & sort array
say "This is my shopping list nicely ordered:" shoppinglistArray
shoppinglistStream = .Stream~new("myoutput.txt")~~open("replace")
shoppinglistStream~ArrayOut(shoppinglistArray)
shoppinglistStream~close
Output: This is my shopping list: orange banana apple almonds kiwi This is my shopping list nicely ordered: almonds apple banana kiwi orange
Process finished with exit code 0
Frage: wo soll das myoutput.txt dann zu finden sein (Pfad)?
Danke schon mal für eure Ideen und Lösungen 😊 Liebe Grüße und ein schönes Wochenende wünschen Jana & Birgit
Birgit Hietel Studienrecht study regulations
WU Wirtschaftsuniversität Wien Vienna University of Economics and Business Gebäude LC, Ebene +2 Welthandelsplatz 1, 1020 Wien, Austria
Tel: +43-1-313 36-5836 E-Mail: birgit.hietel@wu.ac.atmailto:birgit.hietel@wu.ac.at www.wu.ac.athttp://www.wu.ac.at/