Zum Beispiel AB = "Jahre" und Val = 3, dann sind die Tage 1095 (ungefähr). < /p>
Was was Ich habe es versucht wie unten. Ist es der richtige Ansatz für das obige Problem? Vielen Dank im Voraus. < /P>
Code: Select all
public class conversionofdate {
public static void main(String args[]) {
String ab = "days";
int val = 0, days, month = 0, years = 0;
switch (ab) {
case "days":
days = val;
break;
case "months":
days = val * 30;
break;
case "years":
days = val * 12 * 30;
break;
default:
System.out.println("Incorrect value");
}
}
}