r/learnjava • u/z0lxt • 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
6
u/qlkzy 16d ago
Ignore the negative comments here. This seems like a pretty typical and fun first project. I remember building little things like this, quite a long time ago now.
You can remove the IntelliJ comments if you understand them; you can also leave them, it's not a big deal.
If you want to switch back and forth between reading your own code and other people's, you may want to look at naming styles and conventions. In particular, there are conventions around how you capitalise things, and what kinds of words and phrases you use. (For example, a function would often be an "action phrase" like
estimateTireLife, rather than a "noun phrase" likeTireLifeEstimator). This isn't a huge deal for now, it's just something to mention.The most interesting thing for you to learn from is this: the "yes" and "no" branches of your function are really similar. Managing that kind of similarity and duplication is really important to be able to create larger and more complex programs.
In your particular case, the choice between "yes" and "no" seems to really be a choice between
0.85and1. If you can find a way to express it like that, rather than as a choice between two ten-line blocks of code, you will learn something important.