Week 9 : Programming Assignment 1
Problem statement:
Complete the code to develop a BASIC CALCULATOR that can perform operations like Addition, Subtraction, Multiplication and Division.
Note the following points carefully:
1. Use only double datatype to store calculated numeric values.
2. Assume input to be of integer datatype.
3. The output should be rounded using Math.round() method.
4. Take care of the spaces during formatting output (e.g., single space each before and after =).
5. The calculator should be able to perform required operations on a minimum of two operands as shown in the below example:
Input:
5+6
Output:
5+6 = 11
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 5+6 | 5+6 = 11 | 5+6 = 11 | Passed |
Week 9 : Programming Assignment 2
Complete the code to develop an ADVANCED CALCULATOR that emulates all the functions of the GUI Calculator as shown in the image.
Note the following points carefully:
1. Use only double datatype to store all numeric values.
2. Each button on the calculator should be operated by typing the characters from 'a' to 'p'.
3. To calculate 25-6, User should input fjhkc (where, f for 2, j for 5, h for '-', k for 6 and c for '=' ).
3. You may use the already defined function gui_map(char).
4. Without '=', operations won't give output as shown in Input_2 and Output_2 example below.
5. The calculator should be able to perform required operations on two operands as shown in the below example:
Input_1:
klgc
Output_1:
18.0
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | klgc | 18.0 | 18.0 | Passed |
Week 9 : Programming Assignment 3
Complete the code to perform a 45 degree anti clock wise rotation with respect to the center of a 5 × 5 2D Array as shown below:
INPUT:
00100
00100
11111
00100
00100
OUTPUT:
10001
01010
00100
01010
10001
Note the following points carefully:
1. Here, instead of 0 and 1 any character may be given.
2. The input and output array size must be of dimension 5 × 5 and nothing else.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 00100
00100
11111
00100
00100 | 10001\n
01010\n
00100\n
01010\n
10001 | 10001\n
01010\n
00100\n
01010\n
10001\n
| Passed after ignoring Presentation Error |
Week 9 : Programming Assignment 4
Problem statement:
A program needs to be developed which can mirror reflect any 5 × 5 2D character array into its side-by-side reflection. Write suitable code to achieve this transformation as shown below:
INPUT: OUTPUT:
OOXOO OOXOO
OOXOO OOXOO
XXXOO OOXXX
OOOOO OOOOO
XOABC CBAOX
Note the following points carefully:
1. Here, instead of X and O any character may be present.
2. The input and output array size must be of dimension 5 × 5 and nothing else.
3. Only side-by-side reflection should be performed i.e. ABC || CBA.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | OOXOO
OOXOO
XXXOO
OOOOO
XOABC | OOXOO\n
OOXOO\n
OOXXX\n
OOOOO\n
CBAOX | OOXOO\n
OOXOO\n
OOXXX\n
OOOOO\n
CBAOX\n
| Passed after ignoring Presentation Error |
Week 9 : Programming Assignment 5
Write suitable code to develop a 2D Flip-Flop Array with dimension 5 × 5, which replaces all input elements with values 0 by 1 and 1 by 0. An example is shown below:
INPUT:
00001
00001
00001
00001
00001
OUTPUT:
11110
11110
11110
11110
11110
Note the following points carefully:
1. Here, the input must contain only 0 and 1.
2. The input and output array size must be of dimension 5 × 5.
3. Flip-Flop: If 0 then 1 and vice-versa.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 00001
00001
00001
00001
00001 | 11110\n
11110\n
11110\n
11110\n
11110 | 11110\n
11110\n
11110\n
11110\n
11110\n
| Passed after ignoring Presentation Error |
No comments