You will notice that a class named PeriodicTable has been provided to you. Inside the class is a static, two-dimensional array of strings named ELEMENTS that contains information about every element in the periodic table, so: ELEMENTS[0] is { "1", "Hydrogen", "H", "1.007" }; ELEMENTS[1] is { "2", "Helium", "He", "4.002" } and so on ... Add a static method to this class that uses the array to build a data structure of elements such that it is fast and easy to find an element using only its symbol. Your method should match the following signature, but replace DataStructure with your chosen data structure. public static DataStructure makeFastPeriodicTable() {} Hint: you can use the Integer.parseInt("2") and Double.parseDouble("1.23") methods to create numeric values from strings. _____________________________________________________ public class PeriodicTable { public static final String[][] ELEMENTS = { { "1", "Hydrogen", "H", "1.007" }, { "2", "Helium", "He", "4.002" }, { "3", "Lithium", "Li", "6.941" }, { "4", "Beryllium", "Be", "9.012" }, { "5", "Boron", "B", "10.811" }, { "6", "Carbon", "C", "12.011" }, { "7", "Nitrogen", "N", "14.007" }, { "8", "Oxygen", "O", "15.999" }, { "9", "Fluorine", "F", "18.998" }, { "10", "Neon", "Ne", "20.18" }, { "11", "Sodium", "Na", "22.99" }, { "12", "Magnesium", "Mg", "24.305" }, { "13", "Aluminum", "Al", "26.982" }, { "14", "Silicon", "Si", "28.086" }, { "15", "Phosphorus", "P", "30.974" }, { "16", "Sulfur", "S", "32.065" }, { "17", "Chlorine", "Cl", "35.453" }, { "18", "Argon", "Ar", "39.948" }, { "19", "Potassium", "K", "39.098" }, { "20", "Calcium", "Ca", "40.078" }, { "21", "Scandium", "Sc", "44.956" }, { "22", "Titanium", "Ti", "47.867" }, { "23", "Vanadium", "V", "50.942" }, { "24", "Chromium", "Cr", "51.996" }, { "25", "Manganese", "Mn", "54.938" }, { "26", "Iron", "Fe", "55.845" }, { "27", "Cobalt", "Co", "58.933" }, { "28", "Nickel", "Ni", "58.693" }, { "29", "Copper", "Cu", "63.546" }, { "30", "Zinc", "Zn", "65.38" }, { "31", "Gallium", "Ga", "69.723" }, { "32", "Germanium", "Ge", "72.64" }, { "33", "Arsenic", "As", "74.922" }, { "34", "Selenium", "Se", "78.96" }, { "35", "Bromine", "Br", "79.904" }, { "36", "Krypton", "Kr", "83.798" }, { "37", "Rubidium", "Rb", "85.468" }, { "38", "Strontium", "Sr", "87.62" }, { "39", "Yttrium", "Y", "88.906" }, { "40", "Zirconium", "Zr", "91.224" }, { "41", "Niobium", "Nb", "92.906" }, { "42", "Molybdenum", "Mo", "95.96" }, { "43", "Technetium", "Tc", "98" }, { "44", "Ruthenium", "Ru", "101.07" }, { "45", "Rhodium", "Rh", "102.906
You will notice that a class named PeriodicTable has been provided to you.
Inside the class is a static, two-dimensional array
of strings named ELEMENTS that contains information about every element in the
periodic table, so:
ELEMENTS[0] is { "1", "Hydrogen", "H", "1.007" };
ELEMENTS[1] is { "2", "Helium", "He", "4.002" } and so on ...
Add a static method to this class that uses the array to build a data
structure of elements such that it is fast and easy to find an element using
only its symbol. Your method should match the following signature, but replace
DataStructure with your chosen data structure.
public static DataStructure makeFastPeriodicTable() {}
Hint: you can use the Integer.parseInt("2") and Double.parseDouble("1.23")
methods to create numeric values from strings.
_____________________________________________________
public class PeriodicTable {
public static final String[][] ELEMENTS = {
{ "1", "Hydrogen", "H", "1.007" },
{ "2", "Helium", "He", "4.002" },
{ "3", "Lithium", "Li", "6.941" },
{ "4", "Beryllium", "Be", "9.012" },
{ "5", "Boron", "B", "10.811" },
{ "6", "Carbon", "C", "12.011" },
{ "7", "Nitrogen", "N", "14.007" },
{ "8", "Oxygen", "O", "15.999" },
{ "9", "Fluorine", "F", "18.998" },
{ "10", "Neon", "Ne", "20.18" },
{ "11", "Sodium", "Na", "22.99" },
{ "12", "Magnesium", "Mg", "24.305" },
{ "13", "Aluminum", "Al", "26.982" },
{ "14", "Silicon", "Si", "28.086" },
{ "15", "Phosphorus", "P", "30.974" },
{ "16", "Sulfur", "S", "32.065" },
{ "17", "Chlorine", "Cl", "35.453" },
{ "18", "Argon", "Ar", "39.948" },
{ "19", "Potassium", "K", "39.098" },
{ "20", "Calcium", "Ca", "40.078" },
{ "21", "Scandium", "Sc", "44.956" },
{ "22", "Titanium", "Ti", "47.867" },
{ "23", "Vanadium", "V", "50.942" },
{ "24", "Chromium", "Cr", "51.996" },
{ "25", "Manganese", "Mn", "54.938" },
{ "26", "Iron", "Fe", "55.845" },
{ "27", "Cobalt", "Co", "58.933" },
{ "28", "Nickel", "Ni", "58.693" },
{ "29", "Copper", "Cu", "63.546" },
{ "30", "Zinc", "Zn", "65.38" },
{ "31", "Gallium", "Ga", "69.723" },
{ "32", "Germanium", "Ge", "72.64" },
{ "33", "Arsenic", "As", "74.922" },
{ "34", "Selenium", "Se", "78.96" },
{ "35", "Bromine", "Br", "79.904" },
{ "36", "Krypton", "Kr", "83.798" },
{ "37", "Rubidium", "Rb", "85.468" },
{ "38", "Strontium", "Sr", "87.62" },
{ "39", "Yttrium", "Y", "88.906" },
{ "40", "Zirconium", "Zr", "91.224" },
{ "41", "Niobium", "Nb", "92.906" },
{ "42", "Molybdenum", "Mo", "95.96" },
{ "43", "Technetium", "Tc", "98" },
{ "44", "Ruthenium", "Ru", "101.07" },
{ "45", "Rhodium", "Rh", "102.906" },
}
Step by step
Solved in 2 steps with 1 images