Worksheet #8 - Final Project Update Portion ----- Final Project Worksheet #8. *** Place a comment at the top of your file that describes all the help you've received and its source. Also describe who you worked with, or who you have helped. Code should be your own, although you should work in groups and it is okay to get help on a sticky point from another student, but it must be documented. Plagiarism will be reported. *** Name your cpp lastname_firstname_finalproject.cpp *** For example, ramsey_doc_finalproject.cpp ** Final 8 - use dynamic arrays! ** Our final project involves two computations. One will compute the total deltaV of an existing rocket. The other invovles computing how much fuel is needed to achieve certain deltaV given a specific payload. Our worksheets thus far are leading us towards this task. In this extension, we'll be extending our program to include and save the information into dynamic arrays. This is a small incremental update from #7. So let's walk through the structure of the code. You'll still have a while loop to let the user repeat all the code steps. You'll still have a for loop (more than 1) to do a number of stages. In worksheet #5, we were capable of asking how many stages were on the rocket. We removed this in worksheet#7, but it is time to add it back in now that we have dynamic arrays! ASk the user how many stages they'd like in their rocket. Use this value to create dynamic arrays for the information needed in our stages. Here are the arrays that we require: 1) An array for the names of the stages. 2) An array for the total mass of the stages. 3) An array for the fuel mass of the stages. 4) An array for the deltaV of the stages. Use your functions from Worksheet Update #5 to get the input into the first three arrays and to perform the computation for each stage, but then store the value into the deltaV array for later retrieval. Once complete, find the total sum of the deltaV of all stages. This is the actual deltaV of the entire spacecraft once all stages are depleted of fuel. In addition, find the average total mass and fuel masses of all the stages. ****UPDATE for Final8**** The second piece of computation is to find the total fuel mass required to get a payload to achieve a certain deltaV. In this update, we're going to move this calculation into a loop that allows for multiple fuel mass calculations. So, ask the user how many stages (or fuel masses) they would like to compute. Based on their answer, write a loop that encompasses the input for ISP/target deltaV/payload and the loop to compute the fuel mass. Put these data values into dynamic arrays. Then, compute the fuel mass and new total mass required to achieve the target deltaV input and put that value in a dynamic array. When computed, output the fuel mass, total mass and actual dV achieved. The actual dV will often be higher (and not equal to) the target dV using this formulation. ****Update from Final7**** For the section outside of the for loop, we were using a loop to compute the required fuel mass to reach a target deltaV. In that loop, we incremented the fuel mass by 0.0001. If you still haven't found the trick to do this very quickly, change this loop to increase the fuel mass by 1 instead. This will make things much more speedy. ****UPDATE From Final7**** In addition, any time the fuel mass is increased by 1, there is an increase in the total mass by an extra .125. So the total mass actually changes by 1.125 for every 1 of fuel. This total mass increase is due to a required increase in the storage container required to hold the fuel mass. Update your function to take this into account. In the next worksheet, we'll ask the user for how many payloads they wish to do this computation! Some variables that we've been using: -craft name ex: Challenger -total mass ex: 1995806.42 -fuel mass ex: 1671487.88 -ISP ex: 269.1 -gravity a constant value at 9.80665 -dV ex: 4300.2 -target dV ex: 6500.0 -payload mass ex: 27500.1 The equation we've been using: dV = gravity * ISP * ln ( total_mass / ( total_mass - fuel_mass ) ) Remember, payload mass, total mass, fuel mass, target dV, and ISP can never be below 0. Also, total mass must be larger than fuel mass. Write down any assumptions or decisions you make when you complete this process. Sample Execution of My Code: Welcome to Ramsey's dV and mass Calculator How many stages will your craft have?2 **** Input Stage Information **** ********* Stage #1 ********* Stage name: First Total weight: 30 Fuel weight: 10 ISP: 200 Computed dV of this stage is: 795.251 ********* Stage #2 ********* Stage name: Second Total weight: 19 Fuel weight: 9 ISP: 300 Computed dV of this stage is: 1888.33 ** Computed ** The total dV of this craft is: 2683.58 Averages masses were: 24.5, 9.5 --Computation #2 - given a payload, reach a target dV-- How many stages:2 ********* Stage #1 ********* Stage name: Happy Payload wt: 10 Target dV: 5000 ISP: 300 ** Computed ** Fuel: 102 Total: 124.75 Actual dV: 5006.53 ********* Stage #2 ********* Stage name: Lucky Payload wt: 134.75 Target dV: 1000 ISP: 400 ** Computed ** Fuel: 41 Total: 180.875 Actual dV: 1008.35 Want to do this again? (y/n) n