R=v2 sin2&/g
v = 30.0 (speed of the throwing), g = 9.8 (gravity), and $= angle in radians
User may insert an angle above or equal 45° and below 60° as the highest angle.
Then the program should calculate the horizontal range of the projectile motion (R) for each angle until the angle become 35°.
Consider the gravity (g) as a constant.
You are required to calculate the 𝜃 in radians by using the given formula (PI = 3.14286 which is a constant).
Use the necessary header files to do the calculation.
Write a C++ program to calculate time dilation (t) in motion, when the speed of the moving objects (v) is given by the user. The given below is the equation to calculate the time dilation.
v = speed of the moving object, c = 15000 ms-1(speed of light), and t0 = 75 s (time in observers own frame of reference)
Write a C++ program to calculate the maximum height when the user gives the angle (in degrees). The given below is the equation to calculate the maximum height.
v = 10.568 (initial velocity), g = 9.8 (acceleration due to gravity), θ = angle of the initial velocity from horizontal plane in radians and H = maximum height
Note: Assign the above values for v, g and PI. Consider the g (acceleration due to gravity) is a constant.
Create an Investment class that contains fields to hold the initial value of an investment, the current value, the profit (calculated as the difference between current value and initial value),and the percent profit (the profit divided by the initial value). Include a constructor that requires initial and current values and a display function. Create a House class that includes fields for street address and square feet, a constructor that requires values for both fields, and a display function. Create a HouseThatIsAnInvestment class that inherits from Investment and House. It includes a constructor and a display function that calls the display functions of the parents. Write a main()function that declares a HouseThatIsAnInvestment and displays its values.
Compile Time Polymorphism IV
Develop a program to overload binary operators.
The class Complex has the following public attributes
Data typeVariable nameintrealintimaginary
Include default constructor to initialize real and imaginary values to 0
Include the following functions in the Complex class and overload the binary operators
Member functionFunction descriptionvoid getvalue()This function is used to read .
void display()This function will display the result value
Sample Input and Output :
[All texts in bold represents input and rest represents output statements]
Enter the value of Complex Numbers a,b :4 5
Enter the value of Complex Numbers a,b :7 8
Input Values :
Output Complex number : 4+5i
Output Complex number : 7+8i
Result :
Output Complex number : 11+13i
Output Complex number : -3-3i