Java Eclipse Hilfe beim Programmieren

Guten Tag, ich bin noch Anfänger im programmieren mit Java Eclipse und hoffe ihr könnt mir helfen. Ich will ein Java Eclipse -Programm zur Übung entwickeln , das zu folgendem Bild passt, also für die gleichen Eingaben die gleiche Ausgabe erzeugen. Bei meinem Code tritt eine Fehlermeldung auf, diese habe ich im code //kommentiert. Ich weiß nicht, wie ich weiter machen muss und wäre dankbar für jeden Tipp und jede Hilfe.

Mein Code den ich zusammen bekommen hab :

Java:
public class Programmlaufbeispiel{
    public static void main (String[] args)  {
   
       
                System.out.println("Auswahl:");
                 System.out.println("    1:1x1");
                 System.out.println("    p:Potenz");
                 System.out.println("    e:Ende");
                 Auswahl(0);

            }
                
                 // Eingabeaufforderung Auswahl
                
                 public static void Auswahl (int i) {
                    double k = IO.readDouble("Auswahl 1, p, e : ");
                        if (k==1);
                         System.out.println("1x1 Tabelle berechnen");
                             einlesen();
                   
                       
                 }

                 public static void einlesen  () {
                int x =  IO.readInt("Startzahl:");
                int y= IO.readInt("Endzahl:");

           while(x<=y) // äußere Schleife
              {
                         y = 10;
                 while(y <= 20) // innere Schleife
                 {
//fehlermeldung warum?
                  System.out.print( "%dx%d = %d%n",  x, y, x*y);
                                    y++;
                  
            
for(int b = IO.readInt("Startzahl:"); b <= IO.readInt("Endzahl:"); b++){
System.out.print(x+"\t");
}
System.out.print("\n");
for(int c = IO.readInt("Endzahl:"); c<= IO.readInt("Startzahl:"); c++){
System.out.println(y+"\t");
}
for(int s = IO.readInt("Startzahl:"); s<= IO.readInt("Endzahl:"); s++){

int z= IO.readInt("Startzahl:")*s;   

System.out.print (z+"\t");
}
}
} }}
 
//fehlermeldung warum?
System.out.print( "%dx%d = %d%n", x, y, x*y);
Glaskugel schon wieder kaputt.. verdammt..

Beim nächsten mal bitte gleich Fehlermeldung mit posten dann gehts schneller 😉

Du bekommst sicherlich sowas: The method print(int) in the type PrintStream is not applicable for the arguments ... .
Die Methode die du suchst heißt System.out.printf(..).
 
Sorry
Java:
System.out.print ("%dx%d = %d%n", x, y, x*y);
                                    y++;

In der Konsole erscheint dann folgendes:
Auswahl:
1:1x1
p😛otenz
e:Ende
Auswahl 1, p, e : 1
1x1 Tabelle berechnen
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, int, int, int)

at Programmlaufbeispiel.einlesen(Programmlaufbeispiel.java:33)
at Programmlaufbeispiel.Auswahl(Programmlaufbeispiel.java:19)
at Programmlaufbeispiel.main(Programmlaufbeispiel.java:9)
 

Neue Themen


Zurück
Oben