I'm getting
"Error 1 An object reference is required for the non-static field, method, or property 'JWGenetics.Genetics.program()' e:\visual studio 2010\Projects\JWGenetics.cs 50 13 JW Genetics"
on method program.
How do I fix this? I do not want to be passing arg/param.
Code:
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace JWGenetics
{
public class Genetics
{
//create list for sire data
public List<int> siregtype = new List<int>();
//create list for dam data
public List<int> damgtype = new List<int>();
public const int rows = 128;
public const int columns = 7;
// create sire & dam 2D arrays
public int[,] siredata = new int[rows, columns];
public int[,] damdata = new int[rows, columns];
//create offspring 1D array
public int[] offspring = new int[14];
public Dictionary<string, int> colors = new Dictionary<string, int>();
public string color; //name
Dictionary<string, string> geneo = new Dictionary<string, string>();
public string gtype;
// declare color genes groups //
bool extension_normal = false; bool color_normal = false; bool steel = false; bool harlequin = false; bool orange = false; bool tort = false; bool chin = false; bool boolshaded = false;
bool dbldshaded = false; bool himi = false; bool agouti = false; bool tan = false; bool self = false;
// Vienna types flags
bool vienna = false; bool vm = false; bool vc= false;
//color flags
bool brown = false; bool dilute = false; bool charlie = false; bool broken=false; bool rew=false;
// data input holders
public int sen1, sen2, sa1, sa2, sb1, sb2, sc1, sc2, sd1, sd2, se1, se2, sv1, sv2;
public int den1, den2, da1, da2, db1, db2, dc1, dc2, dd1, dd2, de1, de2, dv1, dv2;
// declare counters //
public int sirecounter = 0;
public int damcounter = 0;
public int offspringcounter = 0;
public static bool e_trap;
public static void Main(string[] args)
{
program();
}
public void program()
{
setup_sire();
setup_dam ();
child_setup();
// child_calc(); // determine % of each pheneotype & output to screen
return;
}
public void setup_sire()
{
// populate sire data array //
sire_En_1();
sire_En_2();
sire_A_1();
sire_A_2();
sire_B_1();
sire_B_2();
sire_C_1();
sire_C_2();
sire_D_1();
sire_D_2();
sire_E_1();
sire_E_2();
sire_V_1();
sire_V_2();
sire_data_setup();
return;
}
public void sire_En_1()
{
// Sire's Broken dominant gene var. input sen1 .//
Console.WriteLine("Please input '1' if 'En' or '2' if 'en' for the sire's dominant Broken gene");
string line = Console.ReadLine(); // read string from console
bool res1 = int.TryParse(line, out sen1);// try to parse the string as an integer
if (res1 == true)
{
switch (sen1)
{
case 1:
case 2:
e_trap = false;
break;
default:
e_trap = true;
break;
}
}
// loop untill no error
while (e_trap == true)
{
input_err();
Console.WriteLine("Please input '1' if 'En' or '2' if 'en' for the sire's dominant Broken gene");
string line2 = Console.ReadLine(); // read string from console
bool res2 = int.TryParse(line2, out sen1); // try to parse the string as an integer
if (res2 == true)
{
if (sen1 == 1 || sen1 == 2)
{ e_trap = false; }
}
}
// end of error trap
e_trap = true;
return;
}