Click here to Skip to main content
15,891,906 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
We were given this project to do, it was said to be simple but we've only been doing c# for a week, hope someone can help...

It's not that i didn't try!!! i did but it did not work...the code i typed is at the bottom..please see if you can improve this..

Everything is public:
We have to create a Main Class called Mutant which has to be abstract--this contains : CodeName(String),Level(int), DangerQuotient(int & abstract) and DisplayInfo

The other 3 classes are called: PsychicMutant--this contains: IQ(int), UsageCount(int) and DangerQuotient()

PhysicalMutant--this contains: IQ(int),Strenght(int) and DangerQuotient()

ElementalMutant--this contains: Region(int), DangerQuotient()

There are formulas that work out the Danger Quotient for each class but i can do that lol

All this is linked to an interface called IDisplayable which contains (public DisplayInfo())

Please Help....I would really appreciate it Thanks

//Code That i did!

==Interface Class==

interface IDisplayable
{
void DisplayInfo();
}


==Mutant Class==

abstract class Mutant:IDisplayable
{
static void Main (String[]args)
{
public string CodeName;
public int Level;

void DisplayInfo();

abstract int DangerQuotient();
}
}


==Psychic Mutant Class==

class PsychicMutant:Mutant
{
public int IQ;
public int UsageCount;

public int DangerQuotient()
{
//Formula goes here
}


==Physical Mutant Class==

class PhysicalMutant:Mutant
{
public int IQ;
public int Strenght;

public int DangerQuotient()
{
//Formula goes here
}


==Elemental Mutant Class==

class ElementalMutant:Mutant
{
public int Region;


public int DangerQuotient()
{
//Formula goes here
}



P.S i asked for help only or even guidelines, i really did not expect 2 get the answer. I am a hard worker 2 and this was my last resort....Sorry if i gave the wrong impression
Posted
Updated 21-Apr-11 3:44am
v2

1 solution

0) "Doesn't work" doesn't tell us ANYTHING.

1) None of your classes or interfaces are public, and they should be.

2) You could put the IQ and Strength (misspelled in your code) properties into the base Mutant class since all of the derived classes are going to need it.

3) I think it would be better to make DangerQuotient virtualminstead of abstract. It would then perform a standard calculation that the programmer can override in derived classed.

4) What does UML have to do with this? UML is a massive waste of time for small projects with few team members.
 
Share this answer
 
v2
Comments
Member 7861443 21-Apr-11 10:01am    
The project is in a UML format. DangerQuotient has to be abstract and we can't change it otherwise i would have did what you said. We doing this on a Console App...
Marc A. Brown 21-Apr-11 10:36am    
Try making your classes/interfaces public as John suggested in #1. Then report back if it still doesn't work and be specific. We need warning/error messages and what code they're related to if you want good help.
Marc A. Brown 21-Apr-11 10:35am    
You're right about UML, but if this is a school project (sounds like it is to me), it doesn't matter whether it's a waste of time if it's a requirement. :) I think you're on the money with #1. The OP needs to make that change and report back specifics of any remaining issues.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900