COS10029 – Fundamentals of Programming
Fundamentals of Programming Week 11 – Lab exercises (Submit all tasks – submit HD task separately ) Task 11.1 Write a program for reading information from a data file and saving a summary report into another data file for the average value, the maximum value, and the minimum value. A data file named 'price .dat’ contains the price of different items , the first record in the price data file contains an integer that specifies the number of records that follow. Each of the following lines contains an id and the corresponding price .
10 1 1000.25 2 55.25 3 9999.99 4 33.45 5 2000.00 6 1588.88 7 1699.99 8 14898.25 9 13734.21 10 13523.24
The output of the problems should be saved into another data file, named 'Output.dat '. With the following data:
Number of price reading s: 10 Maximum price: 14898.30 Minimum price: 33.45 Average price: 5853.35
Task 11. 2 HD Task – GUI Music Player
For this task, you are required to create GUI ( Graphical User interface ) based Music Player using SplashKit . The program should read in album and track information from a predefined file. The user should then be able to view the albums and select an album, then view the tracks and select a track to play.
The information read from the file can be : • Number of A lbums • Album title • Artist • Artwork file name (place your artwork in an /images folder inside the Resources folder ) • The number of tracks • The title of each track • The file location of each track (place your music file in a sounds folder inside the Resources folder - use .wav files for each track)
Your program should contain file handling, arrays, structs, enums, etc.
You are allowed to use your own images and music files (do not upload your images or music files in Canvas) . The user interaction must be entirely through a GUI. Your GUI interface should show all the albums using either a text description, artwork or both. Users should be able to click on any Album information (i.e the artwork) and the tracks will be listed. The us er should then be able to click on a track to play that track. The currently playing track must be indicated somehow ( e.g. the track could be highlighted or display a simple text message ‘Now playing ..’). If the user clicks on another track (for the curre nt album or another album) then any currently playing track should be stopped and the most recently selected track start playing.
Click here to see the sample run of Music Player . You must submit the c ode for the program written in C++ and a screenshot of it running . In addition to that show the working of your code directly to the tutor or upload a video or link to a video that shows a sample run of your Music Player. Note : Refer to https://splashkit.io/ website for di fferent functions that you can use for this task. You will need to use the following:
path_to_resource( ) – use this to load your music .wav files. It will look in the Resources folder for files and allows cross -platform file access. load_music () – this will load the resource at the given path. play_music() - plays the music file that matches the name once at full volume. stop_music() - stops all music that is playing . free_all_music() - releases all of the music files that have been loaded .
You can search “music” on SplashKit website to see all the information required for these functions.