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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!