Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Q1: There are different kinds of atoms with having neutrons, protons and electrons with their specific atomic mass asses. Hydrogen is one of them.
Q1: There are different kinds of atoms with having neutrons, protons and electrons with their specific atomic mass asses. Hydrogen is one of them. [4 marks] A) In Java 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. (i) (ii) (iii) Aparameterized 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. B) Write a new method for the atom class called islon 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). C) 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. Q2: Write a class named Sorting with sort function in order to sort the following array as pakistan Call sort function in main function. [4 marks] char[] p= {'a'. p'..k.t.a'.n'.'s'}; Output as = pakistan Q3: Write a class with name ArrayDemo. This class has an array which should be initialized by user. write a function with name numFind in this class with working logic as to find the mid number of an array. After finding this number calculate its factorial and display it.Don't use / operator. [4 marks]
Step by Step Solution
★★★★★
3.27 Rating (147 Votes )
There are 3 Steps involved in it
Step: 1
Question 1 Question 2 Question 3 Answer Step 1 Required Electrons are negatively charged protons are ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started