You will create another class PeriodicTable that will contain an ArrayList of Element objects and will return information about the elements. This class will also have a method that will calculate the molecular mass of compound substances using informatio
Lab 11
File I/O, Lists
Set Up Create a new Java project in your Eclipse workspace named: Lab11 In the src folder, create a package named: edu.ilstu.it275.lab11.<ulid>
Requirements:
Remember the periodic table with all the known chemical elements you
learned about in your chemistry class? This program will create a class
Element that represents an element from that periodic table. Elements are
chemical substances that cannot be broken down further into other
substances by chemical or physical means.
You will create another class PeriodicTable that will contain an ArrayList of
Element objects and will return information about the elements. This class
will also have a method that will calculate the molecular mass of compound
substances using information from your ArrayList of Element objects.
You will create an application class that will return information about the
chemical elements. Input:
A .csv file containing information for a list of chemical elements is provided.
The first row of the file contains column names, and the rest are properties
for each element. To read input from a .csv file, your program will read a full
row of data and separate each data for loading into fields in your Element
object. (Hint: use the String method split()). Design
Element class
This class will have fields matching all the field from the input file – chemical
name, atomic number, symbol, boiling point, melting point, density and
molecular/atomic weight. There should be getters for all fields, and a
toString() method that displays all the information about the element
properly labeled.
PeriodicTable class
This class will have an ArrayList of Element objects.
1 This class will have the following methods: default constructor that will create the empty ArrayList a method that will accept the String filename for the csv file and read
all the data into the Element object in the ArrayList a method that will return the Element object with the highest boiling
point a method that will return the Element object with the lowest melting
point
PeriodicTableApp class
This class will have a main method that exercises the methods contained
within the PeriodicTable class. 2
10 years ago