Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //gebruikt interface voor 2 methods en polymorphisme
- public class Quote : IQuote
- {
- //3 arrays
- string[] breakUpQuote;
- string[] gewoneQuote;
- string[] meligeQuote;
- //voor willekeurig getal
- Random rnd = new Random();
- //constructor om arrays te maken en waarde te geven
- public Quote(string[] BreakUpQuote, string[] GewoneQuote, string[] MeligeQuote)
- {
- this.breakUpQuote = BreakUpQuote;
- this.gewoneQuote = GewoneQuote;
- this.meligeQuote = MeligeQuote;
- }
- //haal een willekeurige quote uit array
- public string GetQuote(int randomNumber)
- {
- string quoteReturn = "";
- //als lager dan 50 is
- if (randomNumber < 50)
- {
- if (randomNumber == 0) //als het 0 is
- return quoteReturn = "HAHA";
- quoteReturn = breakUpQuote[rnd.Next(0, breakUpQuote.Length)];
- }
- else if (randomNumber < 80) // als lager dan 80 is
- {
- quoteReturn = gewoneQuote[rnd.Next(0, gewoneQuote.Length)];
- }
- else //anders
- {
- quoteReturn = meligeQuote[rnd.Next(0, meligeQuote.Length)];
- }
- return quoteReturn;
- }
- //genereer willekeurig nummer
- public int RandomNumber()
- {
- return rnd.Next(0, 100);
- }
- }
Add Comment
Please, Sign In to add comment