Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace ConsoleApplication15
- {
- class Program
- {
- static void Main(string[] args)
- {
- Chem_prvek P1 = new Chem_prvek();
- Console.WriteLine("Zadejte prvek: ");
- P1.ZNAK = Convert.ToString(Console.ReadLine());
- Console.WriteLine("Zadej počet protonů");
- P1.P_CISLO = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Zadej počet nuklidů:");
- P1.N_CISLO = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine(P1.info());
- Console.ReadKey();
- }
- }
- }
- namespace ConsoleApplication15
- {
- class Chem_prvek
- {
- string znak;
- int p_cislo;
- int n_cislo;
- public Chem_prvek()
- {
- }
- public string ZNAK
- {
- get
- {
- return znak;
- }
- set
- {
- znak = value;
- }
- }
- public int P_CISLO
- {
- get
- {
- return p_cislo;
- }
- set
- {
- p_cislo = value;
- }
- }
- public int N_CISLO
- {
- get
- {
- return n_cislo;
- }
- set
- {
- n_cislo = value;
- }
- }
- public string info()
- {
- return string.Format("Zadali jste prvek {0}, který má {1} protonů, {2} neutronů a {3} elektronů",znak,p_cislo,n_cislo-p_cislo,n_cislo-p_cislo);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement