Skip to content

BRDLF/Hyperskill_Kotlin_SmartCalculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 

Repository files navigation

Hyperskill_Kotlin_SmartCalculator

This was the 8th project I completed as part of Jetbrain Academy's "Kotlin Basics" course

It is rated as a challenging difficulty project. The goal is to make a calculator that does all kinds of calculations! It was a lot of fun. I learned some nice maths, and got to get really involved with regex

From the /help command:

        This program does math!
        
        Here are some things it can do:
        
    Assign a variable to a number:
        [variable_name]=[a_number]
        a = 2
        b = 3
        
    Assign a variable to another variable that's already defined:
        [variable_name]=[another_variable_name]
        a = 2 
        b = a 
        now, both a and b are equal to 2
    
    Assign a variable to an expression:
        
        c = 2*a+b^6
        this only works if 'a' and 'b' are already defined.
        
    Re-assign variables.
        Input:
        a = 1 
        b = a 
        a = 3 
        Note, b is now also equal to 3
        You can learn more about this by typing /variables
        
    Evaluate expressions using variables or numbers
        Supported operators: +, -, *, /
        1 + 2 
        output: 3
        3 * 5 
        output: 15
        
    Evaluate more complicated expressions, taking care to follow expression priority:
        2 - 1 * 8 + 6 / 2 
        output: -3
        3 + 8 * ((4 + 3) * 2 + 1) - 6 / (2 + 1) 
        output: 121
        
    That's about everything.
        
    Command List:
        /commands   - Shows all commands available in the command list.
        /help       - Prints the help message.
        /list       - Lists currently assigned variables.
        /variables  - Gives you more information about how the program handles variables
        /exit       - Turns off the program

I have also included the tests that Hyperskill uses to determine if a project is complete.