Question
Objectives: Gain experience in writing a user-friendly C++ computer program that emphasizes object-oriented approach. Develop a mastery in creating and working with classes, intrinsic and
Objectives: Gain experience in writing a user-friendly C++ computer program that emphasizes object-oriented approach. Develop a mastery in creating and working with classes, intrinsic and extrinsic functions, program controls using loops and if-else structure. Develop mastery in working with arrays and various data types. Gain experience in engineering problem solving through numerical computation. Develop mastery in advance input/out operations including working with external data files.
Problem:
Two rifle manufacturers will be competing in an upcoming event. One of the manufacturers is a U.S. company that produces the US_1 rifle having a 0.6096 m barrel, a 7.62 mm bore, and 0.102 mm deep rifling grooves. The other is a Russian company that produces the R_1 rifle having a 0.4826 m barrel, 8.5 mm bore, and 0.100 mm deep rifling grooves. The lead bullet used weighs 0.0956 N in both rifles. The gas pressure build-up during firing of the rifle, which is the driving force of the bullet, is known for the two rifles. The gas pressure varies as the bullet travels along the barrel of the rifle. The pressure data are given in the following table. The frictional resistance exerted on the bullet is to be considered small as compared to the propulsive force of the gas on the bullet, and the cross-sectional area of the rifling grooves is considered negligible. Write a C++ computer program to calculate the bullet velocities, accelerations along the barrel and along its trajectory until it hits the ground. Compare the two rifles and provide your recommendation for purchase. You may use the Trapezoidal or Simpson rule for your numerical integration. Your report (and program) should contain the following:
1. The maximum height that a bullet will reach if there is no air drag. Assume that rifles are fired at an angle from the horizontal. Vary this angle from 25 to 55 with increments of 10 degrees. 2. The time it takes for the bullet to travel the length of the barrel. 3. The total distance traveled by the bullet, i.e. the range of the bullet. 4. The time lapse before the bullet strikes the ground, measured from the firing time. 5. Plots of velocity, acceleration, and trajectory of the bullet. These may be done in Excel or using the graphing library discussed in class. 6. A table summarizing the items 1 to 4 so that the two rifles could be compared. 7. Input and output data in a tabulated form note that you should only print a small portion of your output data since there will be too many values. You can do this by printing every nth, e.g. 50th or 100th data. Do not print too many pages of output data, i.e. enough to be able to have decent graphs. Of course, if using the Dislin plot library then you should use all of your data for plotting. 8. Any other data that was critical in the successful completion of the assignment. 9. A list of functions used- Note that minimum of five user-defined functions is required. 10. List of classes and their structures. Note that at least two classes containing public and private sections should be used in the program. 11. The arrays should be declared dynamically in the heap area and should be deleted once computations are done.
You may calculate the work done by the gas on the bullet by integrating force of the gas on the bullet over the distance traveled. This work must be equal to the change in the kinetic energy of the bullet.
You may determine the accelerations by numerical differentiation (as discussed in the class).
Table 1. Pressure data (GPa) for the rifles.
L(m) US_1 R_1 0.01270 0.10135 0.12500 0.02540 0.20064 0.23500 0.03810 0.27303 0.30000 0.05080 0.31095 0.35000 0.06350 0.33094 0.37000 0.07620 0.33991 0.41000 0.08890 0.34474 0.42100 0.10160 0.33577 0.42250 0.11430 0.31508 0.43000 0.12700 0.29578 0.42750 0.13970 0.27717 0.41000 0.15240 0.26131 0.40000 0.16510 0.24545 0.39750 0.17780 0.23097 0.38800 0.19050 0.21718 0.38000 0.20320 0.20339 0.37500 0.21590 0.19167 0.36500 0.22860 0.17995 0.35000 0.24130 0.16823 0.34000 0.25400 0.15789 0.33750 0.26670 0.14824 0.33000 0.27940 0.13927 0.30000 0.29210 0.13238 0.29000 0.30480 0.12548 0.28750 0.31750 0.11859 0.28000 0.33020 0.11238 0.27000 0.34290 0.10687 0.26000 0.35560 0.10204 0.24700 0.36830 0.09215 0.23000 0.38100 0.09308 0.22650 0.39370 0.08894 0.21450 0.40640 0.08480 0.20750 0.41910 0.08067 0.18750 0.43180 0.07722 0.17000 0.44450 0.07377 0.15000 0.45720 0.07032 0.14000 0.46990 0.06757 0.11000 0.48260 0.06481 0.07000 0.49530 0.06205 0.50800 0.05929 0.52070 0.05654 0.53340 0.05378 0.54610 0.05102 0.55880 0.04826 0.57150 0.04550 0.58420 0.04274 0.59690 0.04067 0.60960 0.03861
GUIDELINES:
The program should be as modular as possible. Include as many functions as possible. The program should contain any necessary comments that would enhance the readability of the program. Program output should be very neat, organized, and easy to read. The program should use classes, arrays, functions, loops, and others. The program should read the given data from an input file and generate an output file after computation is performed. Your program should request for input and output file names. Do not include the file names in the program. All output should be stored in an output file. The written information should be very logically arranged. The input data, as well as any output data, should be printed in the output data file in the appropriate format and with appropriate titles/headings etc. Please note that you should only output every 100th data value to keep the data file size small.
m (vf-vi 2 orK whee: and f nfer to initial and final values. A -TDP P Gas pressue m (vf-vi 2 orK whee: and f nfer to initial and final values. A -TDP P Gas pressueStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started