erste version

main
Kaan Kanat 2022-10-12 16:26:59 +02:00
commit abb3523c93
1 changed files with 43 additions and 0 deletions

43
src/main.java 100644
View File

@ -0,0 +1,43 @@
/* code from 3004570, 3003836 */
package src;
public class main {
public static void main (String[] args) {
System.out.println("Roman Converter");
String number = "MMXVI";
int result=0;
for(int i=0; i<number.length();i=i+1) {
System.out.println("1.Ziffer =" + number.charAt(i));
if (number.charAt(i) == 'M') {
System.out.println("1000");
result = result + 1000;
} else if (number.charAt(i) == 'X') {
System.out.println(10);
result = result + 10;
} else if (number.charAt(i) == 'V') {
System.out.println(5);
result = result + 5;
} else if (number.charAt(i) == 'L') {
System.out.println(50);
result = result + 50;
} else if (number.charAt(i) == 'C') {
System.out.println(100);
result = result + 100;
} else if (number.charAt(i) == 'D') {
System.out.println(500);
result = result + 500;
} else if (number.charAt(i) == 'I') {
System.out.println(1);
result = result + 1;
}
System.out.println("Die Zahl ist"+ result);
}
}
}