COMP 322 MGU Program to Predict the Molecular Geometry of Molecules Exercise
Question Description
I’m working on a c++ question and need a sample draft to help me study.
(Instructions also attached in .txt format below, as well as the input file molecules.txt in the attachment)
Programming Problem: Approximating the Geometrical Shape of Molecules
Write a C++ program to predict the molecular geometry of molecules based on formulas like AB_b,
where the approximate shape is one A atom in the centre surrounded by b B atoms.
The Valence-Shell Electron-Pair Repulsion Model (VSEPR model) is commonly used for this task and consists of these four steps:
1. set v for the centre atom A using a nested-if and the information in Table 1
2. e = v – b
3. n = e / 2
4. use b and n in a nested-if to determine the shape based on Table 2.
Note that Step 1 determines the (simplified) number of valence electrons v for the central atom A.
Step 2 subtracts the number of bonding domains (b) from v to determine the number of nonbonding electrons (e).
Then, by dividing e by 2, Step 3 determines the number of bonding domains (n).
We assume that only single bonds are present. Also, Table 1 shows the element name only for your convenience;
it is not required in the C++ program.
Each line in the input file, called molecules.txt and given on UR Courses,
represents the information for one molecule and contains 3 pieces of data in the following format:
A B b
where A and B are the chemical symbols for two elements (use type string), and b is the number of B atoms (use type int).
In the output file, called geometricalshapes.txt, print the determined shape in this format:
The geometrical shape of one A atom surrounded by b B atoms is s.,
where s is the determined shape from Table 2.
Indicate s as unknown when the values of b and n do not match any case in Table 2.
For example, if the first four input lines from molecules.txt are
O F 2
S F 4
Be F 3
C P 1
then the first four output lines in geometricalshapes.txt would be
The geometrical shape of one O atom surrounded by 2 F atoms is bent.
The geometrical shape of one S atom surrounded by 4 F atoms is seesaw.
The geometrical shape of one Be atom surrounded by 3 F atoms is trigonal planar.
The geometrical shape of one C atom surrounded by 1 P atoms is unknown.
Table 1
Element Symbol v
Beryllium Be 3
Carbon C 4
Silicon Si 4
Nitrogen N 5
Phosphorus P 5
Arsenic As 5
Oxygen O 6
Sulfur S 6
Selenium Se 6
Flourine F 7
Chlorine Cl 7
Bromine Br 7
Iodine I 7
Xenon Xe 8
Table 2
b n s (Molecular Geometry)
2 0 linear
2 1 bent
2 2 bent
2 3 linear
3 0 trigonal planar
3 1 trigonal pyramidal
3 2 T-shaped
4 0 tetrahedral
4 1 seesaw
4 2 square planar
5 0 trigonal bipyramidal
5 1 square pyramidal
6 0 octahedral
Use meaningful variable names, proper indentation, and appropriate comments.
In order to demonstrate that your program works, you must collect the output of your program.
Upload to UR Courses: (1) your C++ program (extension .cpp and not extension .sln), and (2) your output.
"Place your order now for a similar assignment and have exceptional work written by our team of experts, guaranteeing you "A" results."