Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    cannot find symbol symbol : constructor

    Salve a tutti,
    ho un problema di compilazione.
    La classe Magazzino(contenente il main) al momento di compilare mi dà questo errore:

    >javac Magazzino.java
    Magazzino.java:53: cannot find symbol
    symbol : constructor Etichetta(java.util.Date,int,char[])
    location: class Etichetta
    new Etichetta(data,(int)(Math.random()*100), colore), (double)(Math.random()*100.0));
    ^
    Magazzino.java:60: cannot find symbol
    symbol : constructor Etichetta(java.util.Date,int,char[])
    location: class Etichetta
    new Etichetta(data,(int)(Math.random()*100), colore),(int)(Math.random()*31 + 1));
    ^
    Magazzino.java:67: cannot find symbol
    symbol : constructor Etichetta(java.util.Date,int,char[])
    location: class Etichetta
    new Etichetta(data, (int)(Math.random()*100), colore),
    ^
    3 errors
    >Exit code: 1

    Il codice della classe interessata è questo:
    codice:
    import java.util.Date;
    import java.util.GregorianCalendar;
    
    public class Magazzino
    {
      Object cinghie [];
      Date today;
      char colore[] = new char[5];
      
      public Magazzino()
      {
        cinghie = new Object[33];
        
        Object cinghie[] = Stampa();
        
        for(int i = 0; i < cinghie.length; i ++)
        {
          System.out.println(cinghie[i]);
        }
      }
      
      public Object[] Stampa()
      {
        int temp = 0;
        
        for(int i = 0; i < cinghie.length; i++)
        {
          temp = (int)(Math.random()*4);
          
          Date data = new GregorianCalendar((int)(Math.random()*12 + 1),
          (int)(Math.random()*31 + 1),
          (int)(Math.random()*108 + 1900)).getTime();
          Date today = new Date();
          long diff = today.getTime() - data.getTime();
          long delta = diff /(1000 * 60 * 60 * 24);
          
          for(int j = 0; j < 5; j++)
          {
            colore[j] = (char)(Math.random()*100);
          }
          
          switch(temp)
          {
            case 0:
            {
              cinghie[i] = new Elastiche((int)(Math.random()*100), (double)(Math.random()*100.0));
              break;
            }
            
            case 1:
            {
              cinghie[i] = new Fibra((int)(Math.random()*100), (int)(Math.random()*100),
              new Etichetta(data,(int)(Math.random()*100), colore), (double)(Math.random()*100.0));
              break;
            }
            
            case 2:
            {
              cinghie[i] = new Catene((int)(Math.random()*100),(int)(Math.random()*100), 
              new Etichetta(data,(int)(Math.random()*100), colore),(int)(Math.random()*31 + 1));
              break;
            }
            
            case 3:
            {
              cinghie[i] = new Rinforzate((int)(Math.random()*100), (int)(Math.random()*100),
              new Etichetta(data, (int)(Math.random()*100), colore),
              (double)(Math.random()*100.0), (double)(Math.random()*100.0));
              break;
            }
          }
        }
        return cinghie;
      }
      
      public static void main(String args[])
      {
        Magazzino start = new Magazzino();
      }
    }
    La classe Etichetta è questa:
    codice:
    public class Etichetta
    {
      private Data data;
      private int codice;
      private char colore[];
      private int delta;
      
      public Etichetta(Data data, int codice, char colore[])
      {
        super();
        this.data = data;
        this.codice = codice;
        this.colore = colore;
      }
      
      public Data getData()
      {
        return data;
      }
      
      public int getCodice()
      {
        return codice;
      }
      
      public char [] getColore()
      {
       return colore; 
      }
      
      public int getDelta()
      {
        return delta;
      }
    }

  2. #2
    Nel costruttore di Etichetta dichiari che il primo parametro è di tipo Data e non Date.
    Al mio segnale... scatenate l'inferno!

  3. #3
    Originariamente inviato da R@ve M@ster
    Nel costruttore di Etichetta dichiari che il primo parametro è di tipo Data e non Date.
    Ti ringrazio immensamente della risposta.
    Ho risolto il problema.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.