From 9d53d8857eaa1c9405894a88ca75bc4657e42f35 Mon Sep 17 00:00:00 2001 From: msglm Date: Sat, 14 Jan 2023 05:31:48 -0600 Subject: Inital Commit --- Java/LastChanceGas.java | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Java/LastChanceGas.java (limited to 'Java/LastChanceGas.java') diff --git a/Java/LastChanceGas.java b/Java/LastChanceGas.java new file mode 100644 index 0000000..e43d96f --- /dev/null +++ b/Java/LastChanceGas.java @@ -0,0 +1,34 @@ +import java.io.BufferedReader; +import java.io.InputStreamReader; + +class LastChanceGas { + public static void main(String[] args) throws java.io.IOException { + int TankCap,Gage,MPG; + System.out.println("Tank Capacity"); + BufferedReader TankCapin = new BufferedReader(new InputStreamReader(System.in)); + TankCap = Integer.parseInt(TankCapin.readLine()); + + System.out.println("Gage Reading"); + BufferedReader Gagein = new BufferedReader(new InputStreamReader(System.in)); + Gage = Integer.parseInt(Gagein.readLine()); + + System.out.println("MPG"); + BufferedReader MPGin = new BufferedReader(new InputStreamReader(System.in)); + MPG = Integer.parseInt(MPGin.readLine()); + + int ToteGas = (TankCap*(Gage/100))*MPG; + + if (ToteGas < 200) { + System.out.println("Get Gas"); + } else { + System.out.println("safe to travel"); + } + + + + + + } +} + +//By msglm; Licensed under the AGPL v3 -- cgit v1.2.3