3 parallel arrays

Write your question here. With the aid of three parallel arrays, accept the name of six songs, the artists who sang the songs, as well as the play count for each song. Using a fourth array assign a rating to the song based on the following criteria: Play Count Rating
0 0
1 - 3 1
4 - 5 2
6 - 8 3
9 - 12 4
Over 12 5
Display the name of the songs, as well as the person who sang the songs

closed account (48T7M4Gy)
What's the question or, do we just get on and do your homework?
I'm not so good with parallel array's
but I did make a list of artist nd songs (I didn't use real ones just made up artist and songs)
artist song play count rating
sam tuner western wind 5 2

tina baher I love you always 7 3

Justin smith pearls 8 3

adam Lockheed heart of steel 3 1

sarah Farrah timeless 12 4

amy Anderson for you 13 5


if the play rate is 0 then the rating is 0
if the playrate is 1 to 3 then the rating is 1
if the playrate is 4 to 5 then the rating is 2
if the playrate is 6 to 8 then the rating is 3
if the playrate is 9 to 12 then the rating is 4
if the playrate is over 12 then the rating is 5
name___song____playrate____rating
example: name: sam tuner , song: western wind , playrate: 5 , rating: 3
What code have you done so far?
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;

int main()
{

string artist[6] =
string song[6]
int playrate[]
int rating []

{

}
closed account (48T7M4Gy)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>

using std::string;

int main()
{
   string artist[6] = { "tina baher", ...};
   string song[6] = { " I love you always", ... };
   int playrate[6] = { 7, ...};
   int rating [6] = { 0 }; //empty at the start

   return 0;
}


There's a start you can work on. The principle involved in parallel arrays is the common index number which enables access to the various arrays to store and retrieve the various details.

You will have to write a few lines of code to fill the rating array once you have loaded the other data. Probably use a for loop with a switch or if's control. If you don't know what that means then go to the tutorials here or your textbook/notes
Last edited on
ok thank you friends , ill do my best.
closed account (48T7M4Gy)
OK let us know how you get on.
if I waited to change it so it will accept any song ,artist ,playrate then based on the playrate give it a rating(based on the criteria) like on an ipod.
closed account (48T7M4Gy)
That's the way I understand the problem you have been given. The rating is derived from the playrate so you don't have to enter that piece of data
oh ok
Topic archived. No new replies allowed.