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.
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.