Hallo Leute!
Das Programm muss bißchen geändert werden, aber ich komm nicht weiter. Kann mir jemand helfen bitte? Und die Zeile 57 bis 60 müssen irgendwie in die Ausgabe geschrieben werden.
[JAVA=42]import javax.swing.JOptionPane;
class Versuch7{
public static int _stunde, _minute;
public static double _temp;
public static boolean _ampm;
public static void main(String[] args) {
int eingabe = JOptionPane.showInputDialog("Bitte geben sie eine Uhrzeit ein (hh");
stunde = toUsTime(Integer.parseInt(eingabe));
minute = Integer.parseInt(eingabe);
eingabe = JOptionPane.showInputDialog("Geben sie Bitte einen beliebigen temperatur-Wert ein!");
temp = toUsTemp(Double.parseDouble(eingabe);
amp = !(stunde > 12 && stunde <=24);
_stunde = toUStime(Integer.parseInt(time));
_minute = Integer.parseInt(time);
_ampm = ampm(Integer.parseInt(time));
_temp = toUStemp(Double.parseDouble(temp));
ausgabe();
}
public static int toUStime(int stunde){
if(stunde==12){
return stunde;
}
else{
return stunde%12;
}
}
public static double toUStemp(double celcius) {
return celcius * 9 / 5 + 32;
}
public static boolean ampm(int stunde){
if(stunde>12&&stunde<24){
return false;
}
else{
return true;
}
}
public static void ausgabe(){
System.out.print("Zeit: "+_stunde+" : "+_minute);
if(_ampm==true){
System.out.println(" am");
}
else{
System.out.println(" pm");
}
System.out.println("Temperatur: "+_temp);
}
}
[/code]
Das Programm muss bißchen geändert werden, aber ich komm nicht weiter. Kann mir jemand helfen bitte? Und die Zeile 57 bis 60 müssen irgendwie in die Ausgabe geschrieben werden.
[JAVA=42]import javax.swing.JOptionPane;
class Versuch7{
public static int _stunde, _minute;
public static double _temp;
public static boolean _ampm;
public static void main(String[] args) {
int eingabe = JOptionPane.showInputDialog("Bitte geben sie eine Uhrzeit ein (hh");
stunde = toUsTime(Integer.parseInt(eingabe));
minute = Integer.parseInt(eingabe);
eingabe = JOptionPane.showInputDialog("Geben sie Bitte einen beliebigen temperatur-Wert ein!");
temp = toUsTemp(Double.parseDouble(eingabe);
amp = !(stunde > 12 && stunde <=24);
_stunde = toUStime(Integer.parseInt(time));
_minute = Integer.parseInt(time);
_ampm = ampm(Integer.parseInt(time));
_temp = toUStemp(Double.parseDouble(temp));
ausgabe();
}
public static int toUStime(int stunde){
if(stunde==12){
return stunde;
}
else{
return stunde%12;
}
}
public static double toUStemp(double celcius) {
return celcius * 9 / 5 + 32;
}
public static boolean ampm(int stunde){
if(stunde>12&&stunde<24){
return false;
}
else{
return true;
}
}
public static void ausgabe(){
System.out.print("Zeit: "+_stunde+" : "+_minute);
if(_ampm==true){
System.out.println(" am");
}
else{
System.out.println(" pm");
}
System.out.println("Temperatur: "+_temp);
}
}
[/code]