Question: In C Code areaOfRectangle.c #include // Function Prototype double areaOfRectangle(double side1, double side2); int main (void) { // Variable to store the computed area of
In C Code

areaOfRectangle.c
#include
// Function Prototype double areaOfRectangle(double side1, double side2);
int main (void) {
// Variable to store the computed area of rectangle double rectangleArea;
// Function Call to compute the area of rectangle rectangleArea = areaOfRectangle(45.2, 89.1);
// Display the computed area of rectangle printf("Area of the Rectangle = %f ", rectangleArea);
return 0; }
// Function Definition double areaOfRectangle(double side1, double side2) {
double area; // local variable to store computed area by two sides
area = side1 * side2; // compute the area
return area; // return the computed value }
===============================================================
utils.c
#include
// include the header file that contains the function prototype #include "utils.h"
// Function definition double areaOfRectangle(double side1, double side2) {
double area; // local variable to store computed area by two sides
area = side1 * side2; // compute the area
return area; // return the computed value } ===========================================================
utilsTester.c
#include
// include the header file containing the function prototype #include "utils.h"
int main(void) {
// Variable to store the computed area of rectangle double rectangleArea;
printf(" Test Case 1: "); printf("Expected Output: Area of Rectangle = %f ", 10.0); rectangleArea = areaOfRectangle(5.0, 2.0); // Function Call to compute the area of rectangle printf("Program Output: Area of Rectangle = %f ", rectangleArea);
printf(" Test Case 2: "); printf("Expected Output: Area of Rectangle = %f ", 25.0); rectangleArea = areaOfRectangle(5.0, 5.0); // Function Call to compute the area of rectangle printf("Program Output: Area of Rectangle = %f ", rectangleArea);
printf(" Test Case 3: "); printf("Expected Output: Area of Rectangle = %f ", 100.0); rectangleArea = areaOfRectangle(10.0, 10.0); // Function Call to compute the area of rectangle printf("Program Output: Area of Rectangle = %f ", rectangleArea);
return 0; }
===========================================================================
utils.h
/** * A function to compute area of a rectangle based on its two sides */ double areaOfRectangle(double side1, double side2);
1. double degreesToRadians (double degree); - Write a function to convert de- grees to radians using the formula - d a 180 2. Write a function to compute the air distance between two locations identified by their latitude/longitude. 1 double getAirDistance (double originLatitude, double originLongitude, double destinationLatitude, double destinationLongitude); The air distance between two latitude/longitude points can be calculated using the Spherical Law of Cosines: d= arccos (sin(41) sin(42) + cos(41) cos(42) cos(A)) R where 41 is the latitude of location A, 42 is the latitude of location B A is the difference between location B's longitude and location A's longitude R is the aver - 125% + 2/3 3. An object traveling at a velocity v experiences time dilation relative to a stationary object which is quantified by the Lorentz equation: T=- 1 (1 - ) where t is the normal amount of lapsed time stationary object) and T is the dilated time experienced by the traveling object. For small velocities, the dilation is small, but for velocities approaching a percentage of the speed of light, c, the dilation becomes significant. For example, at 25% the speed of light, a year for the object traveling would corre- spond to 1.032 years at the stationary object. A person traveling at high velocity would experience "slowed time relative to the stationary frame. Implement a func- tion to compute the dilated time given the normal time t (units may vary) and the percentage of the speed of light. 1 double lorentzTimeDilation (double t, double percentc)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
