Question Details

(Answered)-CSCE 2004 - Programming Foundations 1 Spring 2016 Assignment


Hello,?


Can you please help me on the attached program! Thanks!


CSCE 2004 ? Programming Foundations 1

 


 

Spring 2016

 


 

Assignment 7: Library Class - Due May 5th at 11:59pm

 

Objective

 

In this assignment, you will design and implement a Library class. This class will represent a library of

 

songs and will build upon the Song class.

 


 

Prerequisites

 

To complete the assignment, you will need to be familiar with the following concepts:

 

?

 


 

How to implement and use class in C++

 


 

(Chapter 13 and Chapter 14)

 


 

Description

 

Write the interface and function implementation for the Library Class. The Library class will have the

 

following attributes:

 

Public or Private?

 

Private

 

Private

 


 

Type

 

integer

 

Song pointer

 


 

Name

 

Size

 

songs

 


 

The Library Class will have the follow functions:

 

Public or Private?

 

Public

 


 

Return type

 

N/A

 


 

Function Name

 

Library

 


 

Inputs(s)

 

Size of the array

 

(integer)

 

Library object

 


 

Public

 


 

N/A

 


 

Library

 


 

Public

 

Public

 


 

N/A

 

void

 


 

~Library

 

addSong

 


 

None

 

i (integer), Song

 

object

 


 

Public

 


 

bool

 


 

binarySearch

 


 

Song object

 


 

Public

 


 

void

 


 

selectionSort

 


 

None

 


 

Public

 


 

Library

 


 

operator+

 


 

Library object

 


 

Purpose

 

Default Constructor

 

Constructor that

 

copies the

 

information from

 

one Library object to

 

another.

 

Destructor

 

This function will add

 

a song to the ith spot

 

in the array.

 

Returns a Boolean

 

that represents if the

 

song is in the library

 

or not.

 

Use selection sort to

 

sort the library of

 

songs by Song Name.

 

This is an operator

 

overloading function

 

and is explained

 

below.

 


 

CSCE 2004 ? Programming Foundations 1

 


 

Spring 2016

 


 

The first step of this assignment is to separate the Song class into two different files, a header file and an

 

implementation file. These files will be called Song.h and Song.cpp. So at this point you will have 3 files:

 

Song.h, Song.cpp and main.cpp.

 

The next step is to implement the Library class in the same format, a header and an implementation file.

 

It should include two attributes: a size and a song pointer. The song pointer is going to be used for the

 

allocation of a dynamic array. When you use a dynamic array only the pointer should be a private

 

variable. The constructor should be where you create your array and the destructor should be where

 

you delete your array.

 

This class has 4 functions besides the constructors and destructor: addSong, binarySearch, selectionSort

 

and operator+. The operator+ function is the operator overloading function. You are going to overload

 

the addition operator so that two Library objects can be added together. So the this snippet of code,

 

lib3 = lib1 + lib2;

 

, will create a Library object with all the songs of lib1 and lib2. The selectionSort function will use

 

selection sort to sort the array in the Library object by the song name. The binarySearch function will use

 

binary search to determine whether the current library has a certain song or not. You must implement

 

the correct sorting and searching algorithm. You are not allowed to use the sort function that is built

 

into C++. So at this point in the assignment you should have 5 files: Song.h, Song.cpp, Library.h,

 

Library.cpp, and main.cpp.

 

In the main, you need to read from the file input1.txt to create a library of songs. This file will be

 

formatted exactly like the one from homework 6. The first line will be a number, which represents the

 

number of songs in the library, and the information that follows will be the information for each song.

 

You will then need to create another library of song using another file named input2.txt.

 

Now what you need to do is to use the operator overloading function, operator+, to fuse these library

 

two libraries into a third library. Then use the selectionSort function to sort the songs of the third library

 

and use the binarySearch function to find a song in the sorted library. This song will be read in and

 

created from the file song.txt. To test your program, you are going to have to create these files using the

 

information from the sample input section.

 

Print the new library of songs to the file output.txt and print a statement telling the user if the song is in

 

the new library to the screen.

 


 

How to compile multiple files

 

If have 5 files: main.cpp, Song.h, Song.cpp, Library.h, and Library.cpp we use the following command to

 

compile all of them at once.

 

g++ main.cpp Song.cpp Library.cpp

 


 

CSCE 2004 ? Programming Foundations 1

 


 

Sample Input

 

input1.txt

 

3

 

Kanye West

 

I Love Kanye

 

The Life of Pablo

 

Rap

 

9

 

2016

 

45

 

Nightwish

 

Dark Chest of Wonders

 

Once

 

Symphonic Metal

 

1

 

2004

 

269

 

The Beatles

 

Let It Be

 

Let It Be

 

Rock

 

6

 

1970

 

243

 

input2.txt

 

5

 

