IDNLearn.com connects you with experts who provide accurate and reliable answers. Join our knowledgeable community and get detailed, reliable answers to all your questions.

Write a program that will calculate the fuel mileage for a car over a month (4 weeks). The user needs to enter all information required for this calculation is a neat and well developed input menu. Use the following test data to verify your program. Create a neat and block output screen. Make sure your numbers are aligned and format your decimal points to two decimal places. Use Visual Basic.
Test Data:
First Day Of Week Gallons Miles GPA
01/04/2009 5.0 173.0 34.60
01/11/2009 6.0 201.0 33.50
01/18/2009 4.5 121.0 26.89
01/25/2009 4.5 142.0 31.56


Sagot :

To calculate the mileage we need the formula for mileage

mileage = miles / gallon

Program needed in java :

import java.util.Scanner;

class mileagehistory

{

public static void main(String args[])

{

Scanner scan = new Scanner(System.in);

      System.out.print("Enter miles travelled for the First Day Of Week: ");

      double miles = scan.nextDouble();

      System.out.print("Enter gallons  Miles GPA for the first week: ");

      double gallons= scan.nextDouble();  

      System.out.print("miles per gallons = "+distance(miles,gallons));

}

static double distance(double m,double g)

{

return m/g;

}

}

// for the above code repeat for 4 months with 4 weeks each

Hence above code returns the 4-month calculation

To know more on programming follow this link:

https://brainly.com/question/23275071

#SPJ4

We appreciate your participation in this forum. Keep exploring, asking questions, and sharing your insights with the community. Together, we can find the best solutions. Your questions find answers at IDNLearn.com. Thanks for visiting, and come back for more accurate and reliable solutions.