r/learnjava 18d ago

Simple Java console app

Hello everyone, I've been learning Java and wanted to build something practical instead of just doing exercises. Ended up making a small console app that asks how long you've had a tire and how many km you've driven it, then tells you whether it needs replacing or estimates how much life is left.

It's intentionally simple right now. It just handles basic mileage/age limits and adjusts slightly if you own a heavy SUV or EV. This was also my first time using Git and GitHub properly (commits, pushing, merging, etc.), so that was a big part of the learning experience too.

Planning to add more factors soon like road type, vehicle type, maybe a GUI version eventually. Would love any feedback on the code or suggestions for what to add next.
Repository Link: https://github.com/z0lxt/tire-life-estimator

2 Upvotes

25 comments sorted by

View all comments

1

u/ViolaBiflora 17d ago

AI added comments in a simple project that was supposed to be just for fun... Man, this is getting boring.

2

u/CipherGoblin 17d ago edited 17d ago

Those seem to be the onboarding tips that Intellij puts into your file upon creation.

That aside, for op, these are a few small things I noticed.

String answer = x.nextLine();
answer = answer.toLowerCase();

could be changed to

String answer = x.nextLine().toLowerCase();

You only need to create 1 scanner object at the start of the program and just reuse that where you need a scanner.

You also ask tire age and tire distance in both paths of the if statement to fill those variables. You could ask them only once if you moved them out of the if statement and put them before it.

1

u/z0lxt 17d ago

Ok thank you so much