Skip to content

Commit

Permalink
New exam exercises (#82)
Browse files Browse the repository at this point in the history
* new exam exercises tank and team

* update java stream api exercises

* add final-property, delete private-visibilities for records

* add final-property

* update sample exams (#81)
  • Loading branch information
appenmaier authored Nov 10, 2023
1 parent 6b003b8 commit d212d9d
Show file tree
Hide file tree
Showing 27 changed files with 373 additions and 218 deletions.
52 changes: 26 additions & 26 deletions docs/additional-material/daniel-java1/sample-exam.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ classDiagram
Class o-- CourseOfStudies
class Class {
-description: String
-courseOfStudies: CourseOfStudies
-lectures: List~Lecture~
-students: List~Student~
-description: String &#123final&#125
-courseOfStudies: CourseOfStudies &#123final&#125
-lectures: List~Lecture~ &#123final&#125
-students: List~Student~ &#123final&#125
+Class(description: String, courseOfStudies: CourseOfStudies)
+description() String
+courseOfStudies() CourseOfStudies
Expand All @@ -136,17 +136,17 @@ classDiagram
}
class Student {
-matriculationNumber: String
-name: String
-matriculationNumber: String &#123final&#125
-name: String &#123final&#125
+Student(matriculationNumber: String, name: String)
+matriculationNumber() String
+name() String
+toString() String
}
class Lecture {
-description: String
-creditPoints: int
-description: String &#123final&#125
-creditPoints: int &#123final&#125
+Lecture(description: String, creditPoints: int)
+description() String
+creditPoints() int
Expand All @@ -158,7 +158,7 @@ classDiagram
WI = Wirtschaftsinformatik
INF = Informatik
BWL = Betriebswirtschaftslehre
-description: String
-description: String &#123final&#125
}
class ExamTask02 {
Expand All @@ -185,10 +185,10 @@ classDiagram
```java title="Class.java" showLineNumbers
public class Class { // 0,5

private String description; // 0,25
private CourseOfStudies courseOfStudies; // 0,25
private List<Lecture> lectures; // 0,25
private List<Student> students; // 0,25
private final String description; // 0,25
private final CourseOfStudies courseOfStudies; // 0,25
private final List<Lecture> lectures; // 0,25
private final List<Student> students; // 0,25

public Class(String description, CourseOfStudies courseOfStudies) { // 0,5
this.description = description; // 0,25
Expand Down Expand Up @@ -381,9 +381,9 @@ classDiagram
}
class Player {
-name: String
-name: String &#123final&#125
-healthPoints: int
-dice: Dice
-dice: Dice &#123final&#125
+Player(name: String)
+name() String
+getHealthPoints() int
Expand Down Expand Up @@ -433,9 +433,9 @@ Hans gewinnt
```java title="Player.java" showLineNumbers
public class Player { // 0,5

private String name; // 0,25
private final String name; // 0,25
private int healthPoints; // 0,25
private Dice dice; // 0,25
private final Dice dice; // 0,25

public Player(String name) { // 0,5
this.name = name; // 0,25
Expand Down Expand Up @@ -528,34 +528,34 @@ classDiagram
Recipe o-- Ingredient
class CookieJar {
-cookies: List~Cookie~
-cookies: List~Cookie~ &#123final&#125
+CookieJar()
+addCookie(cookie: Cookie) void
+getStuffedCookie() StuffedCookie
}
class Cookie {
-name: String
-dough: Recipe
-name: String &#123final&#125
-dough: Recipe &#123final&#125
+Cookie(name: String, dough: Recipe)
+getIngredients() List~Ingredient~
}
class StuffedCookie {
-jam: Recipe
-jam: Recipe &#123final&#125
+StuffedCookie(name: String, dough: Recipe, jam: Recipe)
+getIngredients() List~Ingredient~
}
class Recipe {
-name: String
-ingredients: List~Ingredient~
-name: String &#123final&#125
-ingredients: List~Ingredient~ &#123final&#125
+Recipe(name: String)
+addIngredient(ingredient: Ingredient) void
}
class Ingredient {
-name: String
-name: String &#123final&#125
+Ingredient(name: String)
}
Expand Down Expand Up @@ -597,7 +597,7 @@ Zucker
```java title="StuffedCookie.java" showLineNumbers
public class StuffedCookie extends Cookie { // 1

private Recipe jam; // 0,25
private final Recipe jam; // 0,25

public StuffedCookie(String name, Recipe dough, Recipe jam) { // 0,5
super(name, dough); // 1
Expand All @@ -622,7 +622,7 @@ public class StuffedCookie extends Cookie { // 1
```java title="CookieJar.java" showLineNumbers
public class CookieJar { // 0,5

private List<Cookie> cookies; // 0,25
private final List<Cookie> cookies; // 0,25

public CookieJar() { // 0,5
cookies = new ArrayList<>(); // 0,25
Expand Down
42 changes: 21 additions & 21 deletions docs/additional-material/daniel-java2/sample-exam.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ classDiagram
class SuperHuman {
<<abstract>>
-name: String
-universe: Universe
-power: int
-name: String &#123final&#125
-universe: Universe &#123final&#125
-power: int &#123final&#125
+SuperHuman(name: String, universe: Universe, power: int)
+name() String
+universe() Universe
Expand All @@ -65,9 +65,9 @@ classDiagram
class SuperLeague~T extends SuperHuman~ {
<<record>>
-name: String
-universe: Universe
-members: Map~T, Boolean~
name: String
universe: Universe
members: Map~T, Boolean~
+addSuperHuman(t: T) void
+getMostPowerfulSuperHuman() Optional~T~
+getAllAvailableSuperHumans() List~T~
Expand Down Expand Up @@ -169,9 +169,9 @@ classDiagram
class SuperHuman {
<<abstract>>
-name: String
-universe: Universe
-power: int
-name: String &#123final&#125
-universe: Universe &#123final&#125
-power: int &#123final&#125
+SuperHuman(name: String, universe: Universe, power: int)
+name() String
+universe() Universe
Expand All @@ -194,9 +194,9 @@ classDiagram
class SuperLeague~T extends SuperHuman~ {
<<record>>
-name: String
-universe: Universe
-members: Map~T, Boolean~
name: String
universe: Universe
members: Map~T, Boolean~
+addSuperHuman(t: T) void
+getMostPowerfulSuperHuman() Optional~T~
+getAllAvailableSuperHumans() List~T~
Expand Down Expand Up @@ -277,18 +277,18 @@ classDiagram
class Single {
<<record>>
-name: String
-artist: Artist
-salesInMillions: int
-publishingYear: String
name: String
artist: Artist
salesInMillions: int
publishingYear: String
}
class Artist {
<<record>>
-name: String
-country: Country
-birthdate: LocalDate
-isAlive: boolean
name: String
country: Country
birthdate: LocalDate
isAlive: boolean
}
class Country {
Expand All @@ -304,7 +304,7 @@ classDiagram
class SingleQueries {
<<record>>
-singles: List~Single~
singles: List~Single~
+printAllSinglesWithMoreThan25MillionSalesPerCountry() void
+printAverageBirthYearOfAllDeceasedArtists() void
+isAnySingleFromChinaWithMoreThan10MillionSales() boolean
Expand Down
12 changes: 6 additions & 6 deletions docs/exam-exercises/exam-exercises-java1/cards-dealer.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@ classDiagram
Player o-- Card
class Player {
-cards: List~Card~
-cards: List~Card~ &#123final&#125
+Player(cards: List~Card~)
+addCard(card: Card) void
+getCardWithHighestValue() Card
+getCardsByColour(colour: String) List~Card~
}
class CardDealer {
-deck: List~Card~
-player1: Player
-player2: Player
-deck: List~Card~ &#123final&#125
-player1: Player &#123final&#125
-player2: Player &#123final&#125
+CardsDealer(deck: List~Card~, player1: Player, player2: Player )
+dealCards(amount: int) void
}
class Card {
-colour: String
-value: int
-colour: String &#123final&#125
-value: int &#123final&#125
+Card(colour: String, value: int)
}
Expand Down
22 changes: 11 additions & 11 deletions docs/exam-exercises/exam-exercises-java1/cashier-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,29 @@ classDiagram
CashierSystem o-- ShoppingCart
class Product {
-id: int
-description: String
-id: int &#123final&#125
-description: String &#123final&#125
-unit: String
-priceInEuro: double
+Product(id: int, description: String, unit: String, priceInEuro: double)
+setPriceInEuro(priceInEuro: double) void
}
class Goods {
-classOfGoods: ClassOfGoods
-classOfGoods: ClassOfGoods &#123final&#125
+Goods(id: int, description: String, unit: String, priceInEuro: double, classOfGoods: ClassOfGoods)
}
class Item {
-goods: Goods
-goods: Goods &#123final&#125
-amount: int
+Item(goods: Goods, amount: int)
+setAmount(amount: int) void
+getSubTotalInEuro() double
}
class ShoppingCart {
-items: List~Item~
-items: List~Item~ &#123final&#125
+ShoppingCart()
+createItem(goods: Goods, amount: int) void
+getTotalInEuro() double
Expand All @@ -53,13 +53,13 @@ classDiagram
DAIRY_PRODUCTS = Milchprodukte
FRUITS = Obst
VEGETABLES = Gemüse
-description: String
-description: String &#123final&#125
}
class CashierSystem {
-name: String
-goods: List~Goods~
-cashiers: List~Cashier~
-name: String &#123final&#125
-goods: List~Goods~ &#123final&#125
-cashiers: List~Cashier~ &#123final&#125
-shoppingCart: ShoppingCart
-cashier: Cashier
+CashierSystem(name: String)
Expand All @@ -72,8 +72,8 @@ classDiagram
}
class Cashier {
-id: int
-name: String
-id: int &#123final&#125
-name: String &#123final&#125
+Cashier(name: String, id: int)
}
```
Expand Down
8 changes: 4 additions & 4 deletions docs/exam-exercises/exam-exercises-java1/christmas-tree.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ classDiagram
ChristmasTree o-- Candle
class ChristmasTree {
-type: String
-sizeInM: double
-candles: List~Candle~
-type: String &#123final&#125
-sizeInM: double &#123final&#125
-candles: List~Candle~ &#123final&#125
+ChristmasTree(type: String, sizeInM: double)
+addCandle(candle: Candle) void
+lightChristmasTree() void
Expand All @@ -27,7 +27,7 @@ classDiagram
class Candle {
#isBurning: boolean
-colour: String
-colour: String &#123final&#125
+Candle(colour: String)
+lightACandle() void
+turnOffACandle() void
Expand Down
14 changes: 7 additions & 7 deletions docs/exam-exercises/exam-exercises-java1/cookie-jar.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,35 @@ classDiagram
Recipe o-- Ingredient
class CookieJar {
-cookies: List~Cookie~
-cookies: List~Cookie~ &#123final&#125
+CookieJar()
+addCookie(cookie: Cookie) void
+getStuffedCookie() StuffedCookie
+getCookieByName(name: String) Cookie
}
class Cookie {
-name: String
-dough: Recipe
-name: String &#123final&#125
-dough: Recipe &#123final&#125
+Cookie(name: String, dough: Recipe)
+getIngredients() List~Ingredient~
}
class StuffedCookie {
-jam: Recipe
-jam: Recipe &#123final&#125
+StuffedCookie(name: String, dough: Recipe, jam: Recipe)
+getIngredients() List~Ingredient~
}
class Recipe {
-name: String
-ingredients: List~Ingredient~
-name: String &#123final&#125
-ingredients: List~Ingredient~ &#123final&#125
+Recipe(name: String)
+addIngredient(ingredient: Ingredient) void
}
class Ingredient {
-name: String
-name: String &#123final&#125
+Ingredient(name: String)
}
Expand Down
Loading

0 comments on commit d212d9d

Please sign in to comment.