HIT365 C Programming
Assignment 2
This assignment is worth 15% of the total unit. Marks are given for clarity, presentation,
accuracy and also concise and efficient programs. This is an individual assignment. I f
y o u found guilty of plagiarism, a failure grade will be awarded. The due date of this assignment is 31st May 2020. Please submit your answers in one *.c
file containing a C program using Learnline (in the “Submit Assessment” tab). Late
submissions incur a 10% penalty per day. Make sure comments are included in your programs
so that the marker can understand your program. Make sure your program can run in
Microsoft Visual Studio 2017 available from VMware Horizon if you are using another c
compiler. Marks will be deduced if your program cannot run in Microsoft Visual Studio
2017.
For this assignment, you are required to develop a non-scientific calculator using C. Your
calculator should only solve summation, subtraction, division, product, square root and square
expressions. Utilizing the math.h header for your program, your calculator should start by
prompting the user to enter a two-or-more-operand mathematical equation just like how you
would using a non-scientific calculator. Your program should then display the correct
answer and the user will have the choice to either continue using the calculator with the
current answer to perform further calculations or end the program. Your program should also
have a help function to display all the functions of the calculator. A sample output of the
program when the user enters “help” is shown below:
Your calculator must have the following additional functionalities and features:
1. Your calculator should display values accurate up to 6 decimal places.
2. For square and square root operations, you may define any symbol to represent the
operations, but the user should be aware of the symbols you used.
3. Have a memory function to store the current answer and can be used later for further
calculations and reference.
4. Have a refresh function to erase the stored memory and return the calculator to its initial
‘start-up’ mode.
Below are some examples of the program output: