Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Uses c++ A molecule is an electrically neutral group of two or more atoms held together by chemical bonds. Atoms are held together by bonds,

Uses c++

image text in transcribed

A molecule is an electrically neutral group of two or more atoms held together by chemical bonds. Atoms are held together by bonds, mostly single bonds, but in some (rare) cases the bonding may include two double bonds and/or a triple bond. Many experiments involve the use of molecules, and a plethora of data can be created and analyzed by a system which can represent and encode their properties and workings. Write a C++program that creates, stores, and provides access to Molecule objects. Create a class named Molecule. This class maintains an array of elements (of max size 10), an array of counts of each element (of max size 10), the number of bonds (no more than the total number of elements plus 4), and a charge (which can be positive, negative, or neutral). You should build the appropriate mutators and accessors (you will not need for an accessor for each individual element count- but you will need a mutator to be able to set an individual count) d list of the values as a The accessor method for elements should return a comma-separate string. You should also declare and define a method that returns the total count of elements, a method that prints the counts as a comma-separated list, and finally, declare and define a method that prints out all the values associated with a molecule object. To test the Molecule class, write a main function which allows the user to enter elements (a maximum of 10); counts (a maximum of 10); a number of bonds, and a charge. The main function should then call the method to print the resulting Molecule Your program should include a continuation loop so you can test more than one molecular configuration. An example run of the program is as follows (user input is in bold font) Enter the element and its count (enterQ 0to stop): H 2 Enter the element and its count (enter 0 to stop): o 1 Enter the element and its count (enter ' 0 to stop): Q Enter the number of bonds: 1 Enter the charge (-1 for negative, O for neutral, 1 for positive): 0 Elements: Counts: Total count: Bonds: Charge H, O 2, 1 3 Neutral Would you like to continue (y)? Y

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

Recommended Textbook for

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions

Question

Does it highlight your accomplishments rather than your duties?

Answered: 1 week ago