I know this is very very short notice but I need this by 11:30 am CST I was depending on cramster to help but no one responded to my topic last and I dont think anyone goes past page one on those forums plus I dont think anyone does C# there as its my second post to not get a reply
I've done half of this assignment I need help with the other half here are the questions
Questions 3 and 4
3. All methods in BabyNameGenerator and RandomStringGenerator classes are static – change the program in 2 accordingly.
4. Convert the program 2 above as follows: the parameter sent with the command line is the amount the Parent class has to play with – so only if the amount in hand is greater than the amount requested will the name be requested. You may need to change BabyNamesGenerator class for this purpose and assume estimates are free.
Since 3 and 4 mention # 2 here it is
Convert the above Parent class to accept command line arguments: that is if you type “program_name 4” the Parent class will request four names and prices from BabyNameGenerator class and print them.
Here is what I have :
usingSystem
using System.Text;
/// <summary>
/// Generates a random string with the given length
/// </summary>
/// <param name="size">Size of the string</param>
/// <param name="lowerCase">If true, generate lowercase string</param>
/// <returns>Random string</returns>
public class RandomStringGenerator()
{
private string RandomString (int size, bool lowerCase)
{
StringBuilder builder = new Stringbuilder();
Random random = new Random();
char ch;
for(int i=0; i<size; i++)
{
ch = Convert.ToInt32(Math.Floor(26 * random.NextDouble()+65)));
builder.Append(ch);
}
if(lowerCase)
return builder.ToString().ToLower();
return builder.ToString();
}
public string TenStrings
{
StringBuilder builder = new Stringbuilder();
builder.Append(RandomString(10, true));
return builder.ToString();
if(RandomString = true)
{
Console.WriteLine("Ten Strings Completed");
}
}
}
public class BabyNameGenerator()
{
int i;
int BabyNameCost;
BabyNameCost = 10;
private string RandomString (int size, bool lowerCase)
{
StringBuilder builder = new Stringbuilder();
Random random = new Random();
char ch;
for(int i=0; i<size; i++)
{
ch = Convert.ToInt32(Math.Floor(26 * random.NextDouble()+65)));
builder.Append(ch);
}
if(lowerCase)
return builder.ToString().ToLower();
return builder.ToString();
}
string BabyName;
for(string BabyName <=4; i++)
{
if(BabyName <=4)
Console.WriteLine("The cost for this name suggestion is: $"{0});
if(BabyName >=5)
BabyNameCost++;
Console.WriteLine("The cost for this name suggestion is: $"{0});
}
}
public class Parent()
{
Console.WriteLine("Enter how names you want suggested");
string line = Console.ReadLine();
Console.ReadKey();
get
{
return BabyName;
}
get
{
return BabyNameCost;
}
}