-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShell.java
More file actions
40 lines (32 loc) · 1.08 KB
/
Shell.java
File metadata and controls
40 lines (32 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Shell.java
// Klasse zur Darstellung einer Schale im Atommodell
public class Shell {
// Eigenschaften der Schale
int n; // Hauptquantenzahl
int maxElectrons; // maximale Elektronenzahl in der Schale
int currentElectrons; // aktuelle Elektronenzahl in der Schale
// Konstruktor zum erzeugen einer Schale mit der Hauptquantenzahl n
public Shell(int n) {
this.n = n; // Hauptquantenzahl
this.maxElectrons = 2 * n * n; // Formel für maximale Elektronenzahl in der Schale
this.currentElectrons = 0; // Anfangs keine Elektronen in der Schale
}
// Methode zum Hinzufügen von Elektronen zur Schale
public void addElectron() {
if (currentElectrons < maxElectrons) {
currentElectrons++;
} else {
System.out.println("Die Schale " + n + " ist bereits voll.");
}
}
// Getter-Methoden
public int getN() {
return n;
}
public int getCurrentElectrons() {
return currentElectrons;
}
public int getMaxElectrons() {
return maxElectrons;
}
}