Add 1 4
This commit is contained in:
parent
8e2db55800
commit
910080f315
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
6
README.md
Normal file
6
README.md
Normal file
@ -0,0 +1,6 @@
|
||||
# 💨Großartiges💨Repository💨
|
||||
|
||||
## Algorythmen und Datenstruktuen
|
||||
|
||||
## Vorhandene Aufgaben:
|
||||
- Vorlesung 1 Aufgabe 4 (ADT zum Verwalten von Produkten)
|
14
src/part1/aufg4/Anwendung.java
Normal file
14
src/part1/aufg4/Anwendung.java
Normal file
@ -0,0 +1,14 @@
|
||||
package part1.aufg4;
|
||||
|
||||
public class Anwendung {
|
||||
public static void main(String[] args){
|
||||
Product apple = new Product("#0127","yellow Apple", 0.54,2);
|
||||
|
||||
apple.print();
|
||||
|
||||
apple.setPrice(0.69);
|
||||
apple.setShelf_nr(1);
|
||||
|
||||
apple.print();
|
||||
}
|
||||
}
|
61
src/part1/aufg4/Product.java
Normal file
61
src/part1/aufg4/Product.java
Normal file
@ -0,0 +1,61 @@
|
||||
package part1.aufg4;
|
||||
|
||||
/**
|
||||
* Überlegen Sie sich eine Datenstruktur zur Verwaltung von Produkten.
|
||||
* Ein Produkt soll dabei eine eindeutige Kennung haben, einen Namen
|
||||
* und einen Nettopreis. Weiterhin soll jedem Produkt eine Regalnummer
|
||||
* zugeordnet werden, wobei hierfür eine Liste fester Werte bekannt ist.
|
||||
*/
|
||||
|
||||
public class Product {
|
||||
private String product_ID;
|
||||
private String name;
|
||||
private double price;
|
||||
private int shelf_nr;
|
||||
|
||||
public Product(String product_ID, String name, double price, int shelf_nr){
|
||||
setProduct_ID(product_ID);
|
||||
setName(name);
|
||||
setPrice(price);
|
||||
setShelf_nr(shelf_nr);
|
||||
}
|
||||
|
||||
public String getProduct_ID() {
|
||||
return product_ID;
|
||||
}
|
||||
|
||||
public void setProduct_ID(String product_ID) {
|
||||
this.product_ID = product_ID;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public double getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(double price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public int getShelf_nr() {
|
||||
return shelf_nr;
|
||||
}
|
||||
|
||||
public void setShelf_nr(int shelf_nr) {
|
||||
this.shelf_nr = shelf_nr;
|
||||
}
|
||||
|
||||
public void print(){
|
||||
System.out.println("ID: " + getProduct_ID());
|
||||
System.out.println("Name: " + getName());
|
||||
System.out.println("Price: " + getPrice());
|
||||
System.out.println("Shelf Nr. : " + getShelf_nr());
|
||||
}
|
||||
}
|
1
src/part1/placeholder
Normal file
1
src/part1/placeholder
Normal file
@ -0,0 +1 @@
|
||||
I am holding place
|
Loading…
Reference in New Issue
Block a user