Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The atoms of different elements have different numbers of protons, neutrons and electrons. Electrons are negatively charged, protons are positively charged, and neutrons have no

The atoms of different elements have different numbers of protons, neutrons and electrons. Electrons are negatively charged, protons are positively charged, and neutrons have no charge.

In Java, a definition for an atom class that contains:

  1. fields for storing the numbers of protons, neutrons and electrons with appropriate visibility;
  2. setter and getter methods for manipulating these fields, ensuring that the minimum value for electrons and protons is 1, and the minimum value for neutrons is 0 [Make use of if statement];
  3. a constructor that initializes new objects of atom to be the smallest element (Hydrogen), for which the number ofprotonsis 1, the number ofneutrons is 0, and the number of electrons is 1.
  4. a new method for the atom class called isIon that will return true or false, depending upon whether the atom is an ion. An atom is an ion if it is charged (i.e., if the number of electrons the number of protons).
  5. a new method for the atom class called getAtomicMassNumber that will calculate and return the atomic mass number of the atom. Atomic mass number of an atom is defined as the number of protons plus the number of neutrons.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

Define and explain the different branding alternatives.

Answered: 1 week ago