Write a program (in Java) that will calculate the grams of a molecule according
ID: 3717090 • Letter: W
Question
Write a program (in Java) that will calculate the grams of a molecule according to given moles. Create three classes that will successfully run. User will need to input an element or a molecular compound and program will output the number of weight of the entered input to grams per mole. For example, when a user enters H (hydrogen), program should print out 1.0079 in grams per mole. If user enters more than one element, program should be able to calculate the formula for their molecular weight. For example, H2O (dihydrogen monoxide) should be calculated together to total to 18.01528 g/mol.
Explanation / Answer
Here is what you want. But You have to provide input elements by dot i.e. for H2O provide input H2.O because In certain cases like NaCl we will not be able to distinguish wheather C is for carbon or It is a part of Cl.
You will need a table for molecular weights. Table is attached at the end
elements.csv
H,1.01
He,4
Li,6.94
Be,9.01
B,10.81
C,12.01
N,14.01
O,16
F,19
Ne,20.18
Na,22.99
Mg,24.31
Al,26.98
Si,28.09
P,30.98
S,32.06
Cl,35.45
Ar,39.95
K,39.1
Ca,40.08
Sc,44.96
Ti,47.9
V,50.94
Cr,52
Mn,54.94
Fe,55.85
Co,58.93
Ni,58.71
Cu,63.54
Zn,65.37
Ga,69.72
Ge,72.59
As,74.99
Se,78.96
Br,79.91
Kr,83.8
Rb,85.47
Sr,87.62
Y,88.91
Zr,91.22
Nb,92.91
Mo,95.94
Tc,96.91
Ru,101.07
Rh,102.9
Pd,106.4
Ag,107.87
Cd,112.4
In,114.82
Sn,118.69
Sb,121.75
Te,127.6
I,126.9
Xe,131.3
Cs,132.9
Ba,137.34
La,138.91
Ce,140.12
Pr,140.91
Nd,144.24
Pm,144.91
Sm,150.35
Eu,151.96
Gd,157.25
Tb,158.92
Dy,162.5
Ho,164.93
Er,167.26
Tm,168.93
Yb,173.04
Lu,174.97
Hf,178.49
Ta,180.95
W,183.85
Re,186.2
Os,190.2
Ir,192.22
Pt,195.09
Au,196.97
Hg,200.59
Tl,204.37
Pb,207.19
Bi,208.98
Po,208.98
At,209.99
Rn,222.02
Fr,223.02
Ra,226
Ac,227.03
Th,232.04
Pa,231.04
U,238.03
Np,237
Pu,242
Am,243.06
Cm,247.07
Bk,247.07
Cf,251.08
Es,254.09
Fm,257.1
Md,257.1
No,255.09
Lr,256.1
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.