Assignment 3
Assignment 3
ASSIGNMENT – 3 – SE
Deadline: Sunday Nov 24, 2024
1. Make sure that you read and understand each instruction. If you have any questions or comments
you are encouraged to discuss your problems with your colleagues (and instructors) on google
classroom.
2. If there is a syntax error in the code, zero marks will be awarded in that part of the assignment.
3. Keep a backup of your work always that will be helpful in preventing any mishap and avoid last
hour submissions
4. Displayed output should be well mannered and well presented. Use appropriate comments and
indentation in your source code.
5. Please ensure that only concepts covered in class are used for the assignment. For each question
in your assignment, make a separate .cpp file e.g., for question 1, make q1.cpp and so on. Each file
that you submit must contain your name, student-id, and assignment on top of the file in the
comments.
7. Combine all your work in one folder. The folder must contain only .cpp files (no binaries, no
exe files etc.).
8. Rename the zip as ROLL-NUM_PROGRAM_SECTION (e.g., i240001_SE_A) and
compress the folder as a zip file. (e.g., i240001_SE_A.zip). Strictly follow this naming
convention, otherwise marks will be deducted (-10%).
9. Submit the .zip file on Google Classroom within the deadline.
10. The student is solely responsible for checking the final file for issues like corrupt file, viruses
in the file, or mistakenly exe sent. If we cannot download the file from Google Classroom, it will
lead to zero marks in the assignment.
Main function:
• Ask the user for mains string.
• Make a menu using switch statement above three functions, call respective function and
display output
Please ensure all validations are applied!
Question 2- Lift System Automation
FAST university has hired you to make an operating system for their lifts. Below are specifications
of the lifts OS.
The lift will be place in a building with 6 floors including a basement. From basement to top floors
are labeled as -1,0,1,2,3,4 respectively. In the morning, the lift goes operation from the basement.
The lift can go up and down. If maintained is required, the lift can be halted. If the lift is halted,
the lift not usable during that period. Once unhalted, the lift can be used again.
With the help of above information, make a lift operating system which will have following
functions
int lift_operating _system(int requested_floor, int current_floor, char
lift_status)
// this function validates the lift request and then performs the lift up or lift down function. Once
the function is performed, the lift operating system returns the new current floor after lift goes up
or down.
int liftup(int current_floor,int requested_floor )
// will be called by lift_operating_system if list should move up
int liftdown(int current_floor,int requested_floor )
// will be called by lift_operating_system if list should move dowb
char halt_lift(char status)
//halts the lift, no up and down operation can be performed. Stored H for halting
// char un_half_lift(char status)
Unhalts the lift. Store W which represents that the lift is working.
Main function:
The main maintains the following is in an endless loop and asks the user to select on of the
following operations.
1. go to a floor
2. Halt the lift
3. go to a floor
4. Unhalt the lift
5. go to a floor
6. Exit
Please note that all the validations are performed in lift_operating _system. The main is
only the runner of the system. Please ensure all validations are applied!
Question 3 - Matrix Multiplication
Write a C++ program that multiplies two matrix using functions. The program should include the
following functions and specifications:
Specifications
- For matrix multiplication to be valid, the number of columns of the first matrix must equal the
number of rows of the second matrix.
- Ensure that the program handles mismatched matrix sizes by displaying an appropriate error
message.
- The matrices should be input and output in a readable format.
- Maximum size of matrix could be 10 x 10. Add #define MAX 10 in your program.
• Define two, 2D array to ask user for the size of both matrixes (m(rows) x n(columns))
• Input all elements of the matrix
Matrix Multiplication Function:
- A function that multiplies two matrices. The function should take two matrices as parameters along
with their sizes and return the resulting matrix of the multiplication.
void multiplyMatrices(int matrixA[MAX][MAX], int matrixB[MAX][MAX], int rowA,
int colA, int rowB, int colB);
Parameters: