Atom - } int getElectrons() { return electrons; //returns...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
package lab02; p public class Atom { p private int protons; private int neutrons; private int electrons; p public Atom(int givenProtons, int givenNeutrons, int givenElectrons) { protons = givenProtons; neutrons = givenNeutrons; electrons = givenElectrons; e } int getProtons() { return protons;//returns number of protons } int getNeutrons() { return neutrons;//returns number of neutrons
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } int getElectrons() { return electrons; //returns number of electrons } int getAtomicMassNumber() { return (protons + neutrons); //returns total number of protons and neutrons } int getAtomicCharge() { return (protons - electrons); // returns the difference between the number of protons and electrons } }...
View Full Document

This note was uploaded on 09/20/2011 for the course COM SCI 227 taught by Professor Staff during the Spring '11 term at Iowa State.

Ask a homework question - tutors are online