Question
Using the Element class, write a program that will calculate the molecular weight of the following chemicals: Glucose (C6H12O6) Epinephrine (C9H13NO3) Acetic Acid (CH3COOH) Sodium
Using the Element class, write a program that will calculate the molecular weight of the following chemicals:
Glucose (C6H12O6)
Epinephrine (C9H13NO3)
Acetic Acid (CH3COOH)
Sodium Bicarbonate (NaHCO3)
In your program output, print the common names of these chemicals, not their chemical names.
Below is the Element class (Hopefully...)
public class Element { private String name; private String symbol; private int atomicNumber; private double atomicWeight; public Element() { } public Element(String name, String symbol, int atomicNumber, double atomicWeight){ this.name = name; this.symbol = symbol; this.atomicNumber = atomicNumber; this.atomicWeight = atomicWeight; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSymbol() { return symbol; } public void setSymbol(String symbol) { this.symbol = symbol; } public int getAtomicNumber() { return atomicNumber; } public void setAtomicNumber(int AtomicNumber) { this.atomicNumber = atomicNumber; } public double getAtomicWeight() { return atomicWeight; } public void setAtomicWeight(double AtomicWeight) { this.atomicWeight = atomicWeight; } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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