Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Database And Expert Systems Applications 31st International Conference Dexa 2020 Bratislava Slovakia September 14 17 2020 Proceedings Part 1 Lncs 12391

Authors: Sven Hartmann ,Josef Kung ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

303059002X, 978-3030590024

More Books

Students also viewed these Databases questions

Question

5. Develop a self-management module for a training program.

Answered: 1 week ago