a.out <A-file> <expression> Read an NxN matrix A from a file <A-file>. Evaluate <expression> using A. The expression would contain multiplication *, addition +, constants and parentheses, e.g., 2 * A + A * A * (2 * A) + A. 2 * A multiplies each entry of A by 2. 2 + A flags an error which must be caught. There could be other errors such as A * 2 * A. Each A-file contains N+1 lines. Its format is as follows. First line: <N> Next N lines: integers separated by spaces The following is expected but not evaluated. If you follow, this would help you learn object-oriented programming better. - You are expected to use at least three classes: Expression Evaluator, Error Handler, Matrix Operations. - Expression Evaluator must not know that the evaluation is happening on matrices. - Error Handler should be generic and common to the other two classes. - Matrix Operations class must not know about Expression Evaluator's internals. - Use operator overloading for Expression Evaluator and Matrix Operations. - You should be able to change file-input to keyboard input by changing at most one line in the program.
Given a list of integers, find the set of all prime numbers after concatenating the elements. For instance, if the input is (list 2 3 4 50), the prime numbers formed are 2, 23, 3. The condition is if an element is part of a larger prime, it should not be printed for a smaller prime. Thus, in the above example, the output should be 23 (2 and 3 should not be printed as they are substrings of 23). If (2 3 9) is the input, then the answer should be 239 and not 23 or 3 or 2. If the input is (2 3 9 7), then the answer should be 239 and 397. We will assume that 1 is not prime and 2 is prime.
Inputs: - A list of unique course numbers. - An associative list of sublists containing faculty who would teach the associated course. A course may be co-taught by two/three teachers. - A list of additional constraints (this would be specified as a separate file). Outputs: - A mapping of course number to a slot, if a schedule exists; no otherwise. - One should be able to enumerate through other possible slottings if semicolon (;) is pressed. Assumptions: - It is a five-day week, with every day consisting of five lectures (08:00 -- 13:00). Total 25 lectures per week. - There are seven slots (A--G). - Each course has the same number of credits 3. Hence, it should be scheduled three times in a week. - There would be four (25 - 7 * 3) empty hours every week. - A teacher can be in only one class at a time (your code should ensure this). - A slot can appear only once in a day. - There is no restriction on what slot should get scheduled at what time each day. Thus, slot A need not be at 08:00 on Monday. Alternatively, you may fix 08:00 everyday as A slot. Upto you. Additional constraints: - A relation would pose additional restrictions on course slotting: conflict(cs3100, cs3300) or conflict(cs6843, cs6868). These are similar to "two core courses for the same batch should not be in the same slot", "two related courses should be in different slots". - The program would be invoked as consult(conflict). main([cs1100, cs6843, cs1200, cs2100, cs3100, cs4240, cs6868], [[ja, nsn], [rn], [js, bvrr, nsn], [sr, br], [sb, mm, csrm], [psk], [dj]]).If you are enthusiastic, you can extend this program to incorporate additional constraints and more generality -- to be used by the department for slotting every semester. Currently it is done manually. Meet me if you are interested.