Line data Source code
1 1 : /** 2 : 3 : @file Calculator.java 4 : @brief This file serves as a demonstration file for the Calculator class. 5 : @details This file contains the implementation of the Calculator class, which provides various mathematical operations. 6 : */ 7 : 8 : /** 9 : 10 1 : @package com.ucoruh.calculator 11 : @brief The com.ucoruh.calculator package contains all the classes and files related to the Calculator App. 12 : */ 13 : package com.ucoruh.calculator; 14 : 15 : import org.slf4j.LoggerFactory; 16 : 17 : import ch.qos.logback.classic.Logger; 18 : /** 19 : 20 : @class Calculator 21 : @brief This class represents a Calculator that performs mathematical operations. 22 : @details The Calculator class provides methods to perform mathematical operations such as addition, subtraction, multiplication, and division. It also supports logging functionality using the logger object. 23 : @author ugur.coruh 24 : */ 25 1 : public class Calculator { 26 : 27 : /** 28 : * @brief Logger for the Calculator class. 29 : */ 30 1 : private static final Logger logger = (Logger) LoggerFactory.getLogger(Calculator.class); 31 : 32 : /** 33 : * @brief Calculates the sum of two integers. 34 : * 35 : * @details This function takes two integer values, `a` and `b`, and returns their sum. It also logs a message using the logger object. 36 : * 37 : * @param a The first integer value. 38 : * @param b The second integer value. 39 : * @return The sum of `a` and `b`. 40 : */ 41 1 : public int add(int a, int b) { 42 : // Logging an informational message 43 : logger.info("Logging message"); 44 : // Logging an error message 45 : logger.error("Error message"); 46 : // Returning the sum of `a` and `b` 47 : return a + b; 48 : } 49 : }