final+project

import java.util.Scanner; //inports the scanner /**FinalProjectPartIV


 * @author Danny Fell



public class FinalProjectPartIV { public static void main(String[] args) {

System.out.println ("Input the elemental symbol you would like to know the mass of"); // asks user for elemental symbol

Scanner kbd = new Scanner(System.in); // has keyboard read input

String elementalSymbol = kbd.nextLine; //sets keyboard to what is typed in

double atomicMass = 0; //establishes the atomic mass variable

//names the elemental symbols and the atomic mass of each of them

if (elementalSymbol.equals("H")) {

atomicMass = 1.008; }

else if (elementalSymbol.equals("He")) {

atomicMass = 4.003; }

else if (elementalSymbol.equals("Li")) {

atomicMass = 6.941; }

else if (elementalSymbol.equals("Be")) {

atomicMass = 9.012; }

else if (elementalSymbol.equals("B")) {

atomicMass = 10.81; }

else if (elementalSymbol.equals("C")) {

atomicMass = 12.01; }

else if (elementalSymbol.equals("N")) {

atomicMass = 14.01; }

else if (elementalSymbol.equals("O")) {

atomicMass = 16.00; }

else if (elementalSymbol.equals("F")) {

atomicMass = 19.00; }

else if (elementalSymbol.equals("Ne")) {

atomicMass = 20.18; }

else if (elementalSymbol.equals("Na")) {

atomicMass = 22.99; }

else if (elementalSymbol.equals("Mg")) {

atomicMass = 24.31; }

else if (elementalSymbol.equals("Al")) {

atomicMass = 26.98; }

else if (elementalSymbol.equals("Si")) {

atomicMass = 28.09; }

else if (elementalSymbol.equals("P")) {

atomicMass = 30.97; }

else if (elementalSymbol.equals("S")) {

atomicMass = 32.07; }

else if (elementalSymbol.equals("Cl")) {

atomicMass = 35.45; }

else if (elementalSymbol.equals("Ar")) {

atomicMass = 39.95; }

else if (elementalSymbol.equals("K")) {

atomicMass = 39.10; }

else if (elementalSymbol.equals("Ca")) {

atomicMass = 40.08; }

else if (elementalSymbol.equals("Sc")) {

atomicMass = 44.96; }

else if (elementalSymbol.equals("Ti")) {

atomicMass = 47.87; }

else if (elementalSymbol.equals("V")) {

atomicMass = 50.94; }

else if (elementalSymbol.equals("Cr")) {

atomicMass = 52.00; }

else if (elementalSymbol.equals("Mn")) {

atomicMass = 54.94; }

else if (elementalSymbol.equals("Fe")) {

atomicMass = 55.85; }

else if (elementalSymbol.equals("Co")) {

atomicMass = 58.93; }

else if (elementalSymbol.equals("Ni")) {

atomicMass = 58.69; }

else if (elementalSymbol.equals("Cu")) {

atomicMass = 63.55; }

else if (elementalSymbol.equals("Zn")) {

atomicMass = 65.39; }

else if (elementalSymbol.equals("Ga")) {

atomicMass = 69.72; }

else if (elementalSymbol.equals("Ge")) {

atomicMass = 72.64; }

else if (elementalSymbol.equals("As")) {

atomicMass = 74.92; }

else if (elementalSymbol.equals("Se")) {

atomicMass = 78.96; }

else if (elementalSymbol.equals("Br")) {

atomicMass = 79.90; }

else if (elementalSymbol.equals("Kr")) {

atomicMass = 83.80; }

else if (elementalSymbol.equals("Rb")) {

atomicMass = 85.47; }

else if (elementalSymbol.equals("Sr")) {

atomicMass = 87.62; }

else if (elementalSymbol.equals("Y")) {

atomicMass = 88.91; }

else if (elementalSymbol.equals("Zr")) {

atomicMass = 91.22; }

else if (elementalSymbol.equals("Nb")) {

atomicMass = 92.91; }

else if (elementalSymbol.equals("Mo")) {

atomicMass = 95.94; }

else if (elementalSymbol.equals("Tc")) {

atomicMass = 98; }

else if (elementalSymbol.equals("Ru")) {

atomicMass = 101.1; }

else if (elementalSymbol.equals("Rh")) {

atomicMass = 102.9; }

else if (elementalSymbol.equals("Pd")) {

atomicMass = 106.4; }

else if (elementalSymbol.equals("Ag")) {

atomicMass = 107.9; }

else if (elementalSymbol.equals("Cd")) {

atomicMass = 112.4; }

else if (elementalSymbol.equals("In")) {

atomicMass = 114.8; }

else if (elementalSymbol.equals("Sn")) {

atomicMass = 118.7; }

else if (elementalSymbol.equals("Sb")) {

atomicMass = 121.8; }

else if (elementalSymbol.equals("Te")) {

atomicMass = 127.6; }

else if (elementalSymbol.equals("I")) {

atomicMass = 126.9; }

else if (elementalSymbol.equals("Xe")) {

atomicMass = 131.3; }

else if (elementalSymbol.equals("Cs")) {

atomicMass = 132.9; }

else if (elementalSymbol.equals("Ba")) {

atomicMass = 137.3; }

else if (elementalSymbol.equals("La")) {

atomicMass = 138.9; }

else if (elementalSymbol.equals("Ce")) {

atomicMass = 140.1; }

else if (elementalSymbol.equals("Pr")) {

atomicMass = 140.9; }

else if (elementalSymbol.equals("Nd")) {

atomicMass = 144.2; }

else if (elementalSymbol.equals("Pm")) {

atomicMass = 145; }

else if (elementalSymbol.equals("Sm")) {

atomicMass = 150.4; }

else if (elementalSymbol.equals("Eu")) {

atomicMass = 152.0; }

else if (elementalSymbol.equals("Gd")) {

atomicMass = 157.3; }

else if (elementalSymbol.equals("Tb")) {

atomicMass = 158.9; }

else if (elementalSymbol.equals("Dy")) {

atomicMass = 162.5; }

else if (elementalSymbol.equals("Ho")) {

atomicMass = 164.9; }

else if (elementalSymbol.equals("Er")) {

atomicMass = 167.3; }

else if (elementalSymbol.equals("Tm")) {

atomicMass = 168.9; }

else if (elementalSymbol.equals("Yb")) {

atomicMass = 173.0; }

else if (elementalSymbol.equals("Lu")) {

atomicMass = 175.0; }

else if (elementalSymbol.equals("Hf")) {

atomicMass = 178.5; }

else if (elementalSymbol.equals("Ta")) {

atomicMass = 180.9; }

else if (elementalSymbol.equals("W")) {

atomicMass = 183.8; }

else if (elementalSymbol.equals("Re")) {

atomicMass = 186.2; }

else if (elementalSymbol.equals("Os")) {

atomicMass = 190.2; }

else if (elementalSymbol.equals("Ir")) {

atomicMass = 192.2; }

else if (elementalSymbol.equals("Pt")) {

atomicMass = 195.1; }

else if (elementalSymbol.equals("Au")) {

atomicMass = 197.0; }

else if (elementalSymbol.equals("Hg")) {

atomicMass = 200.6; }

else if (elementalSymbol.equals("Tl")) {

atomicMass = 204.4; }

else if (elementalSymbol.equals("Pb")) {

atomicMass = 207.2; }

else if (elementalSymbol.equals("Bi")) {

atomicMass = 209.0; }

else if (elementalSymbol.equals("Po")) {

atomicMass = 209; }

else if (elementalSymbol.equals("At")) {

atomicMass = 210.; }

else if (elementalSymbol.equals("Rn")) {

atomicMass = 222; }

else if (elementalSymbol.equals("Fr")) {

atomicMass = 223; }

else if (elementalSymbol.equals("Ra")) {

atomicMass = 226; }

else if (elementalSymbol.equals("Ac")) {

atomicMass = 227; }

else if (elementalSymbol.equals("Th")) {

atomicMass = 232.0; }

else if (elementalSymbol.equals("Pa")) {

atomicMass = 231.0; }

else if (elementalSymbol.equals("U")) {

atomicMass = 238.0; }

else if (elementalSymbol.equals("Np")) {

atomicMass = 237; }

else if (elementalSymbol.equals("Pu")) {

atomicMass = 244; }

else if (elementalSymbol.equals("Am")) {

atomicMass = 243; }

else if (elementalSymbol.equals("Cm")) {

atomicMass = 247; }

else if (elementalSymbol.equals("Bk")) {

atomicMass = 247; }

else if (elementalSymbol.equals("Cf")) {

atomicMass = 251; }

else if (elementalSymbol.equals("Es")) {

atomicMass = 252; }

else if (elementalSymbol.equals("Fm")) {

atomicMass = 257; }

else if (elementalSymbol.equals("Md")) {

atomicMass = 258; }

else if (elementalSymbol.equals("No")) {

atomicMass = 259; }

else if (elementalSymbol.equals("Lr")) {

atomicMass = 262; }

else if (elementalSymbol.equals("Rf")) {

atomicMass = 261; }

else if (elementalSymbol.equals("Db")) {

atomicMass = 262; }

else if (elementalSymbol.equals("Sg")) {

atomicMass = 266; }

else if (elementalSymbol.equals("Bh")) {

atomicMass = 264; }

else if (elementalSymbol.equals("Hs")) {

atomicMass = 277; }

else if (elementalSymbol.equals("Mt")) {

atomicMass = 268; }

else if (elementalSymbol.equals("Ds")) {

atomicMass = 281; }

else if (elementalSymbol.equals("Rg")) {

atomicMass = 272; }

else if (elementalSymbol.equals("Uub")) {

atomicMass = 285; }

else if (elementalSymbol.equals("Uut")) {

atomicMass = 284; }

else if (elementalSymbol.equals("Uuq")) {

atomicMass = 289; }

else if (elementalSymbol.equals("Uup")) {

atomicMass = 288; }

else if (elementalSymbol.equals("Uuh")) {

atomicMass = 292; }

else if (elementalSymbol.equals("Uus")) {

atomicMass = 294; }

else if (elementalSymbol.equals("Uuo")) {

atomicMass = 294; }

// states that the user input does not match an elemental symbol

else

System.out.print("That is not an elemental symbol, make sure you used capitalization correctly");

System.out.println ("The atomic mass of " + elementalSymbol + " is " + atomicMass); //tells the user the atomic mass of the elemental symbol they input }

}