Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Jul 2006
    Messaggi
    15

    Aiuto risolvere errore complatore nella classe di test: wrong number of type

    Devo implementare con i generics i metodi dell'interfaccia dizionario ordinato con un albero 234, cioè fino ad un massimo di 4 figli. Ma siccome io i generics non le ho mai usate non rieco a far andare la classe di test scritta qui sotto. Devo consegnare tutto oggi via email.
    Non capisco cosa devo mettere. Qualcuno può aiutarmi grazie? Devo far apparire su console il menù, scegliere il metodo da provare e finito deve riapparire il menù.


    codice:
      import java.io.*;
    import java.util.Scanner;
    /**
     * @(#)Tree234Test.java
     *
     * Tree234 application
     *
     * @author Scaggion Elisabetta
     * @version 1.00 2007/3/5
     */
    
    public class Tree234Test1 {
        
        public static void main(String[] args) {
            String value;
            Tree24<Integer,String> theTree = new Tree24<Integer,String>();
            
            Scanner in = new Scanner(System.in);
            System.out.println("Comincia il test:");
            int scelta;
            do{
                menu();
                scelta = in.nextInt();
                lancia(scelta, theTree);
            } while(scelta !=0);
            System.out.println("Arrivederci");
            
            
        }
        
        private static void menu(){
            
            System.out.println(" [0] Uscita");
            System.out.println(" [1] Inserisci un elemento");
            System.out.println(" [2] Elimina un elemento");
            System.out.println(" [3] Trova tutti gli elementi");
            System.out.println(" [4] Trova tutti gli elementi con una certa chiave");
            System.out.println(" [5] Rappresentazione dell'albero");
            System.out.println(" [6] N. elementi");
            System.out.println(" [7] First");
            System.out.println(" [8] Last");
            System.out.println(" [9] Successore");
            System.out.println(" [10] Predecessore");
        }
        
    
        private static void lancia(int s, Tree24<Integer,String> a){
            
            Tree24<Integer,String> theTree = new Tree24<Integer,String>();
            
            Scanner in = new Scanner(System.in);
            Node24<OrderedDictionary> node;
            switch(s) {
            case 1:
                
                System.out.print("Entra value da inserire: ");
                String valu = in.nextLine();
                theTree.insert(valu);
                break;
            case 2:
                
                System.out.println("Elemento?");
                int key = in.nextInt();
                theTree.remove(valu);
                System.out.println("Fatto");
                break;
            case 3:
                System.out.println("Gli Elementi nell'albero");
                theTree.findAll();
                
                break;
                
            case 4:
                System.out.print("Entra value da trovare: ");
                String value = in.nextLine();
                int found = theTree.find(valu);
                if(found != -1)
                    System.out.println("Found "+valu);
                else
                    System.out.println("Could not find "+valu);
                break;
                
                
            case 5: System.out.println("Mostra l'albero" + theTree.print());
            
            break;
            
            case 6:
                System.out.println("Elementi" + a.size());
                break;
            case 7: System.out.println("Mostra " + theTree.first());
            
            break;
            case 8: System.out.println("Mostra " + theTree.last());
            
            break;
            case 9: System.out.println("Mostra " + theTree.sucessor());
            
            break;
            case 10: System.out.println("Mostra " + theTree.predecessor());
            
            break;
            
        }
     }
    }
    Non capisco questi errori in compilazioe e non so come risolverli, per piacere potete metterli a posto?

    C:\Documents and Settings\betta\Desktop\Nuova cartella (2)\GT.P-10.5\src\Tree234Test1.java:48: wrong number of type arguments; required 3
    private static void lancia(int s, Tree24<Integer,String> a){
    C:\Documents and Settings\betta\Desktop\Nuova cartella (2)\GT.P-10.5\src\Tree234Test1.java:17: wrong number of type arguments; required 3
    Tree24<Integer,String> theTree = new Tree24<Integer,String>();
    C:\Documents and Settings\betta\Desktop\Nuova cartella (2)\GT.P-10.5\src\Tree234Test1.java:17: wrong number of type arguments; required 3
    Tree24<Integer,String> theTree = new Tree24<Integer,String>();
    C:\Documents and Settings\betta\Desktop\Nuova cartella (2)\GT.P-10.5\src\Tree234Test1.java:50: wrong number of type arguments; required 3
    Tree24<Integer,String> theTree = new Tree24<Integer,String>();
    C:\Documents and Settings\betta\Desktop\Nuova cartella (2)\GT.P-10.5\src\Tree234Test1.java:50: wrong number of type arguments; required 3
    Tree24<Integer,String> theTree = new Tree24<Integer,String>();

    Questa è la definizione della classe tree24 principale:
    import java.util.Iterator;
    import java.util.Comparator;

    public class Tree24<E extends OrderedDictionary,K,V extends Value> implements Tree<E>,Dictionary<K,V>{



    public class Node24<E extends OrderedDictionary> implements Position24<E>



    public interface OrderedDictionary<K,V> extends Dictionary<K,V>

    Il resto non ci sta, è questo che serve mi sembra.

  2. #2
    Moderatore di Programmazione L'avatar di LeleFT
    Registrato dal
    Jun 2003
    Messaggi
    17,328

    Moderazione

    Hai già questa discussione aperta per lo stesso problema.
    Inoltre ne hai già altre 2 aperte sullo stesso argomento.

    E' vietato dal regolamento aprire più discussioni sullo stesso problema.

    Continua quella che hai aperto.

    Qui chiudo.


    Ciao.
    "Perchè spendere anche solo 5 dollari per un S.O., quando posso averne uno gratis e spendere quei 5 dollari per 5 bottiglie di birra?" [Jon "maddog" Hall]
    Fatti non foste a viver come bruti, ma per seguir virtute e canoscenza

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 © 2026 vBulletin Solutions, Inc. All rights reserved.