u10
This commit is contained in:
parent
1abb1b50ec
commit
c710d9b685
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
|
@ -0,0 +1 @@
|
|||
/bin/
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>u10</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,19 @@
|
|||
package de.hsh.fakturierung;
|
||||
|
||||
import de.hsh.fakturierung.rechnung.Rechnung;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Rechnung r = new Rechnung(123);
|
||||
|
||||
r.addPos(1, 2.34);
|
||||
r.addPos(420, 13.37);
|
||||
r.addPos(42, 3.14);
|
||||
|
||||
System.out.println(r.getPreis(0));
|
||||
System.out.println(r.getArtikelnummer(1));
|
||||
System.out.println(r.getPreis(2));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package de.hsh.fakturierung.rechnung;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Rechnung {
|
||||
private int nummer;
|
||||
private ArrayList<Rechnungsposition> positionen;
|
||||
|
||||
public Rechnung(int nummmer) {
|
||||
this.nummer = nummer;
|
||||
this.positionen = new ArrayList<Rechnungsposition>();
|
||||
}
|
||||
|
||||
public void addPos(int artikelnummer, double preis) {
|
||||
this.positionen.add(new Rechnungsposition(artikelnummer, preis));
|
||||
}
|
||||
|
||||
public int getArtikelnummer(int pos) {
|
||||
return this.positionen.get(pos).getArtikelnummer();
|
||||
}
|
||||
|
||||
public double getPreis(int pos) {
|
||||
return this.positionen.get(pos).getPreis();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package de.hsh.fakturierung.rechnung;
|
||||
|
||||
public class Rechnungsposition {
|
||||
private int artikelnummer;
|
||||
private double preis;
|
||||
Rechnungsposition(int artikelnummer, double preis){
|
||||
this.artikelnummer= artikelnummer;
|
||||
this.preis= preis;
|
||||
}
|
||||
|
||||
double getPreis() {
|
||||
return this.preis;
|
||||
}
|
||||
|
||||
int getArtikelnummer() {
|
||||
return this.artikelnummer;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue