
About Course
This Lecture Will Revise How To Use BlueJ IDE For Developing And Executing Java Program
About Programming
Difference Between Procedural & Object Oriented Programming
What Are Object With Example
What are Classes With Example
Basic Principles Of Object Oriented Programming
Detailed Explanation Of Every Feature
Class As Object Factory
Example Of Few Classes
Token In Java
Variable, Constant & Naming Convention's In Java
Static & Dynamic Initialization In Java
Concept Of Values & Data Types
Data Types In Java Along With Their Size & Default Values
Example Of Assignment
Type Casting
About Prefix & Postfix Operators
Technique To Solve Equation
Examples Of Equation
Understanding If Condition
Understanding switch case
Working With ?: (ternary Conditional Operator)
What is Loop
do .... while Loop
while Loop
for Loop
Nested Loop
Break & Continue Statement
How Many Times Loop is Executed
Mathematical Functions In Java
Practical Implementation Of These Functions
Compile Time Errors
Logical Errors
Runtime Errors
Using the switch-case statement, write a menu driven program to do the following:
(a)To generate and print Letters from A to Z and their Unicode Letters Unicode
A 65
B 66
. .
Z 90
(b) Display the following pattern using iteration (looping) statement:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
A tech number has even number of digits. If the number is split in two equal halves, then the square of sum of these halves is equal to the number itself.
Write a program to generate and print all four digits tech numbers.
Example:
Consider the number 3025
Square of sum of the halves of 3025
= (30+25)2
= (55)2
= 3025 is a tech number.
Write a program to input a number and check and print whether it is a Pronic number or not. (Pronic number is the number which is the product of two consecutive integers)
Examples: 12 = 3 × 4
20 = 4 × 5
42 = 6 × 7
Write a menu driven program to display the pattern as per user’s choice.
Pattern 1 Pattern 2
ABCDE B
ABCD LL
ABC UUU
AB EEEE
A
For an incorrect option, an appropriate error message should be displayed.
Write a program to accept a number and check and display whether it is a spy number or not. (A number is spy if the sum of its digits equals the product of its digits.)
Example:
consider the number 1124
Sum of the digits = 1 + 1 + 2 + 4 = 8
Product of the digits = 1 × 1 × 2 × 4 = 8
Using switch statement, write a menu driven program for the following:
(i)To find and display the sum of the series given below:
?=?1−?2+?3−?4+?5................. − ?20 (where x = 2)
x1 is x power by 1 x2 is x power by 2 so on
(ii) To display the following series:
1 11 111 1111 11111
For an incorrect option, an appropriate error message should be displayed.
Using the switch statement , write a menu driven program for the following:
(i)To print the Floyd’s triangle [Given below]
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
(ii)To display the following pattern
I
I C
I C S
I C S E
For an incorrect option, an appropriate error message should be displayed.
Write a program to accept a number and check and display whether it is a Niven number or not.
(Niven number is that number which is divisible by its sum of digits).
Example :
Consider the number 126.
Sum of its digits is 1+2+6 = 9 and 126 is divisible by 9.
•Write two separate programs to generate the following patterns using iteration(loop) statements:
(a) (b)
* 54321
*# 5432
*#* 543
*#*# 54
*#*#* 5
Using the switch statement, write a menu driven program to:
To find and display all the factors of a number input by the user (including 1 and excluding number itself).
Example:
Sample Input : n =15 Sample Output : 1,3, 5
To find and display the factorial of a number input by the user (the factorial of a non– negative integer n, denoted by n!, is the product of all integers less than or equal to n.
Example:
Sample Input : n =5
Sample Output : 5! = 1×2×3×4×5 =120.
For an incorrect choice, an appropriate error message should be displayed.
Write a program to input a sentence and convert it into uppercase and count and display the total number of words starting with a letter 'A'.
Example: Sample Input: ADVANCEMENT AND APPLICATION OF INFORMATION TECHNOLOGY ARE EVER CHANGING.
Sample Output: Total number of words starting with letter 'A' = 4.
Write a program in Java to accept a string in lower case and change the first letter of every word to upper case. Display the new string.
Sample input: we are in cyber world
Sample output: We Are In Cyber World
Design a class to overload a function check( ) as follows:
(i)void check (String str , char ch ) - to find and print the frequency of a character in a string.
Example:
Input: Output:
str = "success" number of s present is =3 ch = 's'
(ii)void check(String s1) - to display only vowels from string s1,
after converting it to lower case.
Example:
Input: Output:
s1 ="computer" o u e
Special words are those words which starts and ends with the same letter.
Examples:
EXISTENCE
COMIC
WINDOW
Palindrome words are those words which read the same from left to right and vice-versa
Examples:
MALAYALAM
MADAM
LEVEL
ROTATOR
CIVIC
All palindromes are special words, but all special words are not palindromes.
Write a program to accept a word check and print whether the word is a palindrome or only special word.
Design a class to overload a function Joystring() as follows:
void Joystring (String s, char ch1, char ch2) with one string argument and two character arguments that replaces the character argument ch1 with the character argument ch2 in the given string s and prints the new string.
Example:
Input value of s ="TECHNALAGY" ch1='A',
ch2='O'
Output : "TECHNOLOGY"
void Joystring (String s) with one string argument that prints the position of the first space and the last space of the given string s.
Example:
Input value of ="Cloud computing means Internet based computing"
Output : First index : 5
Last index : 36
void Joystring ( String s1, String s2 ) with two string arguments that combines the two strings with a space between them and prints the resultant string.
Example:
Input value of s1 ="COMMON WEALTH " Input value of s2="GAMES "
Output : COMMON WEALTH GAMES
(use library functions)
Write a program to input 15 integer elements in an array and sort them in ascending order using the bubble sort technique.
Write a program to accept name and total marks of N number of students in two single subscript array name[ ] and totalmarks [ ]. Calculate and print:
(i) The average of the total marks obtained by N number of students. [average = (sum of total marks of all the students)/N]
(ii) Deviation of each student’s total marks with the average. [deviation = total marks of a student – average]
Program1
Write a program to input integer elements into an array of size 20 and perform the following operations:
(i)Display largest number from the array.
(ii)Display smallest number from the array.
Display sum of all the elements of the array.
Program 2
Write a program to input forty words in an array. Arrange these words in descending order of alphabets, using selection sort technique. Print the sorted array.
Write a program to initialize the seven Wonders of the World along with their locations in two different arrays. Search for a name of the country input by the user. If found, display the name of the country along with its Wonder, otherwise display “Sorry Not Found!”.
Seven wonders – CHICHEN ITZA, CHRIST THE REDEEMER, TAJMAHAL, GREAT WALL OF CHINA, MACHU PICCHU, PETRA, COLOSSEUM
Locations - MEXICO, BRAZIL, INDIA, CHINA, PERU, JORDAN, ITALY
Example –
Country Name : INDIA Output : INDIA - TAJMAHAL Country
Name : USA Output : Sorry Not Found!
Program1
Write a program to input and store roll numbers, names and marks in 3 subjects of n number students in five single dimensional array and display the remark based on average marks as given below:(the maximum marks in the subject are 100)
average marks=Total Marks/3
Average marks Remarks
85-100 EXCELLENT
75-84 DISTINCTION
60-74 FIRST CLASS
40-59 PASS
Less than 40 POOR
Program2
Write a program to input twenty names in an array. Arrange these names in descending order of alphabets, using the bubble sort technique.
Design a class name ShowRoom with the following description:
Instance variables / Data members:
String name - To store the name of the customer
long mobno - To store the mobile number of the customer
double cost - To store the cost of the items purchased
double dis - To store the discount amount
double amount - To store the amount to be paid after discount
Member methods:
ShowRoom() - default constructor to initialize data members
void input () - To input customer name, mobile number, cost
void calculate () -To calculate discount on the cost of purchased items, based on following criteria
Cost Discount (in Percentage)
Less than or equal to ₹ 10000 5%
More than ₹10000 and less than or equal to ₹ 20000 10%
More than ₹ 20000 and less than or equal to ₹ 35000 15%
More than ₹ 35000 20%
Void display () - To display customer name, mobile number , amount to be paid after discount.
Write a main method to create an object of the class and call the above member methods.
------------------------------------------------------------------------------------------------------------
Design a class to overload a function series () as follows:
(a) void series (int x, int n) – To display the sum of the series given below:
x power by 1 + x power by 2 + x power by 3 + ……………… x power by n terms
(b) void series (int p) – To display the following series: 0, 7, 26, 63 ……………. p terms
(c) void series ( ) – To display the sum of the series given below:
1/2+1/3+1/4+..........+1/10
Design a class RailwayTicket with following description:
Instance variables/data members :
String name : To store the name of the customer
String coach : To store the type of coach customer wants to travel
long mobno : To store customer’s mobile number
int amt : To store basic amount of ticket
int totalamt : To store the amount to be paid after updating the original amount
Member methods :
void accept () : To take input for name, coach, mobile number and amount.
void update () : To update the amount as per the coach selected
(extra amount to be added in the amount as follows)
Type of Coaches Amount
First_AC 700
Second_AC 500
Third_AC 250
Sleeper None
void display () : To display all details of a customer such as name, coach, total amount and mobile number.
Write a main method to create an object of the class and call the above member methods.
-------------------------------------------------------------------------------------------------------------
Design a class to overload a function volume() as follows:
(i) double volume (double R) – with radius (R) as an argument, returns the volume of sphere using the formula.
V = 4/3 × 22/7 × R power by 3
(ii) double volume (double H, double R) – with height(H) and radius(R) as the arguments, returns the volume of a cylinder using the formula.
V = 22/7 × R power by 2 × H
(iii) double volume (double L, double B, double H) – with length(L), breadth(B) and Height(H) as the arguments, returns the volume of a cuboid using the formula.
V = L × B × H
Define a class Electric Bill with the following specifications:
class : ElectricBill
Instance variables / data member:
String n – to store the name of the customer int
units – to store the number of units consumed
double bill – to store the amount to be paid
Member methods:
void accept( ) – to accept the name of the customer and number of units consumed
void calculate( ) – to calculate the bill as per the following tariff:
Number of units Rate per unit
First 100 units Rs.2.00
Next 200 units Rs.3.00
Above 300 units Rs.5.00
A surcharge of 2.5% charged if the number of units consumed is above 300 units.
void print ( ) - To print the details as follows:
Name of the customer: ………………………
Number of units consumed: ………………………
Bill amount: ………………………
Write a main method to create an object of the class and call the above member methods.
------------------------------------------------------------------------------------------------------------
Design a class to overload a function check( ) as follows:
(i) void check (String str , char ch ) - to find and print the frequency of a character in a string.
Example:
Input: Output:
str = "success" number of s present is =3 ch = 's'
(ii) void check(String s1) - to display only vowels from string s1, after converting it to lower case.
Example:
Input: s1 ="computer" Output: o u e
Define a class named BookFair with the following description :
Instance variables /Data members :
String Bname - stores the name of the book
double price - stores the price of the book
Member methods :
(i) BookFair() - Default constructor to initialize data members
(ii) void Input() - To input and store the name and the price of the book.
(iii) void calculate() - To calculate the price after discount. Discount is calculated based on the following criteria
Price Discount
Less than or equal to `1000 2% of price
More than ` 1000 and less than or equal to ` 3000 10% of price
More than ` 3000 15% of price
(iv) void display() - To display the name and price of the book after discount.
Write a main method to create an object of the class and call the above member methods.
--------------------------------------------------------------------------------------------------------------
Design a class to overload a function SumSeries() as follows :
(i) void SumSeries(int n, double x) – with one integer argument and one double argument to find and display the sum of the series given below :
s = ?/ 1−?/ 2+?/ 3−?/ 4+?/ 5……… to n terms
(ii) void SumSeries() – To find and display the sum of the following series :
s = 1+(1×2)+(1×2×3)+.………+(1×2×3×4……………×20)
Define a class called Parking Lot with the following description :
Instance variables/data members :
int vno - To store the vehicle number
int hours - To store the number of hours the vehicle is parked in the parking lot
double bill - To store the bill amount
Member methods :
void input() - To input and store the vno and hours.
void calculate() - To compute the parking charge at the rate of 3 for the first hour or part thereof, and 1.50 for each additional hour or part thereof.
void display() - To display the detail
Write a main method to create an object of the class and call the above methods.
-----------------------------------------------------------------------------------------------------
Design a class to overload a function Joystring() as follows:
void Joystring (String s, char ch1, char ch2) with one string argument and two character arguments that replaces the character argument ch1 with the character argument ch2 in the given string s and prints the new string.
Example:
Input value of s ="TECHNALAGY" ch1='A',
ch2='O'
Output : "TECHNOLOGY“
void Joystring (String s) with one string argument that prints the position of the first space and the last space of the given string s.
Example:
Input value of ="Cloud computing means Internet based computing" Output : First index : 5
Last index : 36
void Joystring ( String s1, String s2 ) with two string arguments that combines the two strings with a space between them and prints the resultant string.
Example:
Input value of s1 ="COMMON WEALTH " Input value of s2="GAMES "
Output : COMMON WEALTH GAMES
(use library functions)
It's a perfect blend of conceptual clarity and programming practice sessions along with ongoing lectures. It not only takes you coupe for the entire course, but, it makes you equipped and mentally prepared for MAX scoring capabilities too, with add-ons like, solving previous years' exam papers with the accurate solutions and also with the accurate way of presentation needed by the respective school or college. We are coming with another course which helps in developing academic projects, shortly. Till then, ramp up your programming skill set.