Complete the incomplete code provided
//C program
#include<stdio.h>
void GasCost(double miles , double *gasTotalPtr);
void TripTime(double miles , double *totalTimePtr , int*hoursPtr
,int *minutePtr);
int main(){
printf("********Welcome to
converter***********\n\n");
double miles , gas , time;
int hours,minutes;
printf("Enter mile to drive : ");
scanf("%lf",&miles);
GasCost (miles , &gas);
TripTime(miles ,
&time,&hours,&minutes);
printf("\nGas Cost : %lf\n",gas);
printf("Total time : %lf\n",time);
printf("Time : %d hour %d
minutes\n",hours,minutes);
return 0;
}
void GasCost(double miles , double *gasTotalPtr){
double cpg,mpg;
printf("Enter cost per gallon : ");
scanf("%lf",&cpg);
printf("Enter mile per gallon : ");
scanf("%lf",&mpg);
*gasTotalPtr = (miles/mpg)*cpg;
}
void TripTime(double miles , double *totalTimePtr , int*hoursPtr
,int *minutePtr){
*totalTimePtr = miles/70;
*hoursPtr = (int)*totalTimePtr;
*minutePtr = (*totalTimePtr-*hoursPtr)*60;
}
//sample output
//Add name, date, and description here //preprocessor directives #de fine CRT SECURE NO WARNINGS ...
Must Follow Example code //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 return...
// 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. */...
Drivers are concerned with the mileage their automobiles get. One driver has kept track of several tankfuls of gasoline by recording the miles driven and gallons used for each tankful. Develop a C# app that will input the miles driven and gallons used (both as integers) for each tankful. The app should calculate and display the miles per gallon obtained for each tankful and display the combined miles per gallon obtained for all tankfuls up to this point. All averaging...
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...
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...
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...
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...