Public feed #722615

crappy maori days

public text v1 · immutable
Raw Edit
·published 2007-10-02 04:20 UTC
rendered paste body
using System;
using System.Collections.Generic;
using System.Text;

namespace Sec07Ex04
{
    class Program
    {
        //<summary>
        //program that manipulates arrays and strings
        //</summary>
        static void Main(string[] args)
        {
            string[] maoriDaysOfWeek = new string[7];
            string[] englishDaysofWeek = new string[7];
            int score = 0;
            string answer;

            //set their values, missed the long vowel sounds out
            maoriDaysOfWeek[0] = "Rahine";
            maoriDaysOfWeek[1] = "Ratu";
            maoriDaysOfWeek[2] = "Raapa";
            maoriDaysOfWeek[3] = "Rapare";
            maoriDaysOfWeek[4] = "Ramere";
            maoriDaysOfWeek[5] = "Rahoroi";
            maoriDaysOfWeek[6] = "Ratapu";

            englishDaysofWeek[0] = "Monday";
            englishDaysofWeek[1] = "Tuesday";
            englishDaysofWeek[2] = "Wednesday";
            englishDaysofWeek[3] = "Thursday";
            englishDaysofWeek[4] = "Friday";
            englishDaysofWeek[5] = "Saturday";
            englishDaysofWeek[6] = "Sunday";

            //ask questions, get response and increase score if answer correct
            Console.WriteLine("Program to guess the day");
            Console.WriteLine("Given the day in Maori, guess the day in english");
            Console.WriteLine("Use the capital letter for the first letter of the day\n");

            int dayNum = 0;
            Random rnd = new Random(); // creates a random number generator object
            for(int i=0; i<maoriDaysOfWeek.Length;i++)
            {
                int[] olddayNum = new int[7]; //old day numbers array
                
                    for (int j = 0; j < olddayNum.Length; j++)
                    {
                        olddayNum[j] = dayNum;
                        if (dayNum == olddayNum[j])
                        {
                        dayNum = rnd.Next(0, 6); //gets a random number from 0 to 6
                       
                        }
                        else{}
                    }
              
                Console.WriteLine("Enter in the english equivalent for : " + maoriDaysOfWeek[dayNum]);
                answer = Console.ReadLine();
                if(answer == englishDaysofWeek[dayNum])
                { //correct
                    score++;
                }
                //give feedback
                Console.WriteLine("Your score was "+score);
                Console.WriteLine("press any key to continue..");
                Console.ReadLine();
            }
        }
    }
}