This is the coffee-Machine-Kotlin project I made myself.
This project uses the basic of OOP, its main concepts such as classes, class methods and attributes, and get a taste of Kotlin. Practice working with functions, challenge yourself with loops and conditions, and get more confident with OOP.
What can be better than a cup of coffee during a break? A coffee that you don’t have to make yourself. It’s enough to press a couple of buttons on the machine and you get a cup of energy; but first, we should teach the machine how to do it. In this project, you will work on programming a coffee machine simulator. The machine works with typical products: coffee, milk, sugar, and plastic cups; if it runs out of something, it shows a notification. You can get three types of coffee: espresso, cappuccino, and latte. Since nothing’s for free, it also collects the money.
This project does the following tasks:
- Write a program that puts some basic information on the screen: let the machine describe what it takes to make a cup of coffee!
- Program the machine to calculate the amount of ingredients it needs depending on how many people want some coffee.
- Working with conditions, program the machine to estimate how many creamy coffees it can make based on the amount of ingredients we enter.
- Teach your virtual coffee machine to perform three basic actions: collect the money, renew the supplies, and serve the coffee.
- Program the machine to display on the screen the amount of supplies left. Set the main loop: now the menu keeps updating until you enter “exit”.
- Time for some final touch-ups: structure the code so that it runs smoothly.