ST.
STEPHEN’S SCHOOL DUM DUM
XI ASSIGNMENTS-2(2018-19)
1. An integer a[] consist of N different element in unsorted order. We want to
Re-arrange them according to the given instruction : Find the maximum
value of the array and put it in the centre position. Find the next largest value
and put it to its right. Then find the next largest and place it to its left and so
on alternating right and left until all integer in the array replaced. Assume
that there are at most (20) twenty different elements in the array (There are
no duplicate elements in the array). For e.g. if the elements of the array
initially : 7,3,1,6,4,2,-1 and 5 then after rearranging it becomes 1,3,5,7,6,4,2
and -1.
Write a program to accept N different elements in an array and rearrange
them according to the given instruction.
Sample input : Enter the Limit of the array : 5 Sample output :
Enter the Number : 7 Original array :
Enter the Number : 9 79256
Enter the Number : 2 Rearrange array:
Enter the Number : 5 26975
Enter the Number : 6
2. Write a program in JAVA to accept the elements in a square matrix of order n
X n then transpose the elements of the matrix and finally display the mirror
image of that transpose form along with the original form.
Sample Input : Enter the order of matrix (n) = 3 Mirror Image
The Matrix is : 1 2 3 Transpose Form: 1 4 7 7 4 1
4 8 9 2 8 6 6 8 2
7 6 5 3 9 5 5 9 3
Output should be taken using both odd ordered and even ordered matrix.
3. Write a program in JAVA to accept any date as a number (in ddmmyyyy) and
check whether it is a valid date or not without using Calendar Class and
display the result with proper message.
4. A class Stringop is designed to perform string related operation. Some
members of the class are given below :
Date member: String txt : To store the given String that maximum length is 100.
Member function :
void read_String () : To accept a sentence and that maximum length is 100.
char case_Convert (int) : convert letter to other case only and other characters
remaining unchanged. Here ‘int’ specifies ASCII value of the character.
void circularDcode () : to develop a string by replacing each letter only and converting it
to opposite case and then by the next character in a circular way and other character
remained unchanged. Hence “ A1bZ.” Will be decoded as “b1Ca”.
Write a main () to test your program.