Write, compile and run the following two programs using C/C++ programming method. Select the appropriate defined data types to carry out the calculations:
Question 1:
A) Program 1:
a) Generate a list of sine and cosine values for angles from 0O to 360O using float (real) data types.
b) Knowing that processors deal with radians and not degrees, remember to change values from degrees to radians then convert values back to display in degrees.
c) Use looping such as for and while statement.
d) Use conditions (if statement) to avoid dividing on zero and limit the output values between e-5 to e+5.
e) Using simple input and output statements, input program’s input data from the screen and print out the output data into the screen.
B) Program 2:
a) Generate a list of complex numbers using the following limits:
- Real values from 0 to 10 using a step of 2 (2 increment).
- Imaginary values from 0 to 10 using a step of 2 (2 increment).
b) Calculate the amplitudes and the angles in degrees
c) Using simple input and output statements, input program’s input data from the screen and print out the output data into the screen
For both programs, provide source codes, screenshots for input/output data and screenshots of running programs
Question 2: For the engineering problem given in this task produce the followings:
A) Construct a C/C++ program and use appropriate functions and procedures.
B) Demonstrate the effect of changing variables, constants and complex data types on the time required to run the program.
C) Program should be constructed using statements and modules within the main program. Data should be passed effectively between different parts of the main program.
Question 3: For the program developed in task 2:
A) Produce a complete documentation including the user interface. This must be used as user guide to show the input data required and their types, their range and a display of the source code name the user interface should also display the choice of output data and a user friendly display of the output data.
B) Produce a technical document that gives a clear guidance to the program user on the technical problem solved, the constants and variables being dealt with.
Question 4:
A) Programming errors can be classified as semantic and syntax errors. Define both types of errors and illustrate the difference between them. Produce a list of both types of errors that you faced in the program produced in task 2.
B) Produce a test documentation showing a procedure for the user to follow in testing the program before using it.
C) Change some of the variables in the developed program of task 3 to illustrate at least one logic error in the program. On compiling and running the program, illustrate the method used to detect the program errors. Explain how errors are found and how are they corrected.