Quindi il tutto deve venire così:
codice:
public class Cd
{
private String author;
private String title;
private int time;
private double price;
public Cd(String author, String title, int time, double price)
{
this.author = author;
this.title = title;
this.time = time;
this.price = price;
}
public String getAuthor()
{
return author;
}
public void setAuthor(String author)
{
this.author = author;
}
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public int getTime()
{
return time;
}
public void setTime(int time)
{
this.time = time;
}
public double getPrice()
{
return price;
}
public void setPrice(double price)
{
this.price = price;
}
@Override
public String toString()
{
return String.format("%s, %s - %d (%f)", title, author, time, price);
}
}
Vabbè apparte i this. che a parer della prof non piacciono non capisco come in questo caso debba inserire dei metodi getter e setter quando in un esercizio simile siamo passati subito all ordinamento senza definire questi metodi O.o
E comunque grazie dell'aiuto