I am making a character generator for school. What I have to do is make my CalcPoints method abstract. Unfortunately I keep getting These three error for each of my derived character classes and I don't know what to do.
C:\Users\Hector Rosario\Documents\Visual Studio 2008\Projects\Rosario_Week3\ConsoleApplication2\Program.cs(126,26): error CS0115: 'UltimateWarrior.CalcPoints()': no suitable method found to override
C:\Users\Hector Rosario\Documents\Visual Studio 2008\Projects\Rosario_Week3\ConsoleApplication2\Program.cs(137,26): error CS0115: 'KarateWizard.CalcPoints()': no suitable method found to override
C:\Users\Hector Rosario\Documents\Visual Studio 2008\Projects\Rosario_Week3\ConsoleApplication2\Program.cs(152,26): error CS0115: 'Dragoon.CalcPoints()': no suitable method found to override
I've working on this for two days and I think I am close but I can't figure out what I am doing wrong. Any help or advice would be awesome, Thanx
public class CharClass
{
public CharClass()
{
Console.WriteLine("Calculating Life points");
Calculate();
}
public static void Main(string[] args)
{
string Name;
string choose;
string Sex;
string race;
string species;
Dragoon Mydragoon = new Dragoon();
Console.ReadLine();
KarateWizard Mykaratewizard = new KarateWizard();
Console.ReadLine();
UltimateWarrior Myultimatewarrior = new UltimateWarrior();
Console.ReadLine();
Console.Write("Please enter your name: ");
Name = Console.ReadLine();//set character's name
Console.WriteLine("Your character's age is {0}", age);
Console.WriteLine("You have three races that you can choose for your\n character. Please type in human, elf or dwarf.");
race = System.Console.ReadLine();
switch (race)//choose character's race
{
case "human":
species = "Your character is human.\n";
break;
case "elf":
species = "Your character is an elf.\n";
break;
case "dwarf":
species = "Your character is a dwarf.\n";
break;
default:
species = "Please pick human, dwarf or elf";
break;
}
System.Console.Write("Ok, " + species);
Console.WriteLine("Do you want your character to be male or female?\n Press m or f to make your choice.");
choose = System.Console.ReadLine();
switch (choose)//choose character's sex
{
case "m":
Sex = "Your character is male\n";
break;
case "f":
Sex = "Your character is female\n";
break;
default:
Sex = "I'm sorry but uh... last I checked there were only two sexes, \nmale and female.\n";
break;
}//end switch statement
System.Console.Write("Ok, " + Sex);
Console.WriteLine("\nLet's see how charismatic " + Name + " is. \n");
bool charisma = true;
// WriteLine automatically converts the value of charisma to text.
Console.WriteLine(charisma);
int fate = DateTime.Now.DayOfYear;//Charisma will be set according to the day of the week
// Assign the result of a boolean expression to charisma.
charisma = (fate % 2 == 0);
if (true == charisma)
{
Console.WriteLine(Name + " has great charisma and will be very popular!");
}
else
{
Console.WriteLine(Name + " has poor charisma.");
}
MessageBox.Show("Name: " + Name + "\nRace: " + species + "\nAge: " + age + "\nGender: " + Sex + "\nCharisma: " + charisma + "\nLife: " + life);
Console.WriteLine("\nPress [ENTER] to Exit");
Console.ReadLine();
}
virtual public void CalcPoints(int intMin, int intMax)
{
//Create a new instance of the class Random
Random randomNumber = new Random();
//Generate a random number using intMin as the minimum and intMax as the maximum
return randomNumber.Next(intMin, intMax);
}
}
}
public class UltimateWarrior
{
int strength;
public override void CalcPoints()
{
int life = Calcpoints(10, 100);//calculating life points
Console.WriteLine(Name + " has {0} life points.", life);
int age = Calcpoints(10, 40);//calculates charactersm age.
}
}
public class KarateWizard
{
int magic;
public override void CalcPoints()
{
int life = Calcpoints(10, 100);//calculating life points
Console.WriteLine(Name + " has {0} life points.", life);
int age = Calcpoints(10, 40);//calculates charactersm age.
}
}
public class Dragoon
{
int dexterity;
public Dragoon()
{
Console.WriteLine("Call derived ctor.");
}
public override void CalcPoints()
{
int age = Calcpoints(10, 40);//calculates charactersm age.
int life = Calcpoints(10, 100);//calculating life points
Console.WriteLine(Name + " has {0} life points.", life);
}
}
public class CharTest
{
private string race;
public CharTest(string Test)
{
Race = Test;// constructor
}
public string Race
{
get
{
return race;
}
set
{
race = value;
}
}
public void DisplayMessage()
{
Console.WriteLine("Your Race\n{0}!",
Race);
}
}