Core Java Assignments
Core Java Assignments
Core Java Assignments
Write a java program to accept three integers from command line arguments and display average of
3.
2. Write a java program to accept hieght and breadth from user and display area of right angle triangle.
3. Write a java program to accept radius from user and display area of circle.
4. Write a program to accept total number of seconds from user, and convert in HH:MM:SS format.
7. Create a calculator in java. Accept two numbers and a choice from user as command line arguments,
if choice is
1 display addition
2 display substraction
3 display multiplication
4 display division
8. Implement assignment 7 using switch statement. Also use Scanner class to read all inputs.
9. Write a program to accept a number from user and display table of that number.
10. Write a program to accept a number from user and display fibonacci series upto that number.
1 1 2 3 5 8 13 21 34.......
11. Write a program to accept a number from user and check whether it prime or not.
12. Create an application for a mobile company. This application should accept total number of calls
made and customer plan. The application should display the total bill for the customer. Plan details are
as follows :
planA
planB
planA
double total = 0;
if(calls<100)
total = 100;
else
else
else
13. Accept Month from user(No 1-12 for Jan-Dec) & display the season associated with the month.
14 Create Java application (java prog) to display the cmd line argument in reverse manner.
15. Write a java program to create an array of 5 integers and display the median.(size should be odd)
16. Write a java program which accepts 5 integers and display largest and smallest number in from the
array.
17. Write a java program which accepts a number from user and search this number in an
array.(Initialize an array with 10 values).
18. Write a java program which accepts 5 names and display the largest name.
20. Write a java program which accepts the size of an integer array ,create an array of that size and
accept integers from user. Create Two more arrays called evenNumbers and oddNumbers, save all even
numbers from main array into evenNumbers and save all odd numbers from main array into
oddNumbers.
22. Create a class called Arithmetic, which must provide all arithmethic functionalities.
23. Creat a class call AreaCalculator which contains methods to calculate area of circle, area of square
and area of triangle.
24. Create a class rectangle in package "geom" . The class has private attributes length and width, each
of which defaults to 1. It should have member methods that calculate the perimeter and area of the
rectangle. It should have set and get functions for both length and width. The set functions should verify
that length and width are each floating-point numbers larger than 0.0 and less than 20.0.
Write TestRect class in package "test_geom" : to create 2 rectangles & invoke setters/geters & display
perimeter & area.
Create Point class Point2D : for representing a point in x-y co-ordinate system.
Create a parameterized constructor to accept x & y co-ords.
Add isEqual method : boolean returning method : must ret. true if both points are having same x,y co-
ords or false otherwise. : (public boolean isEqual(Point2D p))
Write TestPointArray class. Accept no of points to be made from the user : use scanner
Accept the point x,y co-ords from the user using Scanner class.
Create Point class Point2D : for representing a point in x-y co-ordinate system.
Add show method : to return the x & y coords .(public String show())
Add isEqual method : boolean returning method : must ret. true if both points are having same x,y co-
ords or false otherwise. : (public boolean isEqual(Point2D p))
Write TestPoint class having main method. Create two points passing passing arguments to
parameterized constructor. Accept x and y co-ods from user using Scanner class. Invoke show method
and isEqual method.
28.
1.1
SalariedEmployee - id,name,addr,deptId,basic,hra,da
1.2
CommissionEmp - id,name,addr,deptId,grossSales,commissionRate
1.3
PartWorker - id,name,addr,deptId,partsMade,ratePerPart
Net Sal=basic+(partsMade*ratePerPart)
Display Menu
5 . Display the employee Name whose earning( net salary) is maximum in the organization.
6. Exit
1. Create Java application for fixed stack & growable stack of integer.(Hint : Stack interface & imple. class
FixedSt & GrowableSt) From tester class --- display Menu
1 -- Push data
2 ---Pop data
3 -- Exit