Skip to content

3N16MV/FuelEfficiencyCalculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Welcome to FuelEfficiencyCalculator — a simple Java program designed to compute the fuel cost per 100 miles and the maximum distance a vehicle can travel on a full tank of gas.

Features

· Accepts user input for:

- Number of gallons in the fuel tank

- Vehicle fuel efficiency (MPG)

- Price of gas per gallon

· Calculates:

- Cost to drive 100 miles

- Maximum distance the vehicle can travel on a full tank

· Displays monetary values formatted to exactly two decimal places

· Outputs travel distance as a whole number

· Beginner‑friendly Java code with clear variable names and console prompts

Installation

**Prerequisites**

· Java Development Kit (JDK 17 or later recommended)

· A Java‑compatible IDE or terminal environment

**Clone the Repository**

git clone https://github.com/3N16MV/FuelEfficiencyCalculator

Usage

You will be prompted to enter:

  1. Gallons of gas the tank can hold
  2. Fuel efficiency (MPG)
  3. Price per gallon of gas to the nearest hundredth

The program will then display:

  • Cost of gas per 100 miles
  • Distance the car can travel with a full tank of gas

Example

This program calculates the fuel efficiency of a vehicle in miles per gallon (MPG) and how far your car can travel

with a full tank of gas.

Please enter the number of gallons of gas your car can hold rounded to the nearest whole number: 20

Please enter the fuel efficiency of your car in miles per gallon (MPG) rounded to the nearest whole number: 23

Please enter the price of gas per gallon in dollars to the nearest hundredth cent (two decimal places): 5.49

The cost to drive 100 miles is: $23.87

The distance your car can travel with a full tank of gas is: 460 miles.

Contributions

Contributions to improve GPA Converter are welcome! Feel free to open issues or submit pull requests.

License

This project is released under the MIT License. See LICENSE file for details.

Support

For questions or issues, please open a GitHub issue in the repository.

About

A simple Java program designed to compute the fuel cost per 100 miles and the maximum distance a vehicle can travel on a full tank of gas.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages