Note: Could you plz go through this code and let me
know if u need any changes in this.Thank You
_________________
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
// Function Declarations
void GasCost(double miles,double *gasTotalPtr);
void TripTime(double miles,double *totalTimePtr,int *hoursPtr,int
*minutesPtr);
int main()
{
//Declarin variables
double miles,gas,time;
int hours,minutes;
//Getting the input entered by the user
printf("Enter no of miles travelled :");
scanf("%lf",&miles);
GasCost(miles,&gas);
printf("Cost of Gas :$%.2lf\n",gas);
TripTime(miles,&time,&hours,&minutes);
printf("Total Trip Time :%.2f\n",time);
printf("Which is %d hours and %d minutes
\n",hours,minutes);
return 0;
}
//This function will calculate the gas cost
void GasCost(double miles,double *gasTotalPtr)
{
double ppg,mpg;
printf("Enter price per gallon
:$");
scanf("%lf",&ppg);
printf("Enter miles per gallon
:");
scanf("%lf",&mpg);
*gasTotalPtr=(miles/mpg)*ppg;
}
//This function will calculate the total trip
time
void TripTime(double miles,double *totalTimePtr,int *hoursPtr,int
*minutesPtr)
{
*totalTimePtr=(miles/75);
*hoursPtr=*totalTimePtr;
*minutesPtr=(*totalTimePtr-*hoursPtr)*60;
}
________________________
Output:
_______________Could you plz rate me well.Thank
You
Must Follow Example code //Add name, date, and description here //preprocessor directives #de fine CRT SECURE...
Complete the incomplete code provided //Add name, date, and description here //preprocessor directives #de fine CRT SECURE NO WARNINGS #includestdio.h> - //Calculate the cost of the gas on a trip /Ideclare, ask, and get the price per gallon and the mpg /Icalculate and return (by reference) the cost of gas for the number of miles passed to the function void GasCost (double miles, double *gasTotalPtr) //using a 70 MPH speed limit and the miles passed to the function //calculate and...
// Enter your name as a comment for program identification // Program assignment TripCost.cpp // Enter your class section, and time /* The program TripCost.cpp uses pointers to calculate the cost of a trip depending on the cost of a gallon of gas, the number of miles, and the number of miles per gallon a car gets. */ /* The cost of gas, the number of miles, and number of miles per gallon is entered. */...
In C please Write a function so that the main() code below can be replaced by the simpler code that calls function MphAndMinutesToMiles(). Original maino: int main(void) { double milesPerHour, double minutes Traveled; double hours Traveled; double miles Traveled; scanf("%f", &milesPerHour); scanf("%lf", &minutes Traveled); hours Traveled = minutes Traveled / 60.0; miles Traveled = hours Traveled * milesPerHour; printf("Miles: %1f\n", miles Traveled); return 0; 1 #include <stdio.h> 3/* Your solution goes here */ 1 test passed 4 All tests passed...
In C code 1. Write and submit the algorithm OR flowchart to indicate you understand the problem 2. Create a project and name the source code lastname_firstname_prog5.c 3. Use the prog5.c as a guide, copy/ paste into your project source code *** build run and test, the outline code - You will need to declare an integer variable called again and initialize it 4. Add the function prototype and implement the function definition for the Greeting function 5. Add the...
please help me add on this java code to run public class CarHwMain public static void main(String args 1/ Construct two new cars and one used car for the simulation Cari carl = new Car W"My New Mazda", 24.5, 16.0); Car car2 = new Cart My New Ford" 20.5, 15.0) Cari car) - new Cari ("My Used Caddie", 15.5, 16.5, 5.5, 1/ ADD CODE to completely fill the tanks in the new cars and off the used cars ton //...
Add additional information to the student class below such as name, address, major, and contact information along with all the getters and setters (methods) needed to access all data. Submit your code along with a sample run of your program. Comment all your code. Cite any sources of information you use. Write a note on the process of completing the assignment in a Microsoft Word document. // ShowStudent.java // client to test the Student class class ShowStudent { public static...
1. Write code for a function that receives two parameters (a,and b) by value and two more parameters (c and d) by reference. All parameters are double. The function works by assigning c to (a/b) and assigning d to (a*b). The function has no return value. From main, use scanf to get two numbers, then call the function, and then display both outcome values to the output in a printf statement. 2. After part 1 is completed, write code to...
Add additional information to the student class below such as name, address, major, and contact information along with all the getters and setters (methods) needed to access all data. Submit your code along with a sample run of your program. Comment all your code. Cite any sources of information you use. Write a note on the process of completing the assignment in a Microsoft Word document. // ShowStudent.java // client to test the Student class class ShowStudent { public static...
A) One of the problems that have been discussed in the class is to write a simple C++ program to determine the area and circumference of a circle of a given radius. In this lab you will be rewriting the program again but this time you will be writing some functions to take care of the user input and math. Specifically, your main function should look like the following: int main() { double radius; double area; double circumference; //the radius...
C++ programming question will upvote A) One of the problems that have been discussed in the class is to write a simple C++ program to determine the area and circumference of a circle of a given radius. In this lab you will be rewriting the program again but this time you will be writing some functions to take care of the user input and math. Specifically, your main function should look like the following int main //the radius of the...