Starting from:
$30

$24

Computer Programming Lab #2 Solution

Write a program that performs following tasks respectively. These tasks should be distinct functions and called from main() function with selection. Once they been called, each will call another function to make the calculation for the related task. These calls will be made by selecting the inputs received from the user. Do not use any library except stdio.h and math.h (math.h is only for use in Heron's triangular area calculation formula). For each process, the input / output part and the calculation part will be created separately. So you have to do the calculations in a separate function. This function should take the values required for calculation from the previous function as input and return output as a result.

Multi-Calculator:

When writing this program, you should think of it as a calculator that is a combination of multiple calculators that can perform different calculations. These calculators;

    • Standard Calculator: Two different types of numbers can be calculated on this calculator. These types are Integer and Complex number types. With these number types, you must define Addition and Multiplication operations. These operations are decided by the choices to be taken from the user. In these functions, do not define variables other than the necessary variables and selection variable for calculation.

Expected Output


    • Area&Perimeter Calculator: Three different types of shapes can be calculated on this calculator. These types are Rectangular, Triangle and Circle shapes. Define the Area and Perimeter calculation operations for these shapes. Let 2 calculations be made in one function for each shape. These calculations are decided by choices from the user. In these functions, do not define variables other than the variables required for calculation and the selection variable. Use Heron's formula to calculate the area of the triangle. Heron’s formula;
= (   +    +   )/2

= √  (   −   )(   −   )(   −   )

Expected Output





















    • Temperature Calculator: Two different temperature conversions can be calculated on this calculator. These conversions are Fahrenheit to Kelvin and Kelvin to Fahrenheit. The choice of the user will determine which conversion will be made. The input value of the selected conversion will be taken from the user. In these functions, do not define variables other than the variables required for calculation and the selection variable.
9
    ℎ      ℎ       = (5) ∗ (             − 273.15) + 32

5
= ((9) ∗ (    ℎ      ℎ       − 32)) + 273.15


Expected Output

More products