5/31/2023 0 Comments Magic calculator 2– Finally, if two numbers are in the specified interval MagiCal applies the operator received in the first step and shows the result in the format of 'first_number operator second_number = result'. If there is not any operation remaining, the program terminates. – If one or both of the provided numbers are not in the specified interval MagiCal will show 'Magic calculator can not perform your operation!', and proceeds for the next operation. – After entering the first number, MagiCal will ask for the second integer number using the message 'Enter the second number in the interval of :\n'. – To take the first integer number MagiCal displays the message 'Enter the first number in the interval of :\n'. For any invalid output the magic calculator should notify the user with the message 'Invalid input!'. If the user enters a valid input, 1, 2 3 or 4, then, the user will be asked to enter two numbers as the operands of the provided operator, as described below. Based on the user-provided input there should be two types of responses from MagiCal: – It prints a message 'Select the operator from the list of Addition (1), Subtraction (2), Multiplication (3), Division (4):\n'. Now, MagiCal asks the user for k times to provide the operator and two integer numbers as described below: Let’s assume the user-provided number is k. It takes this information from the user displaying the message 'Hi, how many operations do you want MagiCal to perform?\n'. MagiCal should know how many operations it will perform.It only accepts integer numbers between 0 (inclusive) and 100 (inclusive) as input.It only accept four operators: Addition, Subtractoin, Multiplication and Division.Magic calculator or MagiCal is not a regular calculator! MagiCal has special features as follows: Who knows, you may develop a future version of Windows calculator in a few years :-)! The good news is that in this assignment you will implement a magic calculator, called MagiCal, which familiarize you with the basics of developing such a program. This example uses the numbers 2, 3, 4, 5, 6, 7, 8, 9, 10.Have you thought about creating your own calculator? You might, but how difficult is it to create a calculator that includes all functions? Does it need a lot of programming? Well, Windows 10 calculator contains over 35000 lines of code and that should give you an idea. To calculate a magic constant, you need to add up all the nine consecutive numbers and divide by three. Those nine numbers can be arranged in ascending or descending order. Make sure that all nine numbers given are in consecutive order. 18 is called a magic constant There is a trick to tackle the above magic square. We can observe that the sum of each row, column and diagonals is 18. One of the example 3 x 3 magic squares is shown in Figure 1. A magic square is a square of array positive integers where the sum of each row, column and diagonal is the same. This kind of logic puzzle provides an alternative to solve traditional arithmetic calculations in a playful and meaningful way. To engage students in learning mathematics and develop mathematical skills, the magic square can become one of the useful tools in recreational mathematics. Have you tried to solve a magic square in less than five minutes? It’s fun and good for brain teaser activity.
0 Comments
Leave a Reply. |