C
C#2y ago
pyet

❔ Program that gives you a choice of several artists and then their songs

Hey guys! I really need help with this one. I want to write a program for selecting the music artist and his album title. I want a numbered list of three artists and the user selects one of them after that the program displays a list of three titles from which the user selects one. And finaly a message displayed, e.g. You have selected artist A and album title B. This is my code for now. I really need help to write this :(( Console.WriteLine("Wybierz wykonawcę od numeru 1 do 3 "); Console.WriteLine("1.The Cure "); Console.WriteLine("2.Lady Gaga "); Console.WriteLine("3.Nirvana "); int wykonawca = int.Parse(Console.ReadLine()); if (wykonawca == 1) ; { Console.WriteLine("Wybrałeś wykonawcę The Cure"); Console.WriteLine("Wybierz jeden utwór The Cure"); Console.WriteLine("Lovesong, Disintegration, Wish"); } Console.WriteLine("Wybierz wykonawcę od numeru 1 do 3 "); Console.WriteLine("1.The Cure "); Console.WriteLine("2.Lady Gaga "); Console.WriteLine("3.Nirvana "); int wykonawca = int.Parse(Console.ReadLine()); if (wykonawca == 2) ; // Console.WriteLine(Judas, Pokerface, ""Telephone"");
13 Replies
Relevant
Relevant2y ago
What is working and what is not working so far? What is your next step?
pyet
pyetOP2y ago
I don't know how to write it so that it doesn't start with the question "choose an artist" again, but only one such question and then all the possibilities
Relevant
Relevant2y ago
Do you see why it's doing that according to your code? The code is doing exactly what you told it to do
pyet
pyetOP2y ago
Yeah but i dont know how to do it right and much more easier
TheRanger
TheRanger2y ago
use object orientation make 2 classes called Artist and Album
Pobiega
Pobiega2y ago
This is a great example of a type of application you want to be "data driven" TheRanger has the right idea, make classes that represent Artist and Album, then build up your "database" as a list of Artists, where each artist has a list of albums in it. you then just "pick from a list" twice could even have that "database" be a json file, or something, if you prefer being able to edit it without changing your code
pyet
pyetOP2y ago
Hmmmm could you guys send me sample code please?
Pobiega
Pobiega2y ago
do you know how to make a class?
pyet
pyetOP2y ago
No
Pobiega
Pobiega2y ago
Classes
Learn about the class types and how to create them
Relevant
Relevant2y ago
Seems that's pretty far beyond the scope of OP's assignment
Pobiega
Pobiega2y ago
If you want to hardcode all the alternatives in an imperative way, you certainly can - but is that a good idea? but sure, if all you want is to fix your current code, then the first thing I noticied is that your if statement has a ; after it, which makes it do nothing
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server