Justin Bieber

 

Love Yourself

 

Purpose

 

Pop

 

5

 

2015

 

233

 

Twenty One Pilots

 

The Judge

 

Blurryface

 

Alternative Hip-Hop

 

7

 

2015

 

297

 

Queen

 


 

Spring 2016

 


 

CSCE 2004 ? Programming Foundations 1

 

I Want to Break Free

 

The Works

 

Classic Rock

 

6

 

1984

 

200

 

Imagine Dragons

 

Shots

 

Smoke + Mirrors

 

Rock

 

1

 

2015

 

232

 

The Who

 

Baba O?Reily

 

Who?s Next

 

Classical Rock

 

1

 

1971

 

297

 

song.txt

 

Imagine Dragons

 

Shots

 

Smoke + Mirrors

 

Rock

 

1

 

2015

 

232

 


 

Sample Output

 

output.txt

 

Song 1:

 

Artist: Kanye West

 

Title: I Love Kanye

 

Album: The Life of Pablo

 

Genre: Rap

 

Track Number: 9

 

Year: 2016

 

Length: 0m 45s

 

Song 2:

 

Artist: Nightwish

 

Title: Dark Chest of Wonders

 


 

Spring 2016

 


 

CSCE 2004 ? Programming Foundations 1

 

Album: Once

 

Genre: Symphonic Metal

 

Track Number: 1

 

Year: 2004

 

Length: 4m 29s

 

Song 3:

 

Artist: The Beatles

 

Title: Let It Be

 

Album: Let It Be

 

Genre: Rock

 

Track Number: 6

 

Year: 1970

 

Length: 4m 3s

 

Song 4:

 

Artist: Justin Bieber

 

Title: Love Yourself

 

Album: Purpose

 

Genre: Pop

 

Track Number: 5

 

Year: 2015

 

Length: 3m 53s

 

Song 5:

 

Artist: Twenty One Pilots

 

Title: The Judge

 

Album: Blurryface

 

Genre: Alternative Hip-Hop

 

Track Number: 7

 

Year: 2015

 

Length: 4m 5s

 

Song 6:

 

Artist: Queen

 

Title: I Want to Break Free

 

Album: The Works

 

Genre: Classic Rock

 

Track Number: 6

 

Year: 1984

 

Length: 3m 20s

 

Song 7:

 

Artist: Imagine Dragons

 

Title: Shots

 

Album: Smoke + Mirrors

 

Genre: Rock

 

Track Number: 1

 

Year: 2015

 


 

Spring 2016

 


 

CSCE 2004 ? Programming Foundations 1

 


 

Spring 2016

 


 

Length: 3m 52s

 

Song 8:

 

Artist: The Who

 

Title: Baba O?Reily

 

Album: Who?s Next

 

Genre: Classical Rock

 

Track Number: 1

 

Year: 1971

 

Length: 4m 57s

 

screen

 

The song ?Shots? by ?Imagine Dragons? is in the Library.

 


 

Deliverables

 

1. 3 C++ (.cpp) files and 2 Header files (.h) that performs the task described above.

 

2. Documentation of your code as per the ?Programming Documentation? guidelines posted in the

 

News Forum on Moodle.

 


 

 


Solution details:
STATUS
Answered
QUALITY
Approved
ANSWER RATING

This question was answered on: Oct 07, 2020

PRICE: $15

Solution~0002162179.zip (25.37 KB)

Buy this answer for only: $15

This attachment is locked

We have a ready expert answer for this paper which you can use for in-depth understanding, research editing or paraphrasing. You can buy it or order for a fresh, original and plagiarism-free copy (Deadline assured. Flexible pricing. TurnItIn Report provided)

Pay using PayPal (No PayPal account Required) or your credit card . All your purchases are securely protected by .
SiteLock

About this Question

STATUS

Answered

QUALITY

Approved

DATE ANSWERED

Oct 07, 2020

EXPERT

Tutor

ANSWER RATING

GET INSTANT HELP/h4>

We have top-notch tutors who can do your essay/homework for you at a reasonable cost and then you can simply use that essay as a template to build your own arguments.

You can also use these solutions:

  • As a reference for in-depth understanding of the subject.
  • As a source of ideas / reasoning for your own research (if properly referenced)
  • For editing and paraphrasing (check your institution's definition of plagiarism and recommended paraphrase).
This we believe is a better way of understanding a problem and makes use of the efficiency of time of the student.

NEW ASSIGNMENT HELP?

Order New Solution. Quick Turnaround

Click on the button below in order to Order for a New, Original and High-Quality Essay Solutions. New orders are original solutions and precise to your writing instruction requirements. Place a New Order using the button below.

WE GUARANTEE, THAT YOUR PAPER WILL BE WRITTEN FROM SCRATCH AND WITHIN YOUR SET DEADLINE.

Order Now