Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Molecular Weight Calculator (basic programming) create a program to calculate the molecular weight of a molecule with 2 elements in it (for example, H2O or

Molecular Weight Calculator (basic programming) create a program to calculate the molecular weight of a molecule with 2 elements in it (for example, H2O or CH4) The user will provide the atomic element symbols, atomic weights, and how many atoms of each element are in the molecule. image text in transcribed

Next your program asks for three pieces of information about the first element in the molecule: 1. its chemical symbol (a single "word" like H, O, C, Na, or Cl); 2. its atomic weight (a number like 1.01, 16.00, 12.01,22.99); and 3. how many atoms of that kind are in the molecule (a counting number). Next it gets the same information for the second element. Your program then pauses again. Finally, your program prints out the result of its calculation. The result includes the formula for the molecule as well as the molecular weight. Note, the output may include some is where the formula would not. For example, the formula NaCl will be output as NalCll. That is fine. Also note that there is no (easy) way to get the numbers to print as subscripts, so do not bother to try. Just accept that the formula for water is going to look like H201. To calculate the weight of the molecule use the formula weight* count + weight x count where weight is the atomic weight of the first element, count is how many atoms of the first element are in the molecule, and similarly for weight and count- Next your program asks for three pieces of information about the first element in the molecule: 1. its chemical symbol (a single "word" like H, O, C, Na, or Cl); 2. its atomic weight (a number like 1.01, 16.00, 12.01,22.99); and 3. how many atoms of that kind are in the molecule (a counting number). Next it gets the same information for the second element. Your program then pauses again. Finally, your program prints out the result of its calculation. The result includes the formula for the molecule as well as the molecular weight. Note, the output may include some is where the formula would not. For example, the formula NaCl will be output as NalCll. That is fine. Also note that there is no (easy) way to get the numbers to print as subscripts, so do not bother to try. Just accept that the formula for water is going to look like H201. To calculate the weight of the molecule use the formula weight* count + weight x count where weight is the atomic weight of the first element, count is how many atoms of the first element are in the molecule, and similarly for weight and count

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Relational Contexts in Organizations

Answered: 1 week ago

Question

Know the principles of effective service recovery systems.

Answered: 1 week ago

Question

Explain the service recovery paradox.

Answered: 1 week ago