Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Didattica > Corsi N - Z > Programmazione > [Programmazione] Problemi con codice
  Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
shadow
.consigliere.

User info:
Registered: Sep 2003
Posts: 133 (0.02 al dì)
Location: lainate
Corso: informatica
Anno: III
Time Online: 1 Day, 8:45:02: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
Cool [Programmazione] Problemi con codice

Buon Giorno a tutti
io sto quasi impazzendo in quanto dopo che ho scritto questo codice :

import prog.io.*;
import prog.utili.*;


class Evento {
public static void main(String[]args){
ConsoleInputManager in=new ConsoleInputManager();
ConsoleOutputManager out= new ConsoleOutputManager();
out.println("Inserisci i dati dell'evento:");
out.println(" data dell'evento:");
int b=in.readInt(" giorno?");
int c=in.readInt(" mese?");
int d=in.readInt(" anno?");
String nomeEvento=in.readLine(" nome dell'evento? ");

//Creo e visualizzo un oggetto avente la data corrente

Data oggi = new Data();
String stringaOggi = oggi.getNomeGiorno()+" "+oggi.getGiorno()+" "+oggi.getNomeMese()+" "+oggi.getAnno();
out.println("Oggi e' "+stringaOggi+".");

//Creo e visualizzo un oggetto avente la data dell'evento

Data evento=new Data(b,c,d);
out.println(nomeEvento+": "+evento.getNomeGiorno()+" "+evento.toString()+".");

//Controllo il tempo che manca

int tempo=evento.quantoManca(oggi);

//Controllo il verificarsi dell’evento(oggi, in passato, in futuro)
if (tempo==0)
out.println("L'evento "+nomeEvento+" e' oggi");
else if (evento.precede(oggi))
out.println("L'evento "+nomeEvento+" e' passato da "+tempo+" giorni.");
else
out.println("L'evento "+nomeEvento+" sara' fra "+tempo+" giorni.");
}
}

ottengo il seguente errore durante la compilazione :
C:\Java\Sorgenti>javac Evento.java

Evento.java:33: precede(prog.utili.Data) has private access in prog.utili.Data

else if (evento.precede(oggi))

^

1 error

Attenzione il ^ è sotto il punto fra evento e precede nell'errore che ottengo.
Secondo Voi cosa mi fa verificare questo errore?????
grazie a tutti

29-10-2003 12:40
Click Here to See the Profile for shadow Click here to Send shadow a Private Message Find more posts by shadow Add shadow to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
aladingenius
.primate.

User info:
Registered: Oct 2003
Posts: 79 (0.01 al dì)
Location: Milano
Corso: Informatica serale
Anno: 1 [chissà per quanto!]
Time Online: 20:54:51 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Ciao,
il metodo "precede", non è presente nella documentazione della classe Data. Non come metodo pubblico, almeno.

Infatti il compilatore ti comunica che non é accessiibile in quanto "private", concetto che non abbiamo ancora visto a lezione. Probablmente haii tirato ad indovinare ragionando per analogia con un altra classe che fornisce quel metodo...

Prova a sostituire quella riga con :

if (evento.quantoManca(oggi) < 0)

quantManca dovrebbe restituire un numero negativo (<0) se la data "oggi" precede...

ciauz
Amir

__________________
Life is Too Short To Cry,
Long Enough To Try.
"March Of Time" - Helloween

29-10-2003 12:53
Click Here to See the Profile for aladingenius Click here to Send aladingenius a Private Message Visit aladingenius's homepage! Find more posts by aladingenius Add aladingenius to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Alba2
.simpatizzante.

User info:
Registered: Oct 2003
Posts: 14 (0.00 al dì)
Location:
Corso: Informatica
Anno: 1
Time Online: 12:02:26 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

... non sono sicura ma... mi sembra che nella classe Data non esiste il metodo .precede

29-10-2003 13:08
Click Here to See the Profile for Alba2 Click here to Send Alba2 a Private Message Find more posts by Alba2 Add Alba2 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
aladingenius
.primate.

User info:
Registered: Oct 2003
Posts: 79 (0.01 al dì)
Location: Milano
Corso: Informatica serale
Anno: 1 [chissà per quanto!]
Time Online: 20:54:51 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

mi sono accorto ora che stavii cercando di fare l'esercizio del compitino dell'anno scorso... evidentemente hanno aggiornato le classi "nascondendo" il metodo
boolean precede(Data altra)

il tuo codice per il compito dell'anno scorso era Ok ;-)

ciauz

__________________
Life is Too Short To Cry,
Long Enough To Try.
"March Of Time" - Helloween

29-10-2003 13:09
Click Here to See the Profile for aladingenius Click here to Send aladingenius a Private Message Visit aladingenius's homepage! Find more posts by aladingenius Add aladingenius to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 10:08.    Post New Thread    Post A Reply
  Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.053 seconds (60.45% PHP - 39.55% MySQL) con 26 query.