我需要帮助来创建一个程序,该程序可以显示任何原子及其组件(中子、质子、电子和化学反应)的层次结构这是我到目前为止所做的代码,作为该主题的新手
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Atoms
{
public class Atoms
{
protected string name = "Sodium";
protected string element ="Metal";
public virtual void GetInfo()
{
Console.WriteLine("name: {0}",name);
Console.WriteLine("element: {0}", element);
}
}
class Proton : Atoms
{
public int number = 11 ;
public override void GetInfo()
{
base.GetInfo();
Console.WriteLine("Proton number: {0}",number);
}
}
class Electron : Atoms
{
public int number = 11;
public override void GetInfo()
{
base.GetInfo();
Console.WriteLine("Electron number: {0}", number);
}
class Neutrons : Atoms
{
public int number = 12;
public override void GetInfo()
{
base.GetInfo();
Console.WriteLine("Neutron number: {0}", number);
}
class TestClass
{
static void Main()
{
Proton P = new Proton();
P.GetInfo();
Neutrons N = new Neutrons();
N.GetInfo();
Electron E = new Electron();
E.GetInfo();
Console.WriteLine("click any key to exit");
Console.ReadLine();
}
}
}
}
}