hallo bin neu hier und noch etwas unbeholfen mit java.
folgender code sollte eigentlich einen Wochentag ausgeben, der Compiler gibt mir aber für 2 Methoden die Meldung:
The method calcDays(int, int, int) in the type wochentagberechnung is not applicable for the arguments ()
The method calcWeekDay(int) in the type wochentagberechnung is not applicable for the arguments ()
mein code:
bin für jede anregung und idee dankbar
peace
folgender code sollte eigentlich einen Wochentag ausgeben, der Compiler gibt mir aber für 2 Methoden die Meldung:
The method calcDays(int, int, int) in the type wochentagberechnung is not applicable for the arguments ()
The method calcWeekDay(int) in the type wochentagberechnung is not applicable for the arguments ()
mein code:
Java:
currentPost.edit();
import java.util.*;
import java.io.*;
public class wochentagberechnung {
public static void gui(){
System.out.println("________________________________________________");
System.out.println("| |");
System.out.println("| Wochentagsberechnung |");
System.out.println("| Sprechen Sie Java, S. 53 |");
System.out.println("|_______________________________________________|");
System.out.println();
System.out.println(" Bitte geben Sie ein Datum ein: (JJJJ M D");
}
public static void readDate(){
int a=0;
int b=0;
int c=0;
BufferedReader in = new BufferedReader (
new InputStreamReader (System.in));
try{
String input =in.readLine();
StringTokenizer tokens = new StringTokenizer (input);
c = Integer.parseInt(tokens.nextToken());
b = Integer.parseInt(tokens.nextToken());
a = Integer.parseInt(tokens.nextToken());}
catch (Exception e){System.out.println ("e");}
plausibilitätsprüfungS53.dateOutput(a,b,c);
}
public static void calcDays(int a,int b,int c){
GregorianCalendar today = new GregorianCalendar(2009, 6, 21);
GregorianCalendar past = new GregorianCalendar(c, b, a);
long difference = today.getTimeInMillis() - past.getTimeInMillis();
int days = (int)(difference / (1000 * 60 * 60 * 24));
}
public static void calcWeekDay(int days){
float weekDay = days%7;
if(weekDay == 0.142){ System.out.println("Montag");}
if(weekDay == 0.285){ System.out.println("Dienstag");}
if(weekDay == 0.428){ System.out.println("Mitwoch");}
if(weekDay == 0.571) {System.out.println("Donnerstag");}
if(weekDay ==0.714) {System.out.println("Freitag");}
if (weekDay == 0.857){ System.out.println("Samstag");}
if(weekDay == 0){System.out.println("Sonntag");}
}
public static void main(String[] args) {
gui();
readDate();
calcDays( );
calcWeekDay();
bin für jede anregung und idee dankbar
peace