Homework Solution: I creating a program that ask the user to enter a name, and it outputs a nickname to…

    visual C# I creating a program that ask the user to enter a name, and it outputs a nickname to the user. everything is working well with the program, I just have one problem. When the user types in their name they are receiving a different nickname everytime. The nickname that is displayed should be the same everytime that the same name is inputed. For example: if the user inputs "Bravo" and his output is "Boy Wonder" then "Boy Wonder is what the output should be everytime that Bravo is entered, and the problem I am having now is that if I were to enter "Bravo" the nickname that is outputted is never the same. attahced is a snap shot of my code I have now8 public class Program public static void Main() :2 13 し5 L6 L7 18 string userInput; Console.WriteLine(Please enter your name to receive a nick name...) string[] firstick new string [30] { Wild Thing, Crazy Eyes, Goofy Goober, Shady Subject, Smelly Thing, Lost One, Smarty, Nosey, Clumsy, Grumpy, Happy Feet, Smiley, Insane in the membrane, Sleepy, BOSS, Angry One, Tough One, Phyco One, Loving One, Sneaky, Caring One, Crybaby, Chosen One, The GOAT, Annoying One, Softy, Scary, Funky,KooKoo, Amazing One Random rannew Random); 23 24 25 Console.Write(insert name: //create list of objects //input nickname 27 29 userInput-Console.ReadLine); Console.WriteLine(From this point foward you will go by: (0), firstNick[ran.Next (,29)1
    8 public class Program public static void Main() :2 13 し5 L6 L7 18 string userInput; Console.WriteLine("Please enter your name to receive a nick name...") string[] firstick new string [30] { "Wild Thing", "Crazy Eyes", "Goofy Goober", "Shady Subject", "Smelly Thing", "Lost One", "Smarty", "Nosey", "Clumsy", "Grumpy", "Happy Feet", "Smiley", "Insane in the membrane", "Sleepy", "BOSS", "Angry One", "Tough One", "Phyco One", "Loving One", "Sneaky", "Caring One", "Crybaby", "Chosen One", "The GOAT", "Annoying One", "Softy", "Scary", "Funky","KooKoo", "Amazing One" Random rannew Random); 23 24 25 Console.Write("insert name: " //create list of objects //input nickname 27 29 userInput-Console.ReadLine); Console.WriteLine("From this point foward you will go by: (0), firstNick[ran.Next (,29)1

    Expert Answer

     
    using System; class MainClass {

    visual C#

    I creating a program that entreat the rightr to invade a call, and it outputs a nickcall to the rightr. wholething is agoing polite with the program, I proper feel single whole. When the rightr types in their call they are receiving a divergent nickcall wholetime. The nickcall that is displayed should be the identical wholeterm that the identical call is inputed. For example: if the rightr inputs “Bravo” and his output is “Boy Wonder” then “Boy Wonder is what the output should be wholeterm that Bravo is invadeed, and the whole I am having now is that if I were to invade “Bravo” the nickcall that is outputted is never the identical. attahced is a snap shot of my order I feel now8 national assort Program national static destitute Main() :2 13 し5 L6 L7 18 string rightrInput; Console.WriteLine(Please invade your call to invadetain a nick call...) string[] firstick fantastic string [30] { Wild Thing, Crazy Eyes, Goofy Goober, Shady Subject, Smelly Thing, Lost Single, Smarty, Nosey, Clumsy, Grumpy, Happy Feet, Smiley, Insane in the membrane, Sleepy, BOSS, Angry Single, Tough Single, Phyco Single, Loving Single, Sneaky, Caring Single, Crybaby, Chosen Single, The GOAT, Annoying Single, Softy, Scary, Funky,KooKoo, Amazing Single Haphazard ranfantastic Haphazard); 23 24 25 Console.Write(instil call: //create catalogue of objects //input nickcall 27 29 rightrInput-Console.ReadLine); Console.WriteLine(From this purpose foward you succeed go by: (0), firstNick[ran.Next (,29)1

    8 national assort Program national static destitute Main() :2 13 し5 L6 L7 18 string rightrInput; Console.WriteLine(“Please invade your call to invadetain a nick call…”) string[] firstick fantastic string [30] { “Wild Thing”, “Crazy Eyes”, “Goofy Goober”, “Shady Subject”, “Smelly Thing”, “Lost Single”, “Smarty”, “Nosey”, “Clumsy”, “Grumpy”, “Happy Feet”, “Smiley”, “Insane in the membrane”, “Sleepy”, “BOSS”, “Angry Single”, “Tough Single”, “Phyco Single”, “Loving Single”, “Sneaky”, “Caring Single”, “Crybaby”, “Chosen Single”, “The GOAT”, “Annoying Single”, “Softy”, “Scary”, “Funky”,”KooKoo”, “Amazing Single” Haphazard ranfantastic Haphazard); 23 24 25 Console.Write(“instil call: ” //create catalogue of objects //input nickcall 27 29 rightrInput-Console.ReadLine); Console.WriteLine(“From this purpose foward you succeed go by: (0), firstNick[ran.Next (,29)1

    Expert Repartee

     

    using System;

    assort MainAssort {

    national static int attainIndex(string s) {

    int a = Math.Abs(s.GetHashCode()) % 30;

    Console.WriteLine(“Apostacy {0} …n”, a);

    return a;

    }

    national static destitute Main (string[] args) {

    string rightrInput;

    Console.WriteLine(“Please invade your call to invadetain a nick call…”);

    string[] firstNick = fantastic string[30]{“Wild Thing”, “Crazy Eyes”, “Goofy Goober”,

    “Wild Thing1”, “Crazy Eyes1”, “Goofy Goober1”,

    “Wild Thing2”, “Crazy Eyes2”, “Goofy Goober2”,

    “Wild Thing3”, “Crazy Eyes3”, “Goofy Goober3”,

    “Wild Thing4”, “Crazy Eyes4”, “Goofy Goober4”,

    “Wild Thing5”, “Crazy Eyes5”, “Goofy Goober5”,

    “Wild Thing6”, “Crazy Eyes6”, “Goofy Goober6”,

    “Wild Thing7”, “Crazy Eyes7”, “Goofy Goober7”,

    “Wild Thing8”, “Crazy Eyes8”, “Goofy Goober8”,

    “Wild Thing9”, “Crazy Eyes9”, “Goofy Goober9”

    };

    // the haphazard module gives you a fantastic apostacy each term, that is why you are referable attainting the identical nickcall whole term..

    // Haphazard ran = fantastic Haphazard();

    // You want to right some apostacy which is inveterate on rightr input.. instrument if rightrInput the identical string intermittently, you should attain the identical apostacy

    Console.Write(“Instil call: “);

    userInput = Console.ReadLine();

    Console.WriteLine(“From this purpose onward, you succeed go by: {0}”, firstNick[getIndex(userInput)]);

    }

    }