Aufgabe6 added

This commit is contained in:
i23024 2023-12-14 20:22:09 +01:00
parent f39ccbd230
commit 4816f2a8d2
3 changed files with 64 additions and 9 deletions

View File

@ -1,7 +1,6 @@
package Uebungsaufgaben;
public class Aufgabe4 {
//hgsaizf
public static void main(String[] args) {
System.out.println("\n\n Script Teil 4: ");
//Aufgabe1

View File

@ -10,26 +10,28 @@ public class Aufgabe5 {
recursiv(6, 1, 0);
//Aufgabe2
int[][] felder = new int [8] [8];
int n = 8;
int[][] felder = new int [n] [n];
for (int[] ints : felder) {
Arrays.fill(ints, -1);
}
int damencounter = 0;
while (damencounter == 8) {
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
while (damencounter == n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
placeDame(felder, damencounter, n);
}
}
}
}
static int[] placeDame(int[][] felder, int damencounter) {
static int[] placeDame(int[][] felder, int damencounter, int n) {
int[] rueckgabe = {0, 0, 0};
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (felder[i][j] < 0) {
rueckgabe[0] = i;
rueckgabe[1] = j;
damencounter++;
rueckgabe[2] = damencounter;
return rueckgabe;
}

View File

@ -5,3 +5,57 @@ public class Aufgabe6 {
System.out.println("HAllo Welt");
}
}
abstract class Mitarbeiter{
int personalNummer;
String name;
String vorname;
abstract void print();
void setPersonalNummer(int i){personalNummer=i;}
void setName(String s){name=s;}
void setVorname(String s){vorname=s;}
int getPersonalNummer(){return personalNummer;}
String getName(){return name;}
String getVorname(){return vorname;}
}
class Angestellter extends Mitarbeiter{
double monatsGehalt;
void print(){
System.out.println(getPersonalNummer());
System.out.println(getName());
System.out.println(getVorname());
System.out.println(monatsGehalt);
}
}
class Arbeiter extends Mitarbeiter{
double stundenSatz;
void print(){
System.out.println(getPersonalNummer());
System.out.println(getName());
System.out.println(getVorname());
System.out.println(stundenSatz);
}
}
final class Facharbeiter extends Arbeiter{
String fachRichtung;
void print(){
System.out.println(getPersonalNummer());
System.out.println(getName());
System.out.println(getVorname());
System.out.println(stundenSatz);
System.out.println(fachRichtung);
}
}