Question: In this Short Assignment, you will be initiating a class for Atomic Particles. You will be instantiating the following fields: 1 ) The name of

In this Short Assignment, you will be initiating a class for Atomic Particles.
You will be instantiating the following fields:
1) The name of the atom as a string, "particleName".
2) The atomic weight of the particle as a double, "particleWeight".
3) The number of protons as an integer, "protons".
4) The number of neutrons as an integer, "neutrons".
5) The speed of the neutron as a double, "particleSpeed".
6) The x-coordinate of the particle as a double, "x".
7) The y-coordinate of the particle as a double, "y".
8) The distance from the origin (0,0) as a double, "magnitude".
The constructor will take each of the fields above as parameters.
You will be instantiating getters and mutators for each of the fields above.
The getters should return the type that the field is. The mutators should return void.
Naming should be as follows:
For getters: "get" + field name i.e. "getProtons".
For setters: "set" + field name i.e. "setProtons".
There should be 16 methods in total, 17 including the constructor. All should be public.
You should add one function called "collision" that returns void. It takes in another particle as an input and subtracts the speed of the input particle from the particle it is called from.
You should add another function called "calculateMagnitude" that will find a particle's distance from the origin. Whenever a particle's x and y coordinates are changed, the magnitude should be recalculated and updated. The "calculateMagnitude" function should return a double. Write in C++ please.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!