I’ll do it.
I just finished this and was going to hand it out to my physics classmates for next weeks lab. It is horribly repetitive and I am certain there is better way. I’ll bet there is way of setting up a framework and calling each new variable into the framework as needed with my yet to be understood pointers?
Thanks for the challenge.
[code]
//
// main.c
// Conservation of Momentum Lab Calculator
//
// Created by Tyler Meek on 11/21/12.
// Copyright © 2012 Tyler Meek. All rights reserved.
//
/* This is a program to speed the calculation time of completeing the Conservation of Momentum Lab 14 on page 149 of David Loyd’s Physics Laboratory Manual. */
#include <stdio.h>
#include <math.h>
// Initialization of all variables used in computation
float mass1, mass2, mass3, distance1To2, distance3To4, t1_1mass1B4, t2_1mass1B4, t3_1mass1B4, t4_1mass1B4, t5_1mass1B4,t1_1mass2Aft, t2_1mass2Aft, t3_1mass2Aft, t4_1mass2Aft, t5_1mass2Aft, t1_2mass1B4, t2_2mass1B4, t3_2mass1B4, t4_2mass1B4, t5_2mass1B4, t1_2mass1Aft, t2_2mass1Aft, t3_2mass1Aft, t4_2mass1Aft, t5_2mass1Aft, t1_2mass3Aft,t2_2mass3Aft, t3_2mass3Aft, t4_2mass3Aft, t5_2mass3Aft, t1_3mass1B4, t2_3mass1B4, t3_3mass1B4, t4_3mass1B4, t5_3mass1B4, t1_3mass3B4, t2_3mass3B4, t3_3mass3B4, t4_3mass3B4, t5_3mass3B4, t1_3mass1Aft, t2_3mass1Aft, t3_3mass1Aft, t4_3mass1Aft, t5_3mass1Aft, t1_3mass3Aft, t2_3mass3Aft, t3_3mass3Aft, t4_3mass3Aft, t5_3mass3Aft;
int main(int argc, const char * argv[])
{
// Input of known values
// General Overview of instruction to user
printf("Input Mass1, Mass2 and Mass3 in kilograms and the distance from point 1 to 2 and 3 to 4 in meters.\n");
printf("\n");
// User input of mass 1
printf("What is Mass1? = \n");
scanf("%f", &mass1);
// User input of mass 2
printf("What is Mass2? = \n");
scanf("%f", &mass2);
// User input of mass 3
printf("What is Mass3? = \n");
scanf("%f", &mass3);
// User input of the distance between point 1 and point 2
printf("What is the distance between point 1 and point 2?\n");
scanf("%f", &distance1To2);
// User input of the distance between point 3 and point 4
printf("What is the distance between point 3 and point 4?\n");
scanf("%f", &distance3To4);
// BEGIN calculations for table 1
// Trial 1
// User input of time values for mass 1 before collision
printf("What is the time for trial 1 mass 1 before the collision?\n");
scanf("%f", &t1_1mass1B4);
printf("What is the time for trial 1 mass 2 after the collision?\n");
scanf("%f", &t1_1mass2Aft);
// Calculate Velocity of mass 1 before collision
float velocity1m1 = distance1To2 / t1_1mass1B4;
printf("The velocity of mass 1, trial 1, before the collision is...%.3f (m/s)\n", velocity1m1);
// Calculate Momentum of mass 1 before the collision
float momentum1m1 = velocity1m1 * mass1;
printf("The momentum is...%.3f(kg-m/s)\n", momentum1m1);
// Calculate Velocity of mass 2 after the collision
float velocity1m2 = distance3To4 / t1_1mass2Aft;
printf("The velocity of mass 2, trial 1, after the collision is...%.3f (m/s)\n", velocity1m2);
// Calculate Momentum of mass 2 after the collision
float momentum1m2 = velocity1m2 * mass2;
printf("The momentum is...%.3f(kg-m/s)\n", momentum1m2);
// Calculate the percent difference (|P2-P1|/(|P1+P2|/2)) * 100
printf("The percent difference of trail 1 is %.2f\n", ((momentum1m2 - momentum1m1) / ((momentum1m1 + momentum1m2) / 2)) * 100);
printf("\n");
// Trial 2
// User input of time values for mass 1 before collision
printf("What is the time for trial 2 mass 1 before the collision?\n");
scanf("%f", &t2_1mass1B4);
printf("What is the time for trial 2 mass 2 after the collision?\n");
scanf("%f", &t2_1mass2Aft);
// Calculate Velocity of mass 1 before collision
float velocity2m1 = distance1To2 / t2_1mass1B4;
printf("The velocity of mass 1, trial 2, before the collision is...%.3f (m/s)\n", velocity1m1);
// Calculate Momentum of mass 1 before the collision
float momentum2m1 = velocity2m1 * mass1;
printf("The momentum is...%.3f(kg-m/s)\n", momentum2m1);
// Calculate Velocity of mass 2 after the collision
float velocity2m2 = distance3To4 / t2_1mass2Aft;
printf("The velocity of mass 2, trial 2, after the collision is...%.3f (m/s)\n", velocity2m2);
// Calculate Momentum of mass 2 after the collision
float momentum2m2 = velocity2m2 * mass2;
printf("The momentum is...%.3f(kg-m/s)\n", momentum2m2);
// Calculate the percent difference (|P2-P1|/(|P1+P2|/2)) * 100
printf("The percent difference of trail 2 is %.2f\n", ((momentum2m2 - momentum2m1) / ((momentum2m1 + momentum2m2) / 2)) * 100);
printf("\n");
// Trial 3
// User input of time values for mass 1 before collision
printf("What is the time for trial 3 mass 1 before the collision?\n");
scanf("%f", &t3_1mass1B4);
printf("What is the time for trial 3 mass 2 after the collision?\n");
scanf("%f", &t3_1mass2Aft);
// Calculate Velocity of mass 1 before collision
float velocity3m1 = distance1To2 / t3_1mass1B4;
printf("The velocity of mass 1, trial 3, before the collision is...%.3f (m/s)\n", velocity3m1);
// Calculate Momentum of mass 1 before the collision
float momentum3m1 = velocity3m1 * mass1;
printf("The momentum is...%.3f(kg-m/s)\n", momentum3m1);
// Calculate Velocity of mass 2 after the collision
float velocity3m2 = distance3To4 / t3_1mass2Aft;
printf("The velocity of mass 2, trial 3, after the collision is...%.3f (m/s)\n", velocity3m2);
// Calculate Momentum of mass 2 after the collision
float momentum3m2 = velocity3m2 * mass2;
printf("The momentum is...%.3f(kg-m/s)\n", momentum3m2);
// Calculate the percent difference (|P2-P1|/(|P1+P2|/2)) * 100
printf("The percent difference of trail 3 is %.2f\n", ((momentum3m2 - momentum3m1) / ((momentum3m1 + momentum3m2) / 2)) * 100);
printf("\n");
// Trial 4
// User input of time values for mass 1 before collision
printf("What is the time for trial 4 mass 1 before the collision?\n");
scanf("%f", &t4_1mass1B4);
printf("What is the time for trial 4 mass 2 after the collision?\n");
scanf("%f", &t4_1mass2Aft);
// Calculate Velocity of mass 1 before collision
float velocity4m1 = distance1To2 / t4_1mass1B4;
printf("The velocity of mass 1, trial 4, before the collision is...%.3f (m/s)\n", velocity4m1);
// Calculate Momentum of mass 1 before the collision
float momentum4m1 = velocity4m1 * mass1;
printf("The momentum is...%.3f(kg-m/s)\n", momentum4m1);
// Calculate Velocity of mass 2 after the collision
float velocity4m2 = distance3To4 / t4_1mass2Aft;
printf("The velocity of mass 2, trial 4, after the collision is...%.3f (m/s)\n", velocity4m2);
// Calculate Momentum of mass 2 after the collision
float momentum4m2 = velocity4m2 * mass2;
printf("The momentum is...%.3f(kg-m/s)\n", momentum4m2);
// Calculate the percent difference (|P2-P1|/(|P1+P2|/2)) * 100
printf("The percent difference of trail 4 is %.2f\n", ((momentum4m2 - momentum4m1) / ((momentum4m1 + momentum4m2) / 2)) * 100);
printf("\n");
// Trial 5
// User input of time values for mass 1 before collision
printf("What is the time for trial 5 mass 1 before the collision?\n");
scanf("%f", &t5_1mass1B4);
printf("What is the time for trial 5 mass 2 after the collision?\n");
scanf("%f", &t5_1mass2Aft);
// Calculate Velocity of mass 1 before collision
float velocity5m1 = distance1To2 / t5_1mass1B4;
printf("The velocity of mass 1, trial 5, before the collision is...%.3f (m/s)\n", velocity5m1);
// Calculate Momentum of mass 1 before the collision
float momentum5m1 = velocity5m1 * mass1;
printf("The momentum is...%.3f(kg-m/s)\n", momentum5m1);
// Calculate Velocity of mass 2 after the collision
float velocity5m2 = distance3To4 / t5_1mass2Aft;
printf("The velocity of mass 2, trial 5, after the collision is...%.3f (m/s)\n", velocity5m2);
// Calculate Momentum of mass 2 after the collision
float momentum5m2 = velocity5m2 * mass2;
printf("The momentum is...%.3f(kg-m/s)\n", momentum5m2);
// Calculate the percent difference (|P2-P1|/(|P1+P2|/2)) * 100
printf("The percent difference of trail 2 is %.2f\n", ((momentum5m2 - momentum5m1) / ((momentum5m1 + momentum5m2) / 2)) * 100);
printf("\n");
// END of Calculations for Table 1
printf(“THIS IS A MARKER TO DECIPHER THE END OF TABLE 1 and THE BEGINNING OF TABLE 2_______________________________________________\n”);
printf("\n");
printf("\n");
// BEGIN Calculations for Table 2
// Trial 1
// User input of time value for mass 1 before collision
printf("What is the time for trial 1, mass 1, before the collision between points 1 and 2?\n");
scanf("%f", &t1_2mass1B4);
// User input of time value for mass 1 after collision
printf("What is the time for trial 1, mass 1, after the collision between points 2 and 1?\n");
scanf("%f", &t1_2mass1Aft);
// User input of time value for mass 3 after collision
printf("What is the time for trial 1, mass 3, after after the collision between points 3 and 4?\n");
scanf("%f", &t1_2mass3Aft);
// Calculate the velocity of mass 1 before collision
float twoVelocity1m1 = distance1To2 / t1_2mass1B4;
printf("The velocity of mass 1, trial 1 before the collision is %.3f (m/s).\n", twoVelocity1m1);
// Calculate the momentum of mass 1 before collision
float twoMomentum1m1 = twoVelocity1m1 * mass1;
printf("The momentum of mass 1, trial 1 before the collision is %.3f (kg-m/s).\n", twoMomentum1m1);
// Calculate the velocity of mass 1 after collision
float twoVelocity1m1Aft = distance1To2 / t1_2mass1Aft;
printf("The velocity of mass 1, trial 1 after the collision is %.3f (m/s).\n", twoVelocity1m1Aft);
// Calculate the momentum of mass 1 after the collision
float twoMomentum1m1Aft = twoVelocity1m1Aft * mass1;
printf("The momentum of mass 1, trial 1 after the collision is %.3f (kg-m/s).\n", twoMomentum1m1Aft);
// Calculate the velocity of mass 3 after the collision
float twoVelocity1m3 = distance3To4 / t1_2mass3Aft;
printf("The velocity of mass 3, trial 1 after the collision is %.3f (m/s).\n",twoVelocity1m3);
// Calculate the momentum of mass 3 after the collision
float twoMomentum1m3 = twoVelocity1m3 * mass3;
printf("The momentum of mass 3, trial 1 after the collision is %.3f (kg-m/s).\n",twoMomentum1m3);
// Total momentum after the collision in the system p1 + p3
float twoMomentum1m1m3 = twoMomentum1m1 + twoMomentum1m3;
printf("The total momentum in the system after the collision is %.3f (kg-m/s).\n", twoMomentum1m1m3);
// Calculate the percent difference (|P3-P1|/(|P1+P3|/2)) * 100
printf("The percent difference of trial 1 is %.3f.\n", ((twoMomentum1m3 - twoMomentum1m1) / ((twoMomentum1m3 + twoMomentum1m1) / 2)) * 100);
printf("\n");
// Trial 2
// User input of time value for mass 1 before collision
printf("What is the time for trial 2, mass 1, before the collision between points 1 and 2?\n");
scanf("%f", &t2_2mass1B4);
// User input of time value for mass 1 after collision
printf("What is the time for trial 2, mass 1, after the collision between points 2 and 1?\n");
scanf("%f", &t2_2mass1Aft);
// User input of time value for mass 3 after collision
printf("What is the time for trial 2, mass 3, after after the collision between points 3 and 4?\n");
scanf("%f", &t2_2mass3Aft);
// Calculate the velocity of mass 1 before collision
float twoVelocity2m1 = distance1To2 / t2_2mass1B4;
printf("The velocity of mass 1, trial 2 before the collision is %.3f (m/s).\n", twoVelocity2m1);
// Calculate the momentum of mass 1 before collision
float twoMomentum2m1 = twoVelocity2m1 * mass1;
printf("The momentum of mass 1, trial 2 before the collision is %.3f (kg-m/s).\n", twoMomentum2m1);
// Calculate the velocity of mass 1 after collision
float twoVelocity2m1Aft = distance1To2 / t2_2mass1Aft;
printf("The velocity of mass 1, trial 2 after the collision is %.3f (m/s).\n", twoVelocity1m1Aft);
// Calculate the momentum of mass 1 after the collision
float twoMomentum2m1Aft = twoVelocity2m1Aft * mass1;
printf("The momentum of mass 1, trial 2 after the collision is %.3f (kg-m/s).\n", twoMomentum2m1Aft);
// Calculate the velocity of mass 3 after the collision
float twoVelocity2m3 = distance3To4 / t2_2mass3Aft;
printf("The velocity of mass 3, trial 2 after the collision is %.3f (m/s).\n",twoVelocity2m3);
// Calculate the momentum of mass 3 after the collision
float twoMomentum2m3 = twoVelocity2m3 * mass3;
printf("The momentum of mass 3, trial 2 after the collision is %.3f (kg-m/s).\n",twoMomentum2m3);
// Total momentum after the collision in the system p1 + p3
float twoMomentum2m1m3 = twoMomentum2m1 + twoMomentum2m3;
printf("The total momentum in the system after the collision is %.3f (kg-m/s).\n", twoMomentum2m1m3);
// Calculate the percent difference (|P3-P1|/(|P1+P3|/2)) * 100
printf("The percent difference of trial 2 is %.3f.\n", ((twoMomentum2m3 - twoMomentum2m1) / ((twoMomentum2m3 + twoMomentum2m1) / 2)) * 100);
printf("\n");
// Trial 3
// User input of time value for mass 1 before collision
printf("What is the time for trial 3, mass 1, before the collision between points 1 and 2?\n");
scanf("%f", &t3_2mass1B4);
// User input of time value for mass 1 after collision
printf("What is the time for trial 3, mass 1, after the collision between points 2 and 1?\n");
scanf("%f", &t3_2mass1Aft);
// User input of time value for mass 3 after collision
printf("What is the time for trial 3, mass 3, after after the collision between points 3 and 4?\n");
scanf("%f", &t3_2mass3Aft);
// Calculate the velocity of mass 1 before collision
float twoVelocity3m1 = distance1To2 / t3_2mass1B4;
printf("The velocity of mass 1, trial 3 before the collision is %.3f (m/s).\n", twoVelocity3m1);
// Calculate the momentum of mass 1 before collision
float twoMomentum3m1 = twoVelocity3m1 * mass1;
printf("The momentum of mass 1, trial 3 before the collision is %.3f (kg-m/s).\n", twoMomentum3m1);
// Calculate the velocity of mass 1 after collision
float twoVelocity3m1Aft = distance1To2 / t3_2mass1Aft;
printf("The velocity of mass 1, trial 3 after the collision is %.3f (m/s).\n", twoVelocity3m1Aft);
// Calculate the momentum of mass 1 after the collision
float twoMomentum3m1Aft = twoVelocity3m1Aft * mass1;
printf("The momentum of mass 1, trial 3 after the collision is %.3f (kg-m/s).\n", twoMomentum3m1Aft);
// Calculate the velocity of mass 3 after the collision
float twoVelocity3m3 = distance3To4 / t3_2mass3Aft;
printf("The velocity of mass 3, trial 3 after the collision is %.3f (m/s).\n",twoVelocity3m3);
// Calculate the momentum of mass 3 after the collision
float twoMomentum3m3 = twoVelocity3m3 * mass3;
printf("The momentum of mass 3, trial 3 after the collision is %.3f (kg-m/s).\n",twoMomentum3m3);
// Total momentum after the collision in the system p1 + p3
float twoMomentum3m1m3 = twoMomentum3m1 + twoMomentum3m3;
printf("The total momentum in the system after the collision is %.3f (kg-m/s).\n", twoMomentum3m1m3);
// Calculate the percent difference (|P3-P1|/(|P1+P3|/2)) * 100
printf("The percent difference of trial 3 is %.3f.\n", ((twoMomentum3m3 - twoMomentum3m1) / ((twoMomentum3m3 + twoMomentum3m1) / 2)) * 100);
printf("\n");
// Trial 4
// User input of time value for mass 1 before collision
printf("What is the time for trial 4, mass 1, before the collision between points 1 and 2?\n");
scanf("%f", &t4_2mass1B4);
// User input of time value for mass 1 after collision
printf("What is the time for trial 4, mass 1, after the collision between points 2 and 1?\n");
scanf("%f", &t4_2mass1Aft);
// User input of time value for mass 3 after collision
printf("What is the time for trial 4, mass 3, after after the collision between points 3 and 4?\n");
scanf("%f", &t4_2mass3Aft);
// Calculate the velocity of mass 1 before collision
float twoVelocity4m1 = distance1To2 / t4_2mass1B4;
printf("The velocity of mass 1, trial 4 before the collision is %.3f (m/s).\n", twoVelocity4m1);
// Calculate the momentum of mass 1 before collision
float twoMomentum4m1 = twoVelocity4m1 * mass1;
printf("The momentum of mass 1, trial 4 before the collision is %.3f (kg-m/s).\n", twoMomentum4m1);
// Calculate the velocity of mass 1 after collision
float twoVelocity4m1Aft = distance1To2 / t4_2mass1Aft;
printf("The velocity of mass 1, trial 4 after the collision is %.3f (m/s).\n", twoVelocity4m1Aft);
// Calculate the momentum of mass 1 after the collision
float twoMomentum4m1Aft = twoVelocity4m1Aft * mass1;
printf("The momentum of mass 1, trial 4 after the collision is %.3f (kg-m/s).\n", twoMomentum4m1Aft);
// Calculate the velocity of mass 3 after the collision
float twoVelocity4m3 = distance3To4 / t4_2mass3Aft;
printf("The velocity of mass 3, trial 4 after the collision is %.3f (m/s).\n",twoVelocity4m3);
// Calculate the momentum of mass 3 after the collision
float twoMomentum4m3 = twoVelocity4m3 * mass3;
printf("The momentum of mass 3, trial 4 after the collision is %.3f (kg-m/s).\n",twoMomentum4m3);
// Total momentum after the collision in the system p1 + p3
float twoMomentum4m1m3 = twoMomentum4m1 + twoMomentum4m3;
printf("The total momentum in the system after the collision is %.3f (kg-m/s).\n", twoMomentum4m1m3);
// Calculate the percent difference (|P3-P1|/(|P1+P3|/2)) * 100
printf("The percent difference of trial 4 is %.3f.\n", ((twoMomentum4m3 - twoMomentum4m1) / ((twoMomentum4m3 + twoMomentum4m1) / 2)) * 100);
printf("\n");
// Trial 5
// User input of time value for mass 1 before collision
printf("What is the time for trial 5, mass 1, before the collision between points 1 and 2?\n");
scanf("%f", &t5_2mass1B4);
// User input of time value for mass 1 after collision
printf("What is the time for trial 5, mass 1, after the collision between points 2 and 1?\n");
scanf("%f", &t5_2mass1Aft);
// User input of time value for mass 3 after collision
printf("What is the time for trial 5, mass 3, after after the collision between points 3 and 4?\n");
scanf("%f", &t5_2mass3Aft);
// Calculate the velocity of mass 1 before collision
float twoVelocity5m1 = distance1To2 / t5_2mass1B4;
printf("The velocity of mass 1, trial 5 before the collision is %.3f (m/s).\n", twoVelocity5m1);
// Calculate the momentum of mass 1 before collision
float twoMomentum5m1 = twoVelocity5m1 * mass1;
printf("The momentum of mass 1, trial 5 before the collision is %.3f (kg-m/s).\n", twoMomentum5m1);
// Calculate the velocity of mass 1 after collision
float twoVelocity5m1Aft = distance1To2 / t5_2mass1Aft;
printf("The velocity of mass 1, trial 5 after the collision is %.3f (m/s).\n", twoVelocity5m1Aft);
// Calculate the momentum of mass 1 after the collision
float twoMomentum5m1Aft = twoVelocity5m1Aft * mass1;
printf("The momentum of mass 1, trial 5 after the collision is %.3f (kg-m/s).\n", twoMomentum5m1Aft);
// Calculate the velocity of mass 3 after the collision
float twoVelocity5m3 = distance3To4 / t5_2mass3Aft;
printf("The velocity of mass 3, trial 5 after the collision is %.3f (m/s).\n", twoVelocity5m3);
// Calculate the momentum of mass 3 after the collision
float twoMomentum5m3 = twoVelocity5m3 * mass3;
printf("The momentum of mass 3, trial 5 after the collision is %.3f (kg-m/s).\n",twoMomentum5m3);
// Total momentum after the collision in the system p1 + p3
float twoMomentum5m1m3 = twoMomentum5m1 + twoMomentum5m3;
printf("The total momentum in the system after the collision is %.3f (m/s).\n", twoMomentum5m1m3);
// Calculate the percent difference (|P3-P1|/(|P1+P3|/2)) * 100
printf("The percent difference of trial 5 is %.3f.\n", ((twoMomentum5m3 - twoMomentum5m1) / ((twoMomentum5m3 + twoMomentum5m1) / 2)) * 100);
printf("\n");
// END of Calculations for Table 2
printf("THIS IS A MARKER TO DECIPHER THE END OF TABLE 2 and THE BEGINNING OF TABLE 3_______________________________________________\n");
printf("\n");
printf("\n");
// Begin Calculations for Tabel 3
//TRIAL 1
// User input of time value for mass 1 before the collisiion
printf("What is the time for trial 1, mass 1, before the collision between points 1 and 2?\n");
scanf("%f", &t1_3mass1B4);
// User input of time value for mass 3 before the collision
printf("What is the time for trial 1, mass 3, before the collision between points 4 and 3?\n");
scanf("%f", &t1_3mass3B4);
// User input of time value for mass 1 after the collision
printf("What is the time for trial 1, mass 1, after the collision between points 2 and 1?\n");
scanf("%f", &t1_3mass1Aft);
// User input of time value for mass 3 after the collision
printf("What is the time for trial 1, mass 3, after the collision between points 3 and 4?\n");
scanf("%f", &t1_3mass3Aft);
// Calculate the velocity of mass 1 before the collision
float threeVelocity1m1 = distance1To2 / t1_3mass1B4;
printf("The velocity of mass 1, trial 1 before the collision is %.3f (m/s).\n", threeVelocity1m1);
// Calculate the momentum of mass 1 before the collision
float threeMomentum1m1 = threeVelocity1m1 * mass1;
printf("The momentum of mass 1, trial 1 before the collision is %.3f (kg-m/s).\n", threeMomentum1m1);
// Calculate the velocity of mass 3 before the collision
float threeVelocity1m3 = distance3To4 / t1_3mass3B4;
printf("The velocity of mass 3, trial 1 before the collision is %.3f (m/s).\n", threeVelocity1m1);
// Calculate the momentum of mass 3 before the collision
float threeMomentum1m3 = threeVelocity1m3 * mass1;
printf("The momentum of mass 3, trial 1 before the collision is %.3f (kg-m/s).\n", threeMomentum1m3);
// Claculate the velocity of mass 1 after the collision
float threeVelocity1m1Aft = distance1To2 / t1_3mass1Aft;
printf("The velocity of mass 1, trial 1 after the collision is %.3f (m/s).\n", threeVelocity1m1Aft);
// Calculate the momentum of mass 1 after the collision
float threeMomentum1m1Aft = threeVelocity1m1Aft * mass1;
printf("The momentum of mass 1, trial 1 after the collision is %.3f (kg-m/s).\n", threeMomentum1m1Aft);
// Calculate the velocity of mass 3 after the collision
float threeVelocity1m3Aft = distance3To4 / t1_3mass3Aft;
printf("The velocity of mass 3, trial 1 after the collision is %.3f (m/s).\n", threeVelocity1m1Aft);
// Calcculate the momentum of mass 3 after the collision
float threeMomentum1m3Aft = threeVelocity1m3Aft * mass1;
printf("The momentum of mass 3, trial 1 after the collision is %.3f (kg-m/s).\n", threeMomentum1m3Aft);
// Total momentum in the system before the collision (P1 + P3)
float threeMomentum1m1m3 = threeMomentum1m1 + threeMomentum1m3;
printf("The total momentum in the system before the collision is %.3f (kg-m/s).\n", threeMomentum1m1m3);
// Total momentum in the system after the collision (P1 + P3)
float threeMomentum1m1m3Aft = threeMomentum1m1Aft + threeMomentum1m3Aft;
printf("The total momentum in the system after the collision is %.3f (kg-m/s).\n", threeMomentum1m1m3Aft);
// Trial 2
// User input of time value for mass 1 before the collisiion
printf("What is the time for trial 2, mass 1, before the collision between points 1 and 2?\n");
scanf("%f", &t2_3mass1B4);
// User input of time value for mass 3 before the collision
printf("What is the time for trial 2, mass 3, before the collision between points 4 and 3?\n");
scanf("%f", &t2_3mass3B4);
// User input of time value for mass 1 after the collision
printf("What is the time for trial 2, mass 1, after the collision between points 2 and 1?\n");
scanf("%f", &t2_3mass1Aft);
// User input of time value for mass 3 after the collision
printf("What is the time for trial 2, mass 3, after the collision between points 3 and 4?\n");
scanf("%f", &t2_3mass3Aft);
// Calculate the velocity of mass 1 before the collision
float threeVelocity2m1 = distance1To2 / t2_3mass1B4;
printf("The velocity of mass 1, trial 2 before the collision is %.3f (m/s).\n", threeVelocity2m1);
// Calculate the momentum of mass 1 before the collision
float threeMomentum2m1 = threeVelocity2m1 * mass1;
printf("The momentum of mass 1, trial 2 before the collision is %.3f (kg-m/s).\n", threeMomentum2m1);
// Calculate the velocity of mass 3 before the collision
float threeVelocity2m3 = distance3To4 / t2_3mass3B4;
printf("The velocity of mass 3, trial 2 before the collision is %.3f (m/s).\n", threeVelocity2m1);
// Calculate the momentum of mass 3 before the collision
float threeMomentum2m3 = threeVelocity2m3 * mass1;
printf("The momentum of mass 3, trial 2 before the collision is %.3f (kg-m/s).\n", threeMomentum2m3);
// Claculate the velocity of mass 1 after the collision
float threeVelocity2m1Aft = distance1To2 / t2_3mass1Aft;
printf("The velocity of mass 1, trial 2 after the collision is %.3f (m/s).\n", threeVelocity2m1Aft);
// Calculate the momentum of mass 1 after the collision
float threeMomentum2m1Aft = threeVelocity2m1Aft * mass1;
printf("The momentum of mass 1, trial 2 after the collision is %.3f (kg-m/s).\n", threeMomentum2m1Aft);
// Calculate the velocity of mass 3 after the collision
float threeVelocity2m3Aft = distance3To4 / t2_3mass3Aft;
printf("The velocity of mass 3, trial 2 after the collision is %.3f (m/s).\n", threeVelocity2m1Aft);
// Calcculate the momentum of mass 3 after the collision
float threeMomentum2m3Aft = threeVelocity2m3Aft * mass1;
printf("The momentum of mass 3, trial 2 after the collision is %.3f (kg-m/s).\n", threeMomentum2m3Aft);
// Total momentum in the system before the collision (P1 + P3)
float threeMomentum2m1m3 = threeMomentum2m1 + threeMomentum2m3;
printf("The total momentum in the system before the collision is %.3f (kg-m/s).\n", threeMomentum2m1m3);
// Total momentum in the system after the collision (P1 + P3)
float threeMomentum2m1m3Aft = threeMomentum2m1Aft + threeMomentum2m3Aft;
printf("The total momentum in the system after the collision is %.3f (kg-m/s).\n", threeMomentum2m1m3Aft);
// Trial 3
// User input of time value for mass 1 before the collisiion
printf("What is the time for trial 3, mass 1, before the collision between points 1 and 2?\n");
scanf("%f", &t3_3mass1B4);
// User input of time value for mass 3 before the collision
printf("What is the time for trial 3, mass 3, before the collision between points 4 and 3?\n");
scanf("%f", &t3_3mass3B4);
// User input of time value for mass 1 after the collision
printf("What is the time for trial 3, mass 1, after the collision between points 2 and 1?\n");
scanf("%f", &t3_3mass1Aft);
// User input of time value for mass 3 after the collision
printf("What is the time for trial 3, mass 3, after the collision between points 3 and 4?\n");
scanf("%f", &t3_3mass3Aft);
// Calculate the velocity of mass 1 before the collision
float threeVelocity3m1 = distance1To2 / t3_3mass1B4;
printf("The velocity of mass 1, trial 3 before the collision is %.3f (m/s).\n", threeVelocity3m1);
// Calculate the momentum of mass 1 before the collision
float threeMomentum3m1 = threeVelocity3m1 * mass1;
printf("The momentum of mass 1, trial 3 before the collision is %.3f (kg-m/s).\n", threeMomentum3m1);
// Calculate the velocity of mass 3 before the collision
float threeVelocity3m3 = distance3To4 / t3_3mass3B4;
printf("The velocity of mass 3, trial 3 before the collision is %.3f (m/s).\n", threeVelocity3m1);
// Calculate the momentum of mass 3 before the collision
float threeMomentum3m3 = threeVelocity3m3 * mass1;
printf("The momentum of mass 3, trial 3 before the collision is %.3f (kg-m/s).\n", threeMomentum3m3);
// Claculate the velocity of mass 1 after the collision
float threeVelocity3m1Aft = distance1To2 / t3_3mass1Aft;
printf("The velocity of mass 1, trial 3 after the collision is %.3f (m/s).\n", threeVelocity3m1Aft);
// Calculate the momentum of mass 1 after the collision
float threeMomentum3m1Aft = threeVelocity3m1Aft * mass1;
printf("The momentum of mass 1, trial 3 after the collision is %.3f (kg-m/s).\n", threeMomentum3m1Aft);
// Calculate the velocity of mass 3 after the collision
float threeVelocity3m3Aft = distance3To4 / t1_3mass3Aft;
printf("The velocity of mass 3, trial 3 after the collision is %.3f (m/s).\n", threeVelocity1m1Aft);
// Calcculate the momentum of mass 3 after the collision
float threeMomentum3m3Aft = threeVelocity3m3Aft * mass1;
printf("The momentum of mass 3, trial 3 after the collision is %.3f (kg-m/s).\n", threeMomentum3m3Aft);
// Total momentum in the system before the collision (P1 + P3)
float threeMomentum3m1m3 = threeMomentum3m1 + threeMomentum3m3;
printf("The total momentum in the system before the collision is %.3f (kg-m/s).\n", threeMomentum3m1m3);
// Total momentum in the system after the collision (P1 + P3)
float threeMomentum3m1m3Aft = threeMomentum3m1Aft + threeMomentum3m3Aft;
printf("The total momentum in the system after the collision is %.3f (kg-m/s).\n", threeMomentum3m1m3Aft);
// Trial 4
// User input of time value for mass 1 before the collisiion
printf("What is the time for trial 4, mass 1, before the collision between points 1 and 2?\n");
scanf("%f", &t4_3mass1B4);
// User input of time value for mass 3 before the collision
printf("What is the time for trial 4, mass 3, before the collision between points 4 and 3?\n");
scanf("%f", &t4_3mass3B4);
// User input of time value for mass 1 after the collision
printf("What is the time for trial 4, mass 1, after the collision between points 2 and 1?\n");
scanf("%f", &t4_3mass1Aft);
// User input of time value for mass 3 after the collision
printf("What is the time for trial 4, mass 3, after the collision between points 3 and 4?\n");
scanf("%f", &t4_3mass3Aft);
// Calculate the velocity of mass 1 before the collision
float threeVelocity4m1 = distance1To2 / t4_3mass1B4;
printf("The velocity of mass 1, trial 4 before the collision is %.3f (m/s).\n", threeVelocity4m1);
// Calculate the momentum of mass 1 before the collision
float threeMomentum4m1 = threeVelocity4m1 * mass1;
printf("The momentum of mass 1, trial 4 before the collision is %.3f (kg-m/s).\n", threeMomentum4m1);
// Calculate the velocity of mass 3 before the collision
float threeVelocity4m3 = distance3To4 / t4_3mass3B4;
printf("The velocity of mass 3, trial 4 before the collision is %.3f (m/s).\n", threeVelocity4m1);
// Calculate the momentum of mass 3 before the collision
float threeMomentum4m3 = threeVelocity4m3 * mass1;
printf("The momentum of mass 3, trial 4 before the collision is %.3f (kg-m/s).\n", threeMomentum4m3);
// Claculate the velocity of mass 1 after the collision
float threeVelocity4m1Aft = distance1To2 / t4_3mass1Aft;
printf("The velocity of mass 1, trial 4 after the collision is %.3f (m/s).\n", threeVelocity4m1Aft);
// Calculate the momentum of mass 1 after the collision
float threeMomentum4m1Aft = threeVelocity4m1Aft * mass1;
printf("The momentum of mass 1, trial 4 after the collision is %.3f (kg-m/s).\n", threeMomentum4m1Aft);
// Calculate the velocity of mass 3 after the collision
float threeVelocity4m3Aft = distance3To4 / t4_3mass3Aft;
printf("The velocity of mass 3, trial 4 after the collision is %.3f (m/s).\n", threeVelocity4m1Aft);
// Calcculate the momentum of mass 3 after the collision
float threeMomentum4m3Aft = threeVelocity4m3Aft * mass1;
printf("The momentum of mass 3, trial 4 after the collision is %.3f (kg-m/s).\n", threeMomentum4m3Aft);
// Total momentum in the system before the collision (P1 + P3)
float threeMomentum4m1m3 = threeMomentum4m1 + threeMomentum4m3;
printf("The total momentum in the system before the collision is %.3f (kg-m/s).\n", threeMomentum4m1m3);
// Total momentum in the system after the collision (P1 + P3)
float threeMomentum4m1m3Aft = threeMomentum4m1Aft + threeMomentum4m3Aft;
printf("The total momentum in the system after the collision is %.3f (kg-m/s).\n", threeMomentum4m1m3Aft);
// Trial 5
// User input of time value for mass 1 before the collisiion
printf("What is the time for trial 5, mass 1, before the collision between points 1 and 2?\n");
scanf("%f", &t5_3mass1B4);
// User input of time value for mass 3 before the collision
printf("What is the time for trial 5, mass 3, before the collision between points 4 and 3?\n");
scanf("%f", &t5_3mass3B4);
// User input of time value for mass 1 after the collision
printf("What is the time for trial 5, mass 1, after the collision between points 2 and 1?\n");
scanf("%f", &t5_3mass1Aft);
// User input of time value for mass 3 after the collision
printf("What is the time for trial 5, mass 3, after the collision between points 3 and 4?\n");
scanf("%f", &t5_3mass3Aft);
// Calculate the velocity of mass 1 before the collision
float threeVelocity5m1 = distance1To2 / t5_3mass1B4;
printf("The velocity of mass 1, trial 5 before the collision is %.3f (m/s).\n", threeVelocity5m1);
// Calculate the momentum of mass 1 before the collision
float threeMomentum5m1 = threeVelocity5m1 * mass1;
printf("The momentum of mass 1, trial 5 before the collision is %.3f (kg-m/s).\n", threeMomentum5m1);
// Calculate the velocity of mass 3 before the collision
float threeVelocity5m3 = distance3To4 / t5_3mass3B4;
printf("The velocity of mass 3, trial 5 before the collision is %.3f (m/s).\n", threeVelocity5m1);
// Calculate the momentum of mass 3 before the collision
float threeMomentum5m3 = threeVelocity5m3 * mass1;
printf("The momentum of mass 3, trial 5 before the collision is %.3f (kg-m/s).\n", threeMomentum1m3);
// Claculate the velocity of mass 1 after the collision
float threeVelocity5m1Aft = distance1To2 / t5_3mass1Aft;
printf("The velocity of mass 1, trial 5 after the collision is %.3f (m/s).\n", threeVelocity5m1Aft);
// Calculate the momentum of mass 1 after the collision
float threeMomentum5m1Aft = threeVelocity5m1Aft * mass1;
printf("The momentum of mass 1, trial 5 after the collision is %.3f (kg-m/s).\n", threeMomentum5m1Aft);
// Calculate the velocity of mass 3 after the collision
float threeVelocity5m3Aft = distance3To4 / t5_3mass3Aft;
printf("The velocity of mass 3, trial 5 after the collision is %.3f (m/s).\n", threeVelocity5m1Aft);
// Calcculate the momentum of mass 3 after the collision
float threeMomentum5m3Aft = threeVelocity5m3Aft * mass1;
printf("The momentum of mass 3, trial 5 after the collision is %.3f (kg-m/s).\n", threeMomentum5m3Aft);
// Total momentum in the system before the collision (P1 + P3)
float threeMomentum5m1m3 = threeMomentum5m1 + threeMomentum5m3;
printf("The total momentum in the system before the collision is %.3f (kg-m/s).\n", threeMomentum5m1m3);
// Total momentum in the system after the collision (P1 + P3)
float threeMomentum5m1m3Aft = threeMomentum5m1Aft + threeMomentum5m3Aft;
printf("The total momentum in the system after the collision is %.3f (kg-m/s).\n", threeMomentum5m1m3Aft);
printf("\n");
printf("\n");
printf("\n");
// This Marks the end of the lab and also the end of this program
printf(“Thank you for using a Your Momma program. If you would like to donate a buck please feel free to give it to your nearest homeless person.”);
return 0;[/code]