Boxes
Task: Evaluate whether you can load various sizes of jars into boxes. For each test, you will input the length, width, and height of a box as well as the diameter and height of a cylindrical jar. The algorithm will determine whether each jar will fit in its corresponding box. The jar can sit upright in the box, or it can lie on its side with its top parallel to one of the sides of the box. Assume that a clearance allowance of .25 inch is needed in all three directions for the jar to fit in the box.
The program will be submitted in two versions:
1. An algorithm using pseudocode
2. A C++ program
Input: Use the following data, which can be found in the P4Boxes.txt file. Each row of data includes the 3 inner dimensions of a box (length, width, height) and the two outer dimensions of a jar (diameter, height). The dimensions are all in inches.
Box: Jar:
L W H D H
6.0 6.0 10.3 5.0 10.0
6.0 5.0 10.3 5.0 10.0
12.0 3.3 4.0 3.0 11.0
12.0 3.2 4.0 3.0 11.0
9.5 6.5 7.5 6.0 9.5
9.5 6.5 7.5 6.0 9.0
4.5 8.0 4.5 4.0 7.5
4.0 8.0 4.5 4.0 7.5
7.3 7.3 17.0 7.0 16.0
6.8 7.3 17.0 7.0 16.0
7.3 7.3 16.2 7.0 16.0
7.2 7.3 16.3 7.0 16.0
Output: Send the output to an external file. Line up decimal points in the output columns. The output file should include column labels, an appropriate header in addition to the column labels, the given points, and a “yes” or “no” verdict as to whether each jar will fit in its box.
Sample output (you may change the layout):
Box: Jar: Jar Fits?
L W H D H
6.0 6.0 10.3 5.0 10.0 yes
6.0 5.0 10.3 5.0 10.0 no
12.0 3.3 4.0 3.0 11.0 yes
Programming: Include at least one function in your program.
File is given below to use.
P4Boxes.txt
6.0 6.0 10.3 5.0 10.0
6.0 5.0 10.3 5.0 10.0
12.0 3.3 4.0 3.0 11.0
12.0 3.2 4.0 3.0 11.0
9.5 6.5 7.5 6.0 9.5
9.5 6.5 7.5 6.0 9.0
4.5 8.0 4.5 4.0 7.5
4.0 8.0 4.5 4.0 7.5
7.3 7.3 17.0 7.0 16.0
6.8 7.3 17.0 7.0 16.0
7.3 7.3 16.2 7.0 16.0
7.2 7.3 16.3 7.0 16.0
Dear Student,
Here is the complete C++ program. which fullfill the requirement of the given problem.
NOTE: Please note that the below program is tested on ubuntu 14.04 sytem and compiled under g++ compiler.
1: Here is An algorithm using pseudocode:
----------------------------------------------------------------------------------------------------------------------------------------
Algorithm for the Boxes Problem.
Input: Read L, W, H_Box, D, H_Jar data from the Data.tx file
Output: Output file with all the Data after Calculation.
1- open Data.txt file
2- Read data from the Data.txt file.
3- if (Length of Box+0.25 > Diameter of Jar and Width of Box +0.25 > Diameter and Hight of Box+0.25 > Hight of Jar)
4- then
5- print yes;
6- else
7- print no;
8- print the output on the screen.
9- print result into output file result.txt;
10-end
-----------------------------------------------------------------------------------------------------------------------------------
2: Program: Here is a C++ program
-----------------------------------------------------------------------------------------------------------------------------------
#include<iostream>
#include<iomanip>
#include<stdlib.h>
#include<math.h>
#include<fstream>
//Namespace declaration
using namespace std;
//Function Prototype
void print_layout();
//Starting of main function
int main()
{
//Variable data tye declaration
double L, W, H_Box, D, H_Jar;
string out;
//ifstream, ofstream file declaration
ifstream infile;
ofstream outfile;
infile.open("Data.txt");
if(!infile)
{
cout <<"file does note exist"<<endl;
return 1;
}
outfile.open("result.txt");
if(!outfile)
{
cout <<"file does note exist"<<endl;
return 1;
}
//print_layout function calling
print_layout();
outfile<<"\n"<<endl;
outfile<<" Box: Jar: Jarfit?\n"<<endl;
outfile<<setw(10)<<left<<"L"<<setw(10)<<left<<"W"<<setw(10)<<left<<"H_Box"<<setw(10)<<left<<"D"<<setw(10)<<left<<"H_Jar"<<endl;
//reading data from the file
while(!infile.eof())
{
infile>>L>>W>>H_Box>>D>>H_Jar;
if(L+0.25 > D && W+0.25 > D && H_Box+0.25 > H_Jar)
{
out = "yes";
}
else
{
out = "No";
}
//Display output on the screen as well as in the output file
cout<<"\n";
outfile<<"\n";
cout<<setw(10)<<left<<L<<setw(10)<<left<<W<<setw(10)<<left<<H_Box<<setw(10)<<left<<D<<setw(10)<<left<<H_Jar<<setw(10)<<left<<out<<endl;
outfile<<setw(10)<<left<<L<<setw(10)<<left<<W<<setw(10)<<left<<H_Box<<setw(10)<<left<<D<<setw(10)<<left<<H_Jar<<setw(10)<<left<<out<<endl;
}
infile.close();
outfile.close();
return 0;
}//end of the main function
//print_layout funcrtion defination
void print_layout()
{
cout<<"\n"<<endl;
cout<<" Box: Jar: Jarfit?\n"<<endl;
cout<<setw(10)<<left<<"L"<<setw(10)<<left<<"W"<<setw(10)<<left<<"H_Box"<<setw(10)<<left<<"D"<<setw(10)<<left<<"H_Jar"<<endl;
}
------------------------------------------------------------------------------------------------------------------------------------
Here i have attached the output which will be dispalyed on screen..
Output: Which displayed on screen...
-------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------
Here is the result.txt file will be also generated after execution of the program in your current directory.
Output: "result.txt file"
-------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------
Here i have also attached the input file from which the data has been read, this file is Data.txt.
Data.txt file
--------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------
Kindly Check and Verify Thanks....!!!
Boxes Task: Evaluate whether you can load various sizes of jars into boxes. For each test,...
Fill out the tables below of the starting material and pure product by using the given NMR spectrums. Identify if the pure isomer of methyl nitrobenzoate as ortho, meta, or para. Complete the table below using your proton NMR spectrum of your starting material. Be sure to include all peaks. Note: The table is expandable. Use the structure below for the letter assignments in your table. Splitting Integration Assignment Peak (ppm) Other Notes -7.95 -7.92 0627 -787 785 7.30 751...
analyze this NMR & IR S23 CDC13 QE-300 240 UN (43 MIL.) 10.02s, 1H), 7.716.J-2 Hz. ) 2.0 11.5 11.0 10.5 10.0 9.5 9.0 8.5 8.0 7.5 7.0 6.5 6.0 4.0 3.5 3.0 2.5 20 15 100.5 0.0 -0.5 -1.0 -1.5 -2. 5.5 5.0 4.5 fl (ppm)
7. What kind of carbons correspond to these chemical shifts? 8. Based on this analysis, the unknown might contain the following substructure: UN (43 MIL.) 10.02s, 1H), 7.716.J-2 Hz. ) 2.0 11.5 11.0 10.5 10.0 9.5 9.0 8.5 8.0 7.5 7.0 6.5 6.0 4.0 3.5 3.0 2.5 20 15 100.5 0.0 -0.5 -1.0 -1.5 -2. 5.5 5.0 4.5 fl (ppm)
5. Based on this analysis, the compound might be or contain the following substructure: 6. How many different types of carbons appear to be present? What are the chemical shifts for these carbons? UN (43 MIL.) 10.02s, 1H), 7.716.J-2 Hz. ) 2.0 11.5 11.0 10.5 10.0 9.5 9.0 8.5 8.0 7.5 7.0 6.5 6.0 4.0 3.5 3.0 2.5 20 15 100.5 0.0 -0.5 -1.0 -1.5 -2. 5.5 5.0 4.5 fl (ppm)
3. Based on the integration of the peaks, what is the relative number of protons which make up each signal? 4. Identify any common splitting patterns. (ie. Isopropyl, ethyl, etc) UN (43 MIL.) 10.02s, 1H), 7.716.J-2 Hz. ) 2.0 11.5 11.0 10.5 10.0 9.5 9.0 8.5 8.0 7.5 7.0 6.5 6.0 4.0 3.5 3.0 2.5 20 15 100.5 0.0 -0.5 -1.0 -1.5 -2. 5.5 5.0 4.5 fl (ppm)
Below are four bivariate data sets and the scatter plot for each. (Note that each scatter plot is displayed on the same scale.) Each data set is made up of sample values drawn from a population. x y 1.0 4.1 2.0 6.1 3.0 7.0 4.0 4.0 5.0 5.2 6.0 8.1 7.0 5.5 8.0 6.9 9.0 9.0 10.0 7.3 x1234567891011y12345678910110 Figure 1 u v 1.0 8.1 2.0 7.4 3.0 8.1 4.0 6.1 5.0 7.4 6.0 4.5 7.0 4.6 8.0 3.4...
How would you analyze the peaks for a 1H NMR of Bromovanillyl Alcohol and an IR spectra of Bromovanillyl Alcohol? IR Peaks NMR Peaks %Transmittance 3446.63 3121.86 8 3004.87 2925.69 2877.64 8 1611.72" 1588.93 1499.44 1420.46 1398.31 1371.05 05 1277.51 1200.01 1179.94 1143.10 8 1047.61 1010.21 948.66 852.87 836.91 823.94 780.44 719.71 H NMR (400 mHz, CDCls) Br 6.86 s) 92 7.09 5.90 4.60 1.64 CDCls H20 12.5 12.0 11.5 11.0 10.5 10.0 9.5 9.0 8.5 8.0 7.5 7.0 6.5...
1. How many different types of protons appear to be present? What are the chemical shifts for these protons? What does this indicate (if anything) about the electronic environment of the protons? 2. What are the multiplicities for each peak? UN (43 MIL.) 10.02s, 1H), 7.716.J-2 Hz. ) 2.0 11.5 11.0 10.5 10.0 9.5 9.0 8.5 8.0 7.5 7.0 6.5 6.0 4.0 3.5 3.0 2.5 20 15 100.5 0.0 -0.5 -1.0 -1.5 -2. 5.5 5.0 4.5 fl (ppm)
what is this compound ? positive test for both DNPH and oxidation test (CrO3) what is the compound ? MASS SPECTRUM 43 40. 00 120. m/z EREZ -2.359 2.334 -2.074 1.561 V1.525 - 1.512 £9'I 1.269 1234 1.212 1.196 11.245 Z811 1980- 880- SOR'D 2.6 2.4 2.2 2.0 LJ LJ 1.8 16 1.4 1.2 10 0 .8 ppm 9.5 9.0 8.5 8.0 7.5 7.0 6.5 6.0 5.5 5.0 4.5 4.0 3.5 3.0 2.5 20151005 ppon | 2900 7775
What compound is this ? Positive test for both DNPH and idoform test. ENEZ 6SEZ 2.334 VOZ 1.561 1.536 1.525 1.512 88DT 1.269 1.245 1.234 1.223 1.212 1.196 1.182 1980- 0.828 9080 2.6 2.4 2.2 2.0 1.8 16 1.4 1.2 1.0 0.8 4010 3.036 9.5 9.0 8.5 8.0 7.5 7.0 6.5 6.0 5.5 5.0 4.5 4.0 3.5 3.0 2.5 20 15 10 0.5 ppm MASS SPECTRUM 114 40. 80N 120. m/z | 2900 7775