Uploaded by wstar2176

D7B 43 OOPM assignment 2 Aditya Nehete

advertisement
Aditya Nehete
D7B/43
1. The Department of Computer Engineering wants to maintain a record of books. If any
new book is purchased then it is added to the list. Also if any book is damaged or
misplaced it can be deleted from the list. Write a program to perform above operations
and display a list of books available in the department.
CODE:-
OUTPUT:-
2. Write a program to display the area of square triangle and circle. Make
use of interfaces to define templates of methods to be implemented in desired
classes.
CODE:-
OUTPUT:-
3.Write a program to check whether the entered four digit number is
vampire or not. Combination of digits from this number forms two 2 digit
numbers. When they are multiplied by each other, we get original
number.eg: 1260=21*60.
CODE:-
OUTPUT:-
4.In a garden, trees are maintained. A tree has the following set of
attributes:Tree code, heights, base and amount spent on the tree so far. Define
Tree class, its constructor, display() and update() that updates tree
information.Define derive class Mango tree that has additional yield attribute.
Define Garden class and display information of a tree and a Mango Tree.
CODE:-
OUTPUT:-
5.Write a program to replace all the occurrences of a particular character in
a line of text, with a new character. Take the input line and the two
characters as a user input. For example if the text line is: keep our city
cleanThe character 'e' to be replaced with '#' then the output is: k# #p our
city cl#an.
CODE:-
OUTPUT:-
6.Assume a Bank maintains two kinds of accounts for its customers. One is
called a Savings account and the other is a Current account. The savings
account interest rate is 5% per year and for the current account there is no
interest. A Savings account should hold a minimum balance but there is no
restriction on the current account. Create an abstract class called Account
that stores customer name, account number. Derive savings and current
account classes from the Account class and add specific attributes to each of
the derived classes. Write an interactive program to create a specific type of
account and it should follow the following functionality:
1. Accept
Deposit and update balance 2. Compute and Deposit interest 3. Permit
withdraw and update balance.
CODE:-
OUTPUT:-
7.Write applet program to display a circle, line and an Arc inside applets
visible area.
CODE:-
OUTPUT:-
8.Write a program to create multiple threads. Demonstrate the use of
isAlive(), getName(), setName(), setPriority() and getPriority() methods of
Thread Class.
CODE:-
OUTPUT:-
9.Write a program to perform division of two numbers accepted from the
user. Handle the IOException. Number FormatException and Arithmetic
Exception using multiple try catch block.
CODE:-
OUTPUT:-
Download