A music album is a compilation of many songs recorded by one artist - NSC Information Technology - Question 3 - 2024 - Paper 1
Question 3
A music album is a compilation of many songs recorded by one artist. Music albums are evaluated every 10 weeks to determine the number of points earned, based on the... show full transcript
Worked Solution & Example Answer:A music album is a compilation of many songs recorded by one artist - NSC Information Technology - Question 3 - 2024 - Paper 1
Step 1
3.2.1 - Instantiate album object
96%
114 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
To instantiate an album object, extract the album title and artist name from the user interface inputs. Use these values to create a new instance of the Album class:
var
objAlbum: Album;
begin
objAlbum := Album.Create(AlbumNameEdit.Text, ArtistNameEdit.Text);
end;
Step 2
3.2.2 - Calculate points
99%
104 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
Call the updatePoints method using the correct parameters which represent the number of albums sold, downloads, and streams. Ensure all values are converted to the correct type before passing them as arguments:
var
albumsSold, downloads, streams: integer;
begin
albumsSold := StrToInt(AlbumsSoldEdit.Text);
downloads := StrToInt(DownloadsEdit.Text);
streams := StrToInt(StreamsEdit.Text);
objAlbum.updatePoints(albumsSold, downloads, streams);
end;
Step 3
3.2.3 - Set ranking
96%
101 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
Extract the number of weeks from the input and convert it to an integer to call the setRanking method:
var
numWeeks: integer;
begin
numWeeks := StrToInt(WeeksEdit.Text);
objAlbum.setRanking(numWeeks);
end;
Step 4
3.2.4 - Display album details
98%
120 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
Use the toString method to display album details in the designated RichEdit component and call determineStatus to check and display the ranking status: