List of Assignments Java
List of Assignments Java
Code:
package com.atharv;
import java.util.ArrayList;
import java.util.Scanner;
public AccountHolder()
{
switch(choise)
{
case 1:
AccountHolder ac = new AccountHolder();
ac.CreateAccount();
list.add(ac);
break;
case 2:
for(AccountHolder acc:list)
{
acc.display();
}
break;
case 3:
System.out.println("Enter account number for which you want to deposite
amount: ");
int accountNumberDeposite = scan.nextInt();
System.out.println("Enter amount to deposite");
double amount = scan.nextDouble();
for(AccountHolder ah:list)
{
if(ah.getAccount_number()==accountNumberDeposite)
{
ah.deposite(amount);
}
}
break;
case 4:
System.out.println("Enter account number for which you want to Withdraw
amount: ");
int accountNumberwithdraw = scan.nextInt();
System.out.println("Enter amount to withdraw");
double amounttowithdraw = scan.nextDouble();
for(AccountHolder ah:list)
{
if(ah.getAccount_number()==accountNumberwithdraw)
{
ah.deposite(amounttowithdraw);
}
}
break;
case 5:
System.exit(0);
}
}
}
}
2. Write a class Student with members for rollno, name and percentage. Implement necessary
methods inside class. Write a code to print number of objects created for class Student. Use
static.
Code:
package com.atharv;
public student()
count++;
rollno = r;
name = n;
percentage = per;
count ++;
System.out.println(student.count);
Packages
9. Take attributes for number, name and price in class Vehicle. Implement “equals” and
“hashcode” methods for class Vehicle.
10. Clone the objects of above class Vehicle by implementing “cloneable” interface.
11. Write a class Employee for an application which will have data members for employee id,
employee name and salary. Provide the following functionalities in Employee class.
1. Initialing objects using default and parameterized constructors.
2. Accepting and displaying the information of employee from console
In "main" method take an array list of Employee objects. Write a menu driven program to -
a. Insert record into an array list.
b. Update information of specific employee on the basis of emp_id accepted from user
c. Display all records.
b. Now write a class 'UtilityList' which has list of Student objects as member.
class UtilityList
{
private List<Student> list;
// methods of Utility class
}
c. Write a class 'UtilityReport' has a method 'showReport()' This method shows report like:
StudentName-->Percentage
class UtilityReport
{
private Map<String, Double> m;
// method of class UtilityReport
}
13. Sort the objects of class Student (implemented earlier) according to their percentage. Use
comparator interface
14. Sort the objects of class Student (implemented earlier) according to their percentage. Use
comparable interface
Exception Handling
Multithreading
17. Refer class Account implemented in question 19. Make its methods synchronized to avoid
thread interference.
18. Display a filled circle in a frame. Make this circle to move/toggle between left and right walls of
frame. Use multithreading.
19. There are three circles in a frame (red, blue green). These circles moves from left to right with
constant speed. Red is fastest moving. Green is slowest moving and blue is moving with
intermediate speed. All of them start at same time. Whichever reaches to right edge will wait for
others to come. When last one(green) will reach to right edge, all of them will again start the
execution from left.
JDBC
20. Create table student in database with fields for rollno, name and percentage.
Using JDBC perform following operations on this table through menu driven java program.
a. Insert record
b. Update record
c. Delete record
d. Display particular record from table
e. Display all records from table
File Handling
21. Serialize and de-serialize objects of class Student into a file student.txt