Answered step by step
Verified Expert Solution
Question
1 Approved Answer
code in C#, please ans thank you The Atom class This is the front end of the application. There are 12 members. Description of class
code in C#, please ans thank you
The Atom class This is the front end of the application. There are 12 members. Description of class members Properties: Some common decorators for class All properties are public and auto-implemented. members Name - this public property is a string representing the + public UIPAC name of this atom. # protected private Symbol - this public property is a two letter string $ class member (static) representing the name of this atom that is used in chemistry. Proton - this public property is an int representing the number of protons in the nucleus of this atom. This is also known as the atomic number of this atom. Neutron - this public property is an int representing the number of neutrons in the nucleus of this atom. Constructor: There are two constructors for this class: public tan() - This is a default constructor that is necessary for serialication. public Aton(string name, int proton, int neutron, double weight, string syabol) - This constructor assigns the arguments to the appropriate properties. Methods public static Aton parce(string 1ine) - This is a public class method that takes a string and returns an Atom object. The argument is one string that is comprised of the five fields of this object. It does the following: - It uses the splitif) method to parse the You must throw an exception if the argument into five parts. argument cannot be parsed to exactly - If the argument does not yield five parts then flve parts. throw an exception. - Otherwise create an Atom object and initialize This may be implemented afterwards. the fields with the appropriate parts. To generate an exception, edit the last - Return the above object lines that loads the atoms to: You will need to examine the arguments to decide eleveotinddf(cterveacre("Hassium what part will be assign to which field. 103169277 Hs Extra Tokens")); public override string Testripef) - This is a public method overrides the corresponding method in the object class to return a stcigeff form of the object. Try to keep the output on a single line. Test Harness Insert the following code statements in your eagcorsfile: W/add the following statemeot in klobal scopen Yra croate a collection to work with static (Ist3.46.941.LI)); ; elements. Add (Atom. Parse("Beryl11un 45 9.e122. Be*)); elements Add (Atom. Parse ("Boron 5618.811B) ); elements Add (Atom. Parse ("Carbon 6 6 6 12.e1e7 C)); elements Add (Atom. Parse ("Nitrogen 77.14. ee67 N) )); elements.Add(Atom. Parse("Oxygen 8815.99940) ); elements.Add (Atos. Parse ("fluorine 910.18.9984F) ); elements. Add(Aton. Parse("Neon 1010.26.1797Ne) ); elenents.Add(Atoe.Parse ("Sodiun 11.12.22.9897Na) ); elements. Mdd (Aton, Parse("Magnesiun 12.12.24.305Mg)); elements.add (Aton. Parse (*Aluminun 131426.9815Al) )); elementr Add(Aton.Parse("S111con.14.14.28.es55 51) ); elements. Add (Atoe. Parse ("Phosphorus 15,16:30.9738P) ): elements.Add(Aton. Parse ("Sulfur 161632.9655) ); elements.Add (Aton, Parse("Chlorine 17.18.35.453Cl) ); elements.Add(Aton, Parse ("Potassiun 192039.0983K) ); elemnnts. Add (Aton. Parse ("Argon 182239.948dc1) ): elements. Add (Atom. Parse ("Calcium 20.2040.978Ca)); elements add (Aton. Parse ("Scandium 2124.44.9559sc) )); elements_AdA(Atoo. Parse("Titanive 22.26.47.857TA )) ; elements. Add(Aton. Parse ("Vanadiun 2328.50.9415V) ); elements.Add (Aton. Parse("Chromiun 24.28 . 51.9961Cr) ); elements.Add (Atom. Parse ("Iron 2630.55.845.Fe )) ) elements add (Aton. Parse( Nickel 283158.6934Ni) ); elements. Add (Atom. Parse("Cobalt 273258.9332Co)); elemente.Add(Aton. Parse("Copper 293563.546Cu) ); elomonts. Add (Aton. Parse ("zinc 3035.65.39Zn)); elements.add (Atom. Parse("Ga11iun 31.39.69.7236a )) ; elements.Add(Atos. Parse("Geraaniun 32.41.72.64Ge) ); element. Add (Aton. Parse("Arsenic 3342.74.9216As) )); elements. Add (Aton. Parse("Seleniun 34.4578.96Se) ); elements. Add (Aton. Parse( Bronine 35.45.79.904Br) )); elements. Add (Aton. Parse ("Krypton 36 43 83.8kr) ); elements. Add(Aton. Parse ("Strontiun 385087.62Sr )) ; elemente.Add (Atos. Parse("yttriun 395088.9259Y) )); elements. Add (Aton.Parse("zirconiun 405191.224Zr))); elenents. Adat(Aton. Parse("NIobiun 41 52.92.9064Nb )) ; elements. Add (Aton. Parse("Molybdenun 42.5495.94Mo) ); elements. AdA (Aton. Parse ("Technetiun 4355.98Tc) ); elements. Add (Atoe. Parse("Rutheniun 44 57 101.97mu) ); eleeents. Add (Atom. Parse("Rhodiun 4558102.9055kh))); elements. Add (Aton. Parse("Palladiun 46 .6e 1e6,42 Pd")); elements. Add (Atom. Parse("Silver 4761 1e7.8682. Ag")); elements Add (Atom. Parse("Cadniun 48 64.112,411 Cd)); elements. Add (Atoo. Parse( Indiun 4966114.813 In ) ); elenents. dedd(Atom. Parse("Tin 50 69118.71.5n)); elements. Add (Aton. Parse("Antinony 5171 121.76 5b) ); elements Add (Atoi. Parse ("Iodine 53.74126.90451) ); elements Add (Atom, Parse("Telluriun 52.76127 .6 Tef")); elements Add(Aton. Parse("Xenon 54.77.131.293e)); eleppats Add (Aton.Parse ("Cesiun 55:78132.925Cs)) ); elepents Add(Aton. Parse("Barium 56.81137.327.8a) ); elements. Add (Aton. Parse("Lanthanun 57.82138.9955La )) ; elements Add (Atom. Parse("Ceriun St 82.140.116Ce) ); elements. Add (Atom, Parse("Praseodyelun 59 \$2 140.9077.Pr )) ; elaments.Add(Atom. Parse(" Meodynlun 60.84144.24Nd)); elemente Add(Aton. Parse ("Promethiun 6184145Pm )) ; elements. Add (Aton. Parse("Sanariun 6288150.36Sm)) ; elements Add (Aton. Parse("Europium 6389151.964Eu))); elements.Add(Atom.Parse("Gadolniun 6493157.25Gd4) )); elements.Add (Aton.Parse ("Terbium 6594158.9253Tb)) ; elements.Add (Atom.Parse ("Dysprosium 6697162.5 Dy") ) ; 2 ) elennnts. Add (Atom. Parse("Holmium 6798164.9303Ho)); elements.Add(Atom. Parse("Erbium 6899167.259Er)); elements Add (Aton. Parse("Thulium 69100168.9342Tn )) ; elemente.Add (Aton. Parse("Lutetiun 71184174.967(v ))); elements_Add(Atom. Parse("Hafnium 72106178.49 Hf")); elements.Add (Atom.Parse("Tantalun 73108180.9479Ta") )); elements. Add (Aton. Parse("Tungsten 74110183.84K)); elements.Add(Aton.Parse("Rheniun 75 111186.207Re))); elemente_.Add (Atom. Parse ("Osmium 76114190.23os2 )); elements.Add(Aton. Parse("Iridium 77115192.217Ir)) ; elementis.Add(Atom. Parse ("Platinun 78117195.078 Pt")); elements Add (Aton.Parse("Gold 79118196.9665Au* )); elements.Add(Atom. Parse("Mercury 80121200.59Hg)); elements. Add (Aton. Parse ("Thal11un 81123204.3833T1))); elements.Add (Atom. Parse ("Lead 82125207.2Pb )); elements.Add (Aton. Parse("Bismuth 83126208,980441Bi) ); elements. Add (Aton. Parse("Poloniun 84125209Po )) ; elemente.Add (Aton. Parse("Radon 86136222Rn") )); elements. Add(Atom. Parse("Francium 87136223Fr )) ; elements. Add (Aton. Parse("Radiun 88138226Ra)); elements Add (Aton. Parse("Actinium 89138227AC)); elements.Add (Atos. Parse ("Protactiniun 91140231.0359Pa)); elemente Add (Aton. Parse("Thoriun 90142232.0381 Th") 1 ); elements AdA( (Aton. Parse("Neptunium 93144237Np)); elements.Add(Aton. Parse("Uranium 92146238.0289 U )); elements Add (Aton. Parse ("Americium 95148243Am)); elements. Add (Atom. Parse("Plutonium 94150244Pu)); elements. Add (Aton. Parse ("Curiun 96151247(cm)); elements Add(Atom. Parse ("Berkelium 97150247 BK )); elements Add (Aton. Parse ("Californiun 98153251(f) ); elements add (Aton. Parse("Einsteiniun 99153252Es)); elements. Add (Atom. Parse("Ferniun 100157257Fm )) ; elements. Add (Atom. Parse("Mendelevium 101157258Md)); elements. Add(Atom. Parse ("Nobeliun 102157259 No")); elements Add (Atom. Parse ("Rutherfordium 104157261Rf )); elements Add( (Aton. Parse ("Lavrencius 103159262Lr))); elements. Add (Aton. Parse ("Dubniun 105 157 262 Db")); elementes. Add (Atom. Parse("Bohrium 187157264 Bh")); elements Add(Atom. Parse("Seaborgiun 106160266 Sg ") ); elements. Add (Aton. Parse("Meitnerius 109159268Nt)); elements. Add (Atom. Parse("Hassiun 108169277Hs )); Create static methods that will do the following and then called them from your main //Create class methods to do the following: Page 4 of 5 Programming II Atoms: libraries, filele isen Serialization //1 - Display all the items in the collection elements //2 - Serialize the first item using json format and save to a suitable file Reminder: To simplify access to the IsenSerializer class, you must install the System.Text.dsen NuGet package //3 - Read the above file and display the item //4 - Serialize the entire collection using json format and save to a suitable file //5 - Read the above file and display all of the items The Atom class This is the front end of the application. There are 12 members. Description of class members Properties: Some common decorators for class All properties are public and auto-implemented. members Name - this public property is a string representing the + public UIPAC name of this atom. # protected private Symbol - this public property is a two letter string $ class member (static) representing the name of this atom that is used in chemistry. Proton - this public property is an int representing the number of protons in the nucleus of this atom. This is also known as the atomic number of this atom. Neutron - this public property is an int representing the number of neutrons in the nucleus of this atom. Constructor: There are two constructors for this class: public tan() - This is a default constructor that is necessary for serialication. public Aton(string name, int proton, int neutron, double weight, string syabol) - This constructor assigns the arguments to the appropriate properties. Methods public static Aton parce(string 1ine) - This is a public class method that takes a string and returns an Atom object. The argument is one string that is comprised of the five fields of this object. It does the following: - It uses the splitif) method to parse the You must throw an exception if the argument into five parts. argument cannot be parsed to exactly - If the argument does not yield five parts then flve parts. throw an exception. - Otherwise create an Atom object and initialize This may be implemented afterwards. the fields with the appropriate parts. To generate an exception, edit the last - Return the above object lines that loads the atoms to: You will need to examine the arguments to decide eleveotinddf(cterveacre("Hassium what part will be assign to which field. 103169277 Hs Extra Tokens")); public override string Testripef) - This is a public method overrides the corresponding method in the object class to return a stcigeff form of the object. Try to keep the output on a single line. Test Harness Insert the following code statements in your eagcorsfile: W/add the following statemeot in klobal scopen Yra croate a collection to work with static (Ist3.46.941.LI)); ; elements. Add (Atom. Parse("Beryl11un 45 9.e122. Be*)); elements Add (Atom. Parse ("Boron 5618.811B) ); elements Add (Atom. Parse ("Carbon 6 6 6 12.e1e7 C)); elements Add (Atom. Parse ("Nitrogen 77.14. ee67 N) )); elements.Add(Atom. Parse("Oxygen 8815.99940) ); elements.Add (Atos. Parse ("fluorine 910.18.9984F) ); elements. Add(Aton. Parse("Neon 1010.26.1797Ne) ); elenents.Add(Atoe.Parse ("Sodiun 11.12.22.9897Na) ); elements. Mdd (Aton, Parse("Magnesiun 12.12.24.305Mg)); elements.add (Aton. Parse (*Aluminun 131426.9815Al) )); elementr Add(Aton.Parse("S111con.14.14.28.es55 51) ); elements. Add (Atoe. Parse ("Phosphorus 15,16:30.9738P) ): elements.Add(Aton. Parse ("Sulfur 161632.9655) ); elements.Add (Aton, Parse("Chlorine 17.18.35.453Cl) ); elements.Add(Aton, Parse ("Potassiun 192039.0983K) ); elemnnts. Add (Aton. Parse ("Argon 182239.948dc1) ): elements. Add (Atom. Parse ("Calcium 20.2040.978Ca)); elements add (Aton. Parse ("Scandium 2124.44.9559sc) )); elements_AdA(Atoo. Parse("Titanive 22.26.47.857TA )) ; elements. Add(Aton. Parse ("Vanadiun 2328.50.9415V) ); elements.Add (Aton. Parse("Chromiun 24.28 . 51.9961Cr) ); elements.Add (Atom. Parse ("Iron 2630.55.845.Fe )) ) elements add (Aton. Parse( Nickel 283158.6934Ni) ); elements. Add (Atom. Parse("Cobalt 273258.9332Co)); elemente.Add(Aton. Parse("Copper 293563.546Cu) ); elomonts. Add (Aton. Parse ("zinc 3035.65.39Zn)); elements.add (Atom. Parse("Ga11iun 31.39.69.7236a )) ; elements.Add(Atos. Parse("Geraaniun 32.41.72.64Ge) ); element. Add (Aton. Parse("Arsenic 3342.74.9216As) )); elements. Add (Aton. Parse("Seleniun 34.4578.96Se) ); elements. Add (Aton. Parse( Bronine 35.45.79.904Br) )); elements. Add (Aton. Parse ("Krypton 36 43 83.8kr) ); elements. Add(Aton. Parse ("Strontiun 385087.62Sr )) ; elemente.Add (Atos. Parse("yttriun 395088.9259Y) )); elements. Add (Aton.Parse("zirconiun 405191.224Zr))); elenents. Adat(Aton. Parse("NIobiun 41 52.92.9064Nb )) ; elements. Add (Aton. Parse("Molybdenun 42.5495.94Mo) ); elements. AdA (Aton. Parse ("Technetiun 4355.98Tc) ); elements. Add (Atoe. Parse("Rutheniun 44 57 101.97mu) ); eleeents. Add (Atom. Parse("Rhodiun 4558102.9055kh))); elements. Add (Aton. Parse("Palladiun 46 .6e 1e6,42 Pd")); elements. Add (Atom. Parse("Silver 4761 1e7.8682. Ag")); elements Add (Atom. Parse("Cadniun 48 64.112,411 Cd)); elements. Add (Atoo. Parse( Indiun 4966114.813 In ) ); elenents. dedd(Atom. Parse("Tin 50 69118.71.5n)); elements. Add (Aton. Parse("Antinony 5171 121.76 5b) ); elements Add (Atoi. Parse ("Iodine 53.74126.90451) ); elements Add (Atom, Parse("Telluriun 52.76127 .6 Tef")); elements Add(Aton. Parse("Xenon 54.77.131.293e)); eleppats Add (Aton.Parse ("Cesiun 55:78132.925Cs)) ); elepents Add(Aton. Parse("Barium 56.81137.327.8a) ); elements. Add (Aton. Parse("Lanthanun 57.82138.9955La )) ; elements Add (Atom. Parse("Ceriun St 82.140.116Ce) ); elements. Add (Atom, Parse("Praseodyelun 59 \$2 140.9077.Pr )) ; elaments.Add(Atom. Parse(" Meodynlun 60.84144.24Nd)); elemente Add(Aton. Parse ("Promethiun 6184145Pm )) ; elements. Add (Aton. Parse("Sanariun 6288150.36Sm)) ; elements Add (Aton. Parse("Europium 6389151.964Eu))); elements.Add(Atom.Parse("Gadolniun 6493157.25Gd4) )); elements.Add (Aton.Parse ("Terbium 6594158.9253Tb)) ; elements.Add (Atom.Parse ("Dysprosium 6697162.5 Dy") ) ; 2 ) elennnts. Add (Atom. Parse("Holmium 6798164.9303Ho)); elements.Add(Atom. Parse("Erbium 6899167.259Er)); elements Add (Aton. Parse("Thulium 69100168.9342Tn )) ; elemente.Add (Aton. Parse("Lutetiun 71184174.967(v ))); elements_Add(Atom. Parse("Hafnium 72106178.49 Hf")); elements.Add (Atom.Parse("Tantalun 73108180.9479Ta") )); elements. Add (Aton. Parse("Tungsten 74110183.84K)); elements.Add(Aton.Parse("Rheniun 75 111186.207Re))); elemente_.Add (Atom. Parse ("Osmium 76114190.23os2 )); elements.Add(Aton. Parse("Iridium 77115192.217Ir)) ; elementis.Add(Atom. Parse ("Platinun 78117195.078 Pt")); elements Add (Aton.Parse("Gold 79118196.9665Au* )); elements.Add(Atom. Parse("Mercury 80121200.59Hg)); elements. Add (Aton. Parse ("Thal11un 81123204.3833T1))); elements.Add (Atom. Parse ("Lead 82125207.2Pb )); elements.Add (Aton. Parse("Bismuth 83126208,980441Bi) ); elements. Add (Aton. Parse("Poloniun 84125209Po )) ; elemente.Add (Aton. Parse("Radon 86136222Rn") )); elements. Add(Atom. Parse("Francium 87136223Fr )) ; elements. Add (Aton. Parse("Radiun 88138226Ra)); elements Add (Aton. Parse("Actinium 89138227AC)); elements.Add (Atos. Parse ("Protactiniun 91140231.0359Pa)); elemente Add (Aton. Parse("Thoriun 90142232.0381 Th") 1 ); elements AdA( (Aton. Parse("Neptunium 93144237Np)); elements.Add(Aton. Parse("Uranium 92146238.0289 U )); elements Add (Aton. Parse ("Americium 95148243Am)); elements. Add (Atom. Parse("Plutonium 94150244Pu)); elements. Add (Aton. Parse ("Curiun 96151247(cm)); elements Add(Atom. Parse ("Berkelium 97150247 BK )); elements Add (Aton. Parse ("Californiun 98153251(f) ); elements add (Aton. Parse("Einsteiniun 99153252Es)); elements. Add (Atom. Parse("Ferniun 100157257Fm )) ; elements. Add (Atom. Parse("Mendelevium 101157258Md)); elements. Add(Atom. Parse ("Nobeliun 102157259 No")); elements Add (Atom. Parse ("Rutherfordium 104157261Rf )); elements Add( (Aton. Parse ("Lavrencius 103159262Lr))); elements. Add (Aton. Parse ("Dubniun 105 157 262 Db")); elementes. Add (Atom. Parse("Bohrium 187157264 Bh")); elements Add(Atom. Parse("Seaborgiun 106160266 Sg ") ); elements. Add (Aton. Parse("Meitnerius 109159268Nt)); elements. Add (Atom. Parse("Hassiun 108169277Hs )); Create static methods that will do the following and then called them from your main //Create class methods to do the following: Page 4 of 5 Programming II Atoms: libraries, filele isen Serialization //1 - Display all the items in the collection elements //2 - Serialize the first item using json format and save to a suitable file Reminder: To simplify access to the IsenSerializer class, you must install the System.Text.dsen NuGet package //3 - Read the above file and display the item //4 - Serialize the entire collection using json format and save to a suitable file //5 - Read the above file and display all of the items Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started