I need a c code for with three classes 1st class is launcher
I need a c++ code for with three classes. 1st class is launcher, 2nd class is projectile, 3rd class is target. the target moves in a circle (like a satellite). the launcher is in a stationed wherever you like. let the user input target speed and projectile speed. display must exhibit the following: target initial location, target speed, center and radius of trajectory,launcher initial location, then for each time step display target and projectile locations until impact
the launcher can is located at 40,20. The initial ocation of target is 50,-10. The targets location moves according to formula Tx=center of circle + radius*sintheta. Ty= center of circle +radius*costheta. The distance formula from launcher to target is sqrt((target locationX-launch locationX)^2 +(target locationY -launch locationY)^2)) User must be able to enter speed of launcher and target
Solution
#include <iostream.h>
#include <math.h>
// Declare objects in global scope to be used by all functions, vel (velocity) ang (degress)
// and total to hold calculation of distance being less than or greater than 0.1
double vel, ang, total;
// Constructor for function playGame
void playGame(double uDistance);
// Constructor for function convertRadians
double convertRadians(double& radians);
// Constructor for function calculateDistance
double calculateDistance(double uDistance);
// Begin program with main() statement of void type
void main()
{
// Declare a uDistance variable for user defined distance
double uDistance;
char prompt;
// Do the following steps
do
{
// Introduce user to program
cout << \"************* Projectile Game *************\" << endl;
cout << \"Welcome to the projectile game! Please enter a distance--\";
// Get input from user for uDistance
cin >> uDistance;
// Play the game, use function playGame
playGame(uDistance);
// Ask user if they would want to play again
cout << \"Would you like to play again? Enter Y for yes, any other character otherwise.\" << endl;
cin >> prompt;
cout << endl;
cout << endl;
}
while (prompt == \'Y\' || prompt == \'y\');
cin.get();
}
void playGame(double uDistance)
{
// Begin for
for (int tries = 1; tries <= 5; tries++)
{
// Ask user for angle input
cout << \"Please enter an angle--\";
cin >> ang;
// Convert angle value to radians
convertRadians(ang);
cout << \"Please enter a velocity--\";
cin >> vel;
// Call upon calculateDistance to find if user wins or not
calculateDistance(uDistance);
if (total <= 0.1)
{
cout << \"You won the game!\" << endl;
cout << \"You came within \" << total << \" of the target! Congratulations!\" << endl;
break; // Break out of the for loop
}
else
{
cout << \"You didn\'t win the game, please try again.\" << endl;
cout << \"You came within \" << total << \" of the target.\" << endl;
cout << endl;
}
// End if
}
// End for
}
double convertRadians(double& radians)
{
radians = ((ang*3.14159)/180);
return radians;
}
double calculateDistance(double uDistance)
{
double distance;
double sinTotal = (2 * ang);
distance = (((vel*vel) * sin(sinTotal)/32.2));
total = distance/uDistance;
return total;
}

