JMU
logoChemicalc.png
The Atom Class


Introduction

Purpose: An immutable encapsulation of an atom.

Details
Attributes:
This class must, at a minimum, contain the following private attributes:

    atomicNumber - An int containing the atomic number (i.e., the number of protons)
    massNumber - An int containing the mass number (i.e., the number of protons and neutrons)
    symbol - A String containing the symbol

The Explicit Value Constructor:
This class must implement the following explicit value constructor:
    /**
     * Explicit Value Constructor
     *
     * @param symbol       The chemical symbol
     * @param atomicNumber The atomic number (number of protons)
     * @param massNumber   The mass number (number of protons and neutrons)
     */
    public Atom(String symbol, int atomicNumber, int massNumber)
    {
    }
    
The equals(Atom) Method:
This class must implement the following method:
    /**
     * Determine if this Atom is identical to another Atom (i.e., the 
     * two have the same number of protons and neutrons)
     *
     * @param  other   The other Atom
     * @return         true if this and other are identical
     */
    public boolean equals(Atom other)
    {
    }
    
Accessors:
This class must implement the following accessors:
    public int getAtomicNumber()
    public int getElectrons()
    public int getMassNumber()
    public int getNeutrons()
    public int getProtons()
    
The toString(boolean) Method:
This class must implement the following method:
    /**
     * Get a String representation of this Atom.
     * The String representation can be either verbose (i.e., can include
     * the mass number) or terse.
     *
     * @param verbose  true to get a verbose version
     * @return         The String 
     */
    public String toString(boolean verbose)
    {
    }
    
The toString() Method:
This class must implement the following method:
    /**
     * Get the normal/default String representation of this Atom.
     *
     * @return         The String 
     */
    public String toString()
    {
    }
    

This method must call the toString(boolean) method.

Copyright 2013