korteste spilletid fra et objekt
Som forlængelse af denne tråd:http://www.eksperten.dk/spm/955030#reply_7891078
skal jeg nu i gang med opgave 7.
http://imageshack.us/photo/my-images/221/screenshot20120111at747.jpg/
Mine koder ser sådanne ud nu:
public class Track
{
private String artist, songName;
private int min, sec;
public Track(String artist, String songName, int min, int sec)
{
this.artist = artist;
this.songName = songName;
this.min = min;
this.sec = sec;
}
public String toString()
{
return(songName + ": " + artist + " (" + min + " :" + sec + " )");
}
}
public class Driver
{
public static void exam()
{
Track t1 = new Track("Yesterday", "The Beatles", 2,05);
Track t2 = new Track("Paradise City", "Guns N Roses", 3,44);
System.out.println(t1.toString());
System.out.println(t2.toString());
Playlist p = new Playlist
p.add(t1);
p.add(t2);
}
}
public class Playlist
{
public StringplaylistName()
{
}
public void addTrack(Track t)
{
listofTrack.add(t);
}
public void removeTrack(Track t)
{
listofTrack.remove(t);
}
public Track findShortestTrack()
{
}
}