object oriented programming language 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 an object oriented programming language of your choice, write a definition for an atom class that contains:   fields for storing the numbers of protons, neutrons and electrons with appropriate visibility;   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;   a constructor that initializes new objects of atom to be the smallest element (Hydrogen), for which the number of protons is 1, the number of neutrons is 0, and the number of electrons is 1.   Write 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).     Write 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 (often denoted A) is defined as the number of protons plus the number of neutrons.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 2GZ
icon
Related questions
Question

object oriented programming language

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.

 

  1. In an object oriented programming language of your choice, write a definition for an atom class that contains:

 

  • fields for storing the numbers of protons, neutrons and electrons with appropriate visibility;

 

  • 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;

 

  • a constructor that initializes new objects of atom to be the smallest element (Hydrogen), for which the number of protons is 1, the number of neutrons is 0, and the number of electrons is 1.

 

  1. Write 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).

 

 

  1. Write 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 (often denoted A) is defined as the number of protons plus the number of neutrons.

 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,