3 parallel arrays

Nov 29, 2015 at 11:24pm
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

Nov 29, 2015 at 11:50pm
closed account (48T7M4Gy)
What's the question or, do we just get on and do your homework?
Nov 30, 2015 at 12:13am
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
Nov 30, 2015 at 12:15am
name___song____playrate____rating
example: name: sam tuner , song: western wind , playrate: 5 , rating: 3
Nov 30, 2015 at 12:17am
What code have you done so far?
Nov 30, 2015 at 12:34am
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;

int main()
{

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

{

}
Nov 30, 2015 at 12:50am
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 Nov 30, 2015 at 3:05am
Nov 30, 2015 at 1:01am
ok thank you friends , ill do my best.
Nov 30, 2015 at 1:24am
closed account (48T7M4Gy)
OK let us know how you get on.
Nov 30, 2015 at 1:46am
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.
Nov 30, 2015 at 1:54am
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
Nov 30, 2015 at 2:59am
oh ok
Topic archived. No new replies allowed.