Suppose you have a String containing some mathematical operation(s). For example, we need to perform the following calculation, but for various reasons, the data type is a String: (10*(34+92)-23)/4. Rather than figuring out ways to parse it (e.g. split or some fancy regex), we can use Java’s ScriptEngine to evaluate the function as is.
During my graduate studies, one of my projects for a networking class involved simulating TCP/IP at the application layer between nodes across a network. This “micro-Internet” consists of hosts and routers, each having the capability to emulate TCP’s reliable communication and IP’s packet forwarding. The source code is available for download here.
Data types in Java and C++ (amongst other languages) are limited to a specified range. Even the majority of basic calculators will usually return an error if you attempt to perform an operation using a number larger than 9 digits. Of course, there are libraries in Java (and likely in C++) that will let you overcome these limitations (e.g. java.math.BigInteger). This long integer abstract data type is my own implementation in C++. Because the code for this project is somewhat extensive, I will only post the header files and smaller source files. The full source code can be downloaded here.