1 public class MainCD{
2
3 public static void main(String[] args){
4
5 CD pFloyd = new CD("Wish you were here", "Pink Floyd", 1975, 5);
6 pFloyd.addSong("Shine on you crazy diamond");
7 pFloyd.addSong("Welcome to the machine");
8 pFloyd.addSong("Have a cigar");
9 pFloyd.addSong("Wish you were here");
10 pFloyd.addSong("Shine on you crazy diamond (version 2)");
11 pFloyd.showInfo();
12
13 CD rhead = new CD("OK Computer", "Radiohead", 1997, 12);
14 rhead.addSong("Airbag");
15 rhead.addSong("Paranoid Android");
16 rhead.addSong("Subterranean Homesick Alien");
17 rhead.addSong("Exit Music (For A Film)");
18 rhead.addSong("Let Down");
19 rhead.addSong("Karma Police");
20 rhead.addSong("Fitter Happier");
21 rhead.addSong("Electioneering");
22 rhead.addSong("Climbing Up The Walls");
23 rhead.addSong("No Surprises");
24 rhead.addSong("Lucky");
25 rhead.addSong("Tourist, The");
26 rhead.showInfo();
27
28 CD nCave = new CD("Let Love In", "Nick Cave and the bad seeds", 1996, 10);
29 nCave.addSong("Do You Love Me?");
30 nCave.addSong("Nobody's Baby Now");
31 nCave.addSong("Loverman");
32 nCave.addSong("Jangling Jack");
33 nCave.addSong("Red Right Hand");
34 nCave.addSong("I Let Love In");
35 nCave.addSong("Thirsty Dog");
36 nCave.addSong("Ain't Gonna Rain Anymore");
37 nCave.addSong("Lay Me Low");
38 nCave.addSong("Do You Love Me? (Part 2)");
39 nCave.showInfo();
40
41 // The following song titles should FAIL
42
43 boolean nCaveTest = nCave.addSong("Lay Me Low");
44 boolean rheadTest = rhead.addSong("Tourist, The");
45 boolean pFloydTest = pFloyd.addSong("Have a cigar");
46 System.out.println("Nick Cave Test? "+nCaveTest);
47 System.out.println("Radiohead Test? "+rheadTest);
48 System.out.println("Pink Floyd Test? "+pFloydTest);
49
50
51
52 }
53 }
Generated with
vim2html
Copyright © 2003-2004 by Chip Cuccio
<http://norlug.org/~chipster/finger>