79349683

Date: 2025-01-12 09:56:50
Score: 2
Natty:
Report link

This call after scanner.next() causes a blank line in the command-line session:

    System.out.println();

Just leave it out. Then the interaction looks like this:

How many gallons of Petrol would you like to add: 2.3
Adding 2.3 gallons of fuel to the tank

As @shmosel said you may also want to use print() rather than println() in your two catch blocks just like you do at the top of your method.

Reasons:
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • User mentioned (1): @shmosel
  • Low reputation (1):
Posted by: Tarita Kim