http://www.hubberspot.com/2012/03/command-line-arguments-in-java.html http://spoken-tutorial.or http://spok en-tutorial.org/watch/Java g/watch/Java/Numerical! /Numerical!atat"pes/#nglis atat"pes/#nglish/ h/ https://www.tutorialspoint.com/java/java$basic$s"nta%.htm Assignment 1 Write a Program that accepts two Strings as command line arguments and generate the output in a specific way as given below. Example: If the two command line arguments are Wipro and Bangalore then the output generated should be Wipro echnologies echnologies Bangalore.
Command Line Argument Argument
If the command line arguments are !B" and #umbai then the output generated should be !B" echnologies echnologies #umbai $%ote: It is mandatory to pass two arguments in command line& Write a Program to accept a String as a "ommand line argument and the program should print a Welcome message.
2
Example : ":'( )ava Sample *ohn +,P Expected : Welcome *ohn
3
Write a Program to accept two integers through the command line argument and print the sum of the two numbers Example: ":'()ava Sample - / +,P Expected : he sum of - and / is 0 Write a Program to accept two integers through the command line argument and print the sum of the two numbers
Command Line Argument
Example: ":'()ava Sample - / +,P Expected : he sum of - and / is 0
Assignment 2
-
Write a program to chec1 if a given number is Positive2 %egative2 or 3ero.
&' )tatement
2
Write a program to chec1 if a given number is odd or even.
If Statement
3
Write a program to chec1 if the program has received command line arguments or not. If the program has not received the values then print 4%o 5alues42 else print all the values in a single line separated by 26comma7. Eg-7 )ava Example +,P: %o values Eg/7 )ava Example #umbai Bangalore +,P: #umbai2Bangalore $%ote: 8ou can use length property of an array to chec1 its length
If Statement
4
Initiali9e two character variables in a program and display the characters in alphabetical order. Eg-7 if first character is s and second is e +,P: e2s Eg/7 if first character is a and second is e +,P:a2e
If Statement
5
Intiali9e a character variable in a program and if the value is alphabet then print 4!lphabet4 if its a number then print 4;igit4 and for other characters print 4Special "haracter4
If Statement
6
Write a program to accept gender 64#ale4 or 4> ?./@ Aender >>( >(- to ? Interest >> C.D@ Aender >>( >( =-/ Interest >> ./@ Aender >>( #ale !ge >>(-=D Interest >> ?.0@
If Statement
Aender >>( #ale !ge >>(D-=-/
7
Write a program to convert from upper case to lower case and vice versa of an alphabet and print the old character and new character as shown in example 6Ex: a=(!2 #=(m7.
If Statement
8
Write a program to print the color name2 based on color code. If color code in not valid then print 4Invalid "ode4. F=(Fed2 B=(Blue2 A=(Areen2 +=(+range2 8=(8ellow2 W= (White.
Switch Statement
Write a program to print month in words2 based on input month in numbers Example-: ":'()ava Sample -/ +,P Expected : ;ecember Example/:
9 ":'()ava Sample
Switch Statement
+,P Expected : Please enter the month in numbers Example0: ":'()ava Sample - +,P Expected : Invalid month
10
Write a program to print numbers from - to - in a single row with one tab space.
or Loo!
11
Write a program to print even numbers between /0 and C2 each number should be printed in a separate row.
or Loo!
12
Write a program to chec1 if a given number is prime or not
or Loo!
13
Write a program to print prime numbers between - and .
or Loo!
Write a *ava program to find if the given number is prime or not. Example-: ":'()ava Sample +,P Expected : Please enter an integer number Example/: ":'()ava Sample +,P Expected : - is neither prime nor composite
14
Example0:
or Loo!
":'()ava Sample +,P Expected : is neither prime nor composite ExampleG: ":'()ava Sample - +,P Expected : - is not a prime number Example: ":'()ava Sample C +,P Expected : C is a prime number
15
Write a program to add all the values in a given number and print. Ex: -/0G=(-
or Loo!
Write a program to print H in
Example-:
16
":'()ava Sample
or Loo!
+,P Expected : Please enter an integer number Example-: ":'()ava Sample 0 +,P Expected : H H H
H H
H
17
Write a program to reverse a given number and print Eg-7 I,P: -/0G +,P:G0/Eg/7 I,P:-G +,P:G-
"hi#e Loo!
Write a *ava program to find if the given number is palindrome or not Example-: ":'()ava Sample ----
18
"hi#e Loo!
+,P Expected : ---- is a palindrome Example/: ":'()ava Sample -/0G +,P Expected : -/0G is not a palindrome
"hi#e Loo!
19
Write a program to print first values which are divisible by /2 02 and .
20
Write a program that displays a menu with options -. !dd /. Sub Based on the options chosen2 read / numbers and perform the relevant operation. !fter performing the operation2 the program should as1 the user if he wants to continue. If the user presses y or 82 then the program should continue displaying the menu else the program should terminate. $ %ote: se Scanner class2 you can ta1e help from the trainer regarding the same &
o.
1
Hands-on Assignment
Write a program to initiali9e an integer array and print the sum and average of the array
Topics Status Covered
$ne dimen%iona# Arra&
2
Write a program to initiali9e an integer array and find the maximum and minimum value of an array
$ne dimen%iona# Arra&
3
Write a program to initiali9e an integer array with values and chec1 if a given number is present in the array or not. If the number is not found2 it will print =- else it will print the index value of the given number in the array Ex-7 !rray elements are J-2G20G2D2CK and the search element is +,P: =Ex/7!rray elements are J-2G20G2D2CK and the search element is D +,P: G
$ne dimen%iona# Arra&
4
Initiali9e an integer array with ascii values and print the corresponding character values in a single row.
$ne dimen%iona# Arra&
5
Write a program to find the largest / numbers and the smallest / numbers in the given array
$ne dimen%iona# Arra&
6
Write a program to initiali9e an array and print them in a sorted fashion
$ne dimen%iona# Arra&
7
Write a program to remove the duplicate elements in an array and print Eg7 !rray Elements==-/20G2-/2G2DC2? +,P: -/20G2G2DC2?
$ne dimen%iona# Arra&
8
Write a program to print the element of an array that has occurred the highest number of times Eg7 !rray =( -2/2-202G2-2 +,P:-
$ne dimen%iona# Arra&
9
Write a program to print the sum of the elements of the array with the given below condition. If the array has D and C in succeeding orders2 ignore D and C and the numbers between them for the calculation of sum. Eg-7 !rray Elements = -202D2-2/2C2 +,P: // $i.e -L0L& Eg/7 !rray Elements = C2-2/202D +,P:- Eg07 !rray Elements = -2D2G2C2
$ne dimen%iona# Arra&
+,P:- Write a program to reverse the elements of a given /H/ array.
'wo (imen%iona# Arra&
":'()ava Sample - / 0 G
10
+,P Expected : he given array is : - / 0 G he reverse of the array is : G 0 /
/ D -
0 C --
G ? -/
Write a program to find greatest number in a 0H0 array. he program is supposed to receive integer numbers as command line arguments.
Example-: ":'()ava Sample - / 0 +,P Expected : Please enter integer numbers
11 Example/: ":'()ava Sample - /0 G -/- /// D CC ? +,P Expected : he given array is : - /0 G -/- /// D CC ? he biggest number in the given array is ///
Questions
1
"hat i% )(*+
'wo (imen%iona# Arra&
2
"hat i% ),-+
3
"hat i% )I' com!i#er+
4
"hat i% Ada!ti.e o!timi/er+
5
"hat i% C#a%% Loader+
6
"hat i% &te Code erifier+
7
"hat i% a Com!i#er+
8
"hat i% an Inter!reter+
9
"hat i% the difference etween a Com!i#er and Inter!reter+
10
"hat are the com!onent% of )+
11
"hat i% #atform Inde!endent+
12
ow doe% )a.a achie.e #atform inde!endence+
13
ow to acce%% command #ine argument%+
14
"hat are the data t&!e% in )a.a and what are their %i/e%+
15
ow do &ou dec#are an arra& in )a.a+
16
ow do &ou find the #ength of an arra& in )a.a+
17
"hat i% the u%e of A' .aria#e+
18
"hat i% the u%e of CLASSA' .aria#e+
19
ow do &ou a%%ign .a#ue% for A' and CLASSA' aria#e+
20
"hat are a## the characteri%tic feature% of )a.a rogramming #anguage+