Solution

//Programmer: Bushra Anjum date: 1-30-15

//File: hw2.cpp class: cs 1570

//Purpose: This file contains the main function for the program

// that inputs measurements linear and angular and calculates

// point of origin of green goo wall spatters.

#include <iostream>

#include <cmath>

using namespace std;

int main()

{

//Constant for adjusting spread

const int EXPANSION_FACTOR = 1;

//Variables for taking input

int length, width, height;

float gamma;

//Variables for doing the calculations

float alpha, beta; //angles

float v_y, v_x; //origination point positions

//Greetings and Input

cout<<"\n\nGreetings Action Jackson! You are running the GGPA program\n\n\n";

cout<<"Please enter the height from the floor to the goo spatter in inches: ";

cin>>height;

cout<<"Please enter the width of the spatter in inches: ";

cin>>width;

cout<<"Please enter the length of the spatter in inches: ";

cin>>length;

cout<<"Please enter the angle gamma in radians: ";

cin>>gamma;

//Calculations

//Trignometry

alpha = asin(static_cast<float>(width-EXPANSION_FACTOR)/length-EXPANSION_FACTOR);

beta = atan (tan(alpha)/sin(gamma));

v_y = height * tan(alpha);

v_x = v_y * tan(beta);

//Displaying output to the user

cout<<"\n\nYou have input:\n\theight = "<<height;

cout<<"\n\twidth = "<<width;

cout<<"\n\tlength = "<<length;

cout<<"\n\tgamma = "<<gamma;

cout<<"\nThe origination coordinates are x: "<<v_x<<" and y: "<<v_y<<endl;

cout<<"\n\nSigning off now ... \n"<<endl;

return 0;

}