Banner. Photo by Author.

JavaFX Meal Planner

Fall 2018

The goal of this project was to create a multi-platform application for diet organization and nutrition tracking, and all work was performed in a four-student team using GitHub. We used efficient data structures taught in class to maintain and quickly search a database of over a million food items. We later tested the application using ten million items, and performance was not significantly affected. We used the JavaFX platform to design our application since it is native to Java 8 and requires no third-party libraries. The GUI is all created from containers within Java FX, with CSS files to format the appearance of the GUI.

Grindelwald, Switzerland

Figure 1: The main window, which displays all the food items, filtering options, and meal items.

Prior to beginning the programming, we sketched all potential GUI designs and weighed the pros and cons of each. We also had some flexibility in the features that we wanted to include such as how to maintain multiple meals and how we wanted the user to input each food item.ß

Filtering

According to the problem statement, our application had to be able to handle over a million food items without becoming noticeably sluggish. In order to filter the food items efficiently, we implemented a B+ tree with a range search functionality. The data processing class stores one instance of the B+ tree for each nutrient value, and returns the intersection of filtered sets when multiple filters are applied. The time complexity of filtering for each rule is then O(log2(m) logm(n)), where m is the branching factor of the B+ tree and n is the height.

Grindelwald, Switzerland

Figure 2: Multiple filters can be applied at once.

Meal Analysis

When the user clicks the "Analyze Meal" button, they are presented with an additional window, which displays the total nutrients in their meal. The food items are also presented as a bar graph where it's easier to see the most nutrient-rich and the unheathiest food items in the meal.

Grindelwald, Switzerland

Figure 3: The meal analysis window.

Conclusion

This project was a valuable first experience in GUI design, and an interesting implementation of a broad range of topic covered in my CS classes so far. JavaFX seems to be a powerful tool that, when packaged as an executable application, can result in surprisingly professional-looking projects. I plan to use JavaFX to give some of my future projects a polished GUI.