calculator-typescript-alanch8
v1.0.6
Published
calculator
Readme
��#�#� �C�a�l�c�u�l�a�t�o�r� �L�i�b�r�a�r�y�
�
�
�
�>� �F�o�r� �e�d�u�c�a�t�i�o�n�a�l� �u�s�e�
�
�
�
�[�L�i�n�k� �t�o� �n�p�m� �l�i�b�r�a�r�y�]�(�h�t�t�p�s�:�/�/�w�w�w�.�n�p�m�j�s�.�c�o�m�/�p�a�c�k�a�g�e�/�c�a�l�c�u�l�a�t�o�r�-�t�y�p�e�s�c�r�i�p�t�-�a�l�a�n�c�h�8�)�
�
�
�
�-�-�-�
�
�
�
�#� �I�n�s�t�a�l�a�t�i�o�n�
�
�
�
�-� �U�s�e� �t�h�e� �f�o�l�l�o�w�i�n�g� �c�o�m�m�a�n�d� �t�o� �i�n�s�t�a�l�l� �t�h�e� �l�i�b�r�a�r�y� �i�n� �y�o�u�r� �p�r�o�j�e�c�t�
�
�
�
����j�a�v�a�s�c�r�i�p�t� �
�
�n�p�m� �i� �c�a�l�c�u�l�a�t�o�r�-�t�y�p�e�s�c�r�i�p�t�-�a�l�a�n�c�h�8�
�
����
�
�
�
�-� �I�m�p�o�r�t� �t�h�e� �l�i�b�r�a�r�y� �i�n�t�o� �y�o�u�r� �p�r�o�j�e�c�t� �l�i�k�e� �t�h�i�s�
�
�
�
����j�a�v�a�s�c�r�i�p�t� �
�
�i�m�p�o�r�t� �{�C�a�l�c�u�l�a�t�o�r�}� �f�r�o�m� �'�c�a�l�c�u�l�a�t�o�r�-�t�y�p�e�s�c�r�i�p�t�-�a�l�a�n�c�h�8�'�;�
�
����
�
�
�
�#�#� �M�e�t�h�o�d�s�
�
�
�
����j�a�v�a�s�c�r�i�p�t� �
�
�a�d�d�(�a�:�n�u�m�b�e�r�,�b�:�n�u�m�b�e�r�)�:�n�u�m�b�e�r�
�
����
�
�a�d�d�i�t�i�o�n� �o�f� �a� �a�n�d� �b� �v�a�r�i�a�b�l�e�s� �(�m�u�e�s�t� �b�e� �n�u�m�b�e�r�s�)�.� �
�
�r�e�t�u�r�n�s� �a� �+� �b�.�
�
�
�
����j�a�v�a�s�c�r�i�p�t� �
�
�s�u�b�s�(�a�:�n�u�m�b�e�r�,�b�:�n�u�m�b�e�r�)�:�n�u�m�b�e�r�
�
����
�
�s�u�b�s�t�r�a�c�t�i�o�n� �o�f� �a� �a�n�d� �b� �v�a�r�i�a�b�l�e�s� �(�m�u�e�s�t� �b�e� �n�u�m�b�e�r�s�)�.� �
�
�r�e�t�u�r�n�s� �a� �-� �b�.�
�
�
�
����j�a�v�a�s�c�r�i�p�t� �
�
�m�u�l�t�i�p�l�y�(�a�:�n�u�m�b�e�r�,�b�:�n�u�m�b�e�r�)�:�n�u�m�b�e�r�
�
����
�
�m�u�l�t�i�p�l�i�c�a�t�i�o�n� �o�f� �a� �a�n�d� �b� �v�a�r�i�a�b�l�e�s� �(�m�u�e�s�t� �b�e� �n�u�m�b�e�r�s�)�.� �
�
�r�e�t�u�r�n�s� �a� �*� �b�.�
�
�
�
����j�a�v�a�s�c�r�i�p�t� �
�
�d�i�v�(�a�:�n�u�m�b�e�r�,�b�:�n�u�m�b�e�r�)�:�n�u�m�b�e�r�
�
����
�
�d�i�v�i�s�i�o�n� �o�f� �a� �a�n�d� �b� �v�a�r�i�a�b�l�e�s� �(�m�u�e�s�t� �b�e� �n�u�m�b�e�r�s�)�.� �
�
�r�e�t�u�r�n�s� �a� �/� �b�.�
�
�
�
�I�f� �t�h�e� �b� �v�a�r�i�a�b�l�e� �i�s� �a� �z�e�r�o� �(�0�)� �n�u�m�b�e�r� �t�h�e� �p�r�o�g�r�a�m� �w�i�l�l� �t�h�r�o�w� �a� �m�a�t�h� �e�r�r�o�r�.�
�
�
�
�#� �H�o�w� �t�h�i�s� �l�i�b�r�a�r�y� �w�a�s� �b�u�i�l�t�
�
�
�
�I�n� �o�r�d�e�r� �t�o� �c�r�e�a�t�e� �a�n�d� �u�p�l�o�a�d� �t�h�i�s� �l�i�b�r�a�r�y� �t�o� �N�p�m�,� �w�e� �h�a�v�e� �u�s�e�d� �[�C�-�J� �K�i�h�l�]�(�h�t�t�p�s�:�/�/�m�e�d�i�u�m�.�c�o�m�/�@�c�a�r�l�j�o�h�a�n�.�k�i�h�l�)�'�s� �[�t�u�t�o�r�i�a�l�]�(�h�t�t�p�s�:�/�/�i�t�n�e�x�t�.�i�o�/�s�t�e�p�-�b�y�-�s�t�e�p�-�b�u�i�l�d�i�n�g�-�a�n�d�-�p�u�b�l�i�s�h�i�n�g�-�a�n�-�n�p�m�-�t�y�p�e�s�c�r�i�p�t�-�p�a�c�k�a�g�e�-�4�4�f�e�7�1�6�4�9�6�4�c�)� �f�r�o�m� �M�e�d�i�u�m�.�
�
�
�
�I�m�p�o�r�t�a�n�t� �t�h�i�n�g�s� �t�o� �k�e�e�p� �i�n� �m�i�n�d�;�
�
�-� �[�x�]� �S�t�a�r�t� �t�h�e� �p�r�o�j�e�c�t�
�
�-� �[�x�]� �C�o�n�f�i�g�u�r�e� �i�t�.�
�
�-� �[�x�]� �C�r�e�a�t�e� �a� �b�u�i�l�d� �(�t�r�a�n�s�p�i�l�e� �i�t� �w�i�t�h� �t�s�c�)�.�
�
�-� �[�x�]� �f�o�r�m�a�t� �i�t� �a�n�d� �p�a�i�n�t� �i�t� �w�i�t�h� �P�r�e�t�t�i�e�r� �a�n�d� �T�l�i�n�t�.�
�
�-� �[� �]� �T�e�s�t� �i�t� �w�i�t�h� �J�e�s�t� �i�n� �t�h�e� �b�e�s�t� �c�a�s�e�.�
�
�
�
�O�n�c�e� �t�h�e� �l�i�b�r�a�r�y� �i�s� �f�i�n�i�s�h�e�d�,� �w�e� �c�r�e�a�t�e� �a� �c�o�m�m�i�t� �a�n�d� �u�p�l�o�a�d� �i�t� �t�o� �g�i�t�h�u�b� �u�s�i�n�g� �g�i�t� �p�u�s�h� �i�n� �o�r�d�e�r� �t�o� �c�o�n�t�i�n�u�e� �w�i�t�h� �t�h�e� �s�t�e�p�s� �t�o� �u�p�l�o�a�d� �i�t� �t�o� �n�p�m�.�
�
�
�
�L�e�t�'�s� �p�u�b�l�i�s�h� �t�h�e� �l�i�b� �t�o� �n�p�m� �w�i�t�h�:�
�
�
�
����j�a�v�a�s�c�r�i�p�t�
�
�n�p�m� �p�u�b�l�i�s�h�
�
����
�
�
�
�A�n�d� �t�h�a�t�'�s� �a�l�l� � �<؉�.� �I�t�'�s� �i�n�t�e�r�s�t�i�n�g�t� �t�o� �k�n�o�w� �w�e� �c�a�n� �m�a�k�e� �d�i�f�e�r�e�n�t� �v�e�r�s�i�o�n�s� �w�i�t�h�:�
�
�
�
����j�a�v�a�s�c�r�i�p�t�
�
�n�p�m� �v�e�r�s�i�o�n� �p�a�t�c�h�
�
����
�
�
�
�
�
�T�h�a�n�k�s� �f�o�r� �r�e�a�d�i�n�g�!� �
�
�
�
�
�
�
�
�
�
�
�
�
�
�-�-�-�
�
�
�
�A�i�t�o�r� �L�a�n�c�h�a�r�r�o� �"�A�l�a�n�c�h�8�"� �&
�
�
�
�
