Recent Question/Assignment
ENEX20001 2018/T2
Assignment 1 C Language Tasks
Due date: Friday of Week 5(10Aug. 2018), 23:55hrs. ASSESSMENT
Weighting: 20% of unit final mark 1
Length: N/A
Submission Online as a word file
Note: All programs should associate with appropriate flowcharts and comments, marks will be given to the explanations of your algorithms and program. You can attach screenshots of running program as well.
ALL programs should developed using CODE:: Blocks IDE.
Ql. (20marks)
Write a program to read the two different integers m and n, (each must be in the range of 0 to 99, and I (m-n)I 50) from the keyboard and calculate the sum of integers from the smaller to the larger integer. Your program should provide user instructions on what to do and check and output an error message if the input numbers are not in accordance with the above restrictions.
Q2. (20marks) Write a program to read two 4x4 matrices and calculate their sum and print the output the answer using while loop.
Q3. (30marks) A water level sensor in a water tank is mounted above the tank and it measures the distance to the water surface from its position. The empty tank outputs 5m and the full tank outputs lm on the sensor readout.(Hint: draw a correct diagram before developing the solution and check whether that matches the conditions given above )
The inlet water pump should start whenever the water height of the tank goes below 3m.The output valve should close whenever it goes below 0.5m and should turn on otherwise. (ignore the hysteresis you need for actual water tank operations to simplify the program)
Write a program for the following conditions:
Ask the user to enter the water level sensor readout in meters and then display the condition of
water pump and outlet valve as follows:
Water level sensor reading = XXX F ( XXX is the user input)
Inlet Pump is: ON (or OFF depending on XXX —this is an output from your program)
Outlet valve is: ON (or OFF depending on XXX —this is an output from your program )
Then check with the user where s/he wants to run it again. The program should run repeatedly until
user input that s/he does not want to run it again.
Q4. (30marks) Write a program using for loops to read two 3 x 3 integer matrices from keyboard and print them as they are.
(5/30 marks)
Then multiply them using for loops and print the complete answer as a 3 x 3 matrix.
(25/30 marks)
Assessment criteria:
This assignment is based on C language programming skills. To obtain full marks students must provide all in detail problem solving and solution development evidences. Each student must have their unique programs developed by themselves. Answer to every problem should include a flowchart / NS-diagram or other similar graphical representation of the solution. A clean working program as the answer to a question without evidence of development of it(ex: a soft copy of workbook pages relevant to it) will receive a maximum of 50% of the allocated marks for that question. Provide screenshots of your answers.
No model answer will be provided as there is no unique answer to any of the questions.
Submission instructions:
Develop your program to solve the problem in each question. When they run successfully, copy the entire program to your answer script in MS WORD. Then close your project and open a new project. Copy your listing from the answer script(WORD document) and paste it into the new project's main c file. Build the project and run it to check whether it runs smoothly. If it does not run now, it will not run on marker's computer as that is what the marker does. ( Hint: When you first copy from project to WORD document, WORD may auto correct some spelling, capitalize initial words, etc. which will prevent your answer from running successfully in the marker's computer when copy and pasted into a new project. The above exercise will highlight you if there are any such things done by WORD Auto correct feature and you are on can correct them before submitting. The marker will not try to correct them and any submitted program with compilation errors will receive very low marks)