Question

Write a function so that the main() code below can be replaced by the simpler code that calls function MphAndMinutesToMiles()Define stubs for the functions called by the below main(). Each stub should print FIXME: Finish FunctionName(followed by aIn C please

0 0
Add a comment Improve this question Transcribed image text
✔ Recommended Answer
Answer #1
Question 1:
Replace the line
/* Your solution goes here */
with below lines of code
double MphAndMinutesToMiles(double milesPerHour, minutesTraveled){
    return (minutesTraveled/60.0)*milesPerHour;
}

Question 2:
Replace the line
/* Your solution goes here */
with below lines of code
int GetUserNum(){
   printf("FIXME: Finish GetUserNum()\n");
   return -1;
}

int ComputeAvg(int n1, int n2){
   printf("FIXME: Finish ComputeAvg()\n");
   return -1;
}

Full Code:
#include <stdio.h>

int GetUserNum(){
   printf("FIXME: Finish GetUserNum()\n");
   return -1;
}

int ComputeAvg(int n1, int n2){
   printf("FIXME: Finish ComputeAvg()\n");
   return -1;
}

int main(void) {
   int userNum1; 
   int userNum2;
   int avgResult; 

   userNum1 = GetUserNum();
   userNum2 = GetUserNum();

   avgResult = ComputeAvg(userNum1, userNum2); 

   printf("Avg: %d\n", avgResult);

   return 0;
}  
Add a comment
Answer #2

Answer 1: 

double MphAndMinutesToMiles(double minutesTraveled, double milesPerHour){

   

  return (minutesTraveled/60.0) * milesPerHour;

   

}


Answer 2:

int GetUserNum(){

   printf("FIXME: Finish GetUserNum()\n");

   return -1;

}


int ComputeAvg(int n1, int n2){

   printf("FIXME: Finish ComputeAvg()\n");

   return -1;

}


answered by: Lee Ann Delarosa
Add a comment
Know the answer?
Add Answer to:
In C please Write a function so that the main() code below can be replaced by...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • THE LANGUAGE IS JAVA!! Define stubs for the methods called by the below main(). Each stub...

    THE LANGUAGE IS JAVA!! Define stubs for the methods called by the below main(). Each stub should print "FIXME: Finish methodName'followed by a newline, and should return -1. Example output: FIXME: Finish getUserNum() FIXME: Finish getUserNum() FIXME: Finish computeAvg() Avg: -1 import java.util.Scanner; 3 public class MthdStubsStatistics { 1* Your solution goes here */ public static void main(String [] args) { int userNum1; int userNum2; int avgResult; userNum1 = getUserNum(); userNum2 = getUserNum(); avgResult = computeAvg(userNumi, userNum2); System.out.println("Avg: " +...

  • All JAVA code 6.2.2: Define a method printFeetInchShort, with int parameters numFeet and numInches, that prints...

    All JAVA code 6.2.2: Define a method printFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand. Ex: printFeetInchShort(5, 8) prints: 5' 8" Hint: Use \" to print a double quote Sample program: import java.util.Scanner; public class HeightPrinter { /* Your solution goes here */ public static void main (String [] args) { printFeetInchShort(5, 8); System.out.println(""); return; } } 6.4.1: Define stubs for the methods called by the below main(). Each stub should print "FIXME: Finish...

  • Define stubs for the methods called by the below main(). Each stub should print "FIXME: Finish...

    Define stubs for the methods called by the below main(). Each stub should print "FIXME: Finish methodName()" followed by a newline, and should return -1. Example output: FIXME: Finish getUserNum() FIXME: Finish getUserNum() FIXME: Finish computeAverage() Avg: -1 import java.util.Scanner; public class MethodStubs{ /* Your solution goes here */ public static void main(String [] args) { int userNum1; int userNum2; int avgResult; MethodStubs stubTester = new MethodStubs(); userNum1 = stubTester.getUserNum(); userNum2 = stubTester.getUserNum(); avgResult = stubTester.computeAverage(userNum1, userNum2); System.out.println("Avg: " +...

  • C++ Write a function so that the main() code below can be replaced by the simpler...

    C++ Write a function so that the main() code below can be replaced by the simpler code that calls function MphAndMinutesToMiles(). Original main(): int main() { double milesPerHour; double minutesTraveled; double hoursTraveled; double milesTraveled; cin >> milesPerHour; cin >> minutesTraveled; hoursTraveled = minutesTraveled / 60.0; milesTraveled = hoursTraveled * milesPerHour; cout << "Miles: " << milesTraveled << endl; return 0; } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 #include <iostream> using...

  • Assign to maxSum the max of (numA, numB) PLUS the max of (numY, numZ). Use just...

    Assign to maxSum the max of (numA, numB) PLUS the max of (numY, numZ). Use just one statement. Hint: Call FindMax() twice in an expression. C++ please! #include <stdio.h> double FindMax(double num1, double num2) { double maxVal; // Note: if-else statements need not be understood to complete this activity if (num1 > num2) { // if num1 is greater than num2, maxVal = num1; // then num1 is the maxVal. } else { // Otherwise, maxVal = num2; // num2...

  • Use only C Program for this problem. Must start with given codes and end with given...

    Use only C Program for this problem. Must start with given codes and end with given code. CHALLENGE ACTIVITY 9.4.3: Input parsing: Reading multiple items. Complete scanf( to read two comma-separated integers from stdin. Assign userlnt1 and userInt2 with the user input. Ex: "Enter two integers separated by a comma: 3,5", program outputs: 3 + 5 = 8 1 #include <stdio.h> HNM 1 test passed int main(void) { int user Int1; int user Int2; All tests passed 000 printf("Enter two...

  • Convert the below C code to basic MIPS. Please leave comments for explanation #include <stdio.h> int main(void) {...

    Convert the below C code to basic MIPS. Please leave comments for explanation #include <stdio.h> int main(void) { printf("Insert two numbers\n"); int a,b; scanf("%d",&a); scanf("%d",&b); a=a<<2; b=b<<2; printf("%d&%d\n",a,b); return 0; }

  • Convert the below C code to basic MIPS. Leave comments for explanation please #include <stdio.h> int main(void) {...

    Convert the below C code to basic MIPS. Leave comments for explanation please #include <stdio.h> int main(void) { printf("Insert two numbers\n"); int a,b,c; scanf("%d",&a); scanf("%d",&b); c=a|b; printf("%d|%d=%d\n",a,b,c); return 0; }

  • answer in c++ Using the table below, complete the C++ code to write the function prototype...

    answer in c++ Using the table below, complete the C++ code to write the function prototype statement, and the void function header. The void function should receive three double variables: the first two by value and the last one by reference. Name the formal parameters num1, num2 and answer. The function should divide the num1 variable by the num2 variable and then store the result in the answer variable. Name the function calcQuotient. Also write an appropriate function prototype for...

  • i have no idea how to do floating point comparison this is c programming CHALLENGE 3.16.1:...

    i have no idea how to do floating point comparison this is c programming CHALLENGE 3.16.1: Floating-point comparison: Print Equal or Not equal Write an expression that will cause the following code to print "Equal" if the value of sensorReading is "close enough" to targetValue. Otherwise, print "Not equal". Ex: If targetValue is 0.3333 and sensorReading is (1.0/3.0), output is Equal 1 #include <stdio.h 2 #include <math.h> 4 int main(void)f 6 8 scanf("%lf", &targetValue); 1 test passed double targetValue; double...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT