联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Java编程Java编程

日期:2018-06-17 03:40


COSC600 Project2

Page 1 of 2

Project2

This is an individual project and you are required to work on this project alone.

Specifications:

1. This project is asking you to create a

list of songs using an array and after

that you should be able to sort the

songs based on the different fields.

2. Design a class Song based on the

UML diagram. Song class contains a

list of fields to describe a song. The

duration field is a float number giving

the length of the song in minutes. The

Song constructor will create a song

with the fields set to default values

(String to “”, float to 0.0, int to 0).

The setSong method will assignment

the parameter values to the

corresponding fields if the parameter

value is a valid value. The toString

method will return a String

representation of the song information

(including all the fields) in a

formatted way.

3. Design a class SongList based on the UML diagram.

SongList contains a song array which can hold a MAX

(a static final field to specify the length of the songList

array to be created) number of songs. The size field is

used to keep track of how many songs have been added

into the songList so far. For the sorting method you can

either modify the sorting algorithm we have discussed

or you can implement your own.

4. Create a Project2 class with a static test method to test

your song list. First you add a bunch of songs (at least 6)

to your list, and then print out all the songs in your list.

After that you can call different sort methods and print

out the songs after each sort method call. Please also test

your findSong() method to make sure it does return the

right index of the song you are looking for.

SongList

- MAX: int

- songList: Song [ ]

- size: int

+SongList():

+addSong(Song): boolean

+findSong(String title): int

+swapSong(int, int):

+sortByWriter():

+sortByDuration():

+sortByGenre():

+sortByYear();

+toString(): String

+getSize(): int

Song

- title: String

- writer: String

- singer: String

- duration: float

- genre: String

- year: int

+Song()

+setSong(String, String, String, float, Sting, int)

+getTitle(): String

+getWriter(): String

+getSinger(): String

+getDuration(): float

+getGenre(): String

+getYear(): int

+toString():String

COSC600 Project2

Page 2 of 2

5. All three classes (Song, SongList, Project2) should be added into the project package we

have created previously. Changing the main() method in the Main class to call the test() of

the Project2 class.

6. Hints: Test your Song classes before integrating them into the SongList class.

Submissions:

1. Zip your project folder and you should get a file with this name:

COSC600_ <your FSU username>.zip

2. Be sure to unzip the above file and try the program out to make sure zip works correctly.

3. Then submit your zip file to Canvas corresponding submission folder.

Grading:

1. Grading of this program is based on:

a. Whether your program performs as it should be (60%);

b. Whether your program has the correct logical structure (30%);

c. Whether you program follows the recommended programming style (10%).

2. The total of this project is 100 points.


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp