Sei sulla pagina 1di 6

Assignment-1

1. List and Explain basic features of any object oriented programming.


2. Draw and explain the terms present in object oriented paradigm.
3. Draw and explain java environment. (API, JDK, JSL, JRE, JVM). What
is the requirement of compiling java program? What is the minimum
requirement for running java program? Also, draw diagram showing that
java is two stage language.
4. List and explain (with an example) features or characteristics of JAVA
programming language.
5. Draw JAVA program structure.
6. Difference between C, C++ and JAVA

Assignment-2

7. Write and Implement simple HelloWorld java program. Write command


used for compiling and running the program. Also write the program
output.
8. Show that, (i) what happen if class name and file name are different
(without public access s. (ii) what happen if class is declared with
“public” access modifiers/ specifier and java program filename.
9. Mention the reasons for following term required for (Q1) program-
public, static, void, main, String[], class-name
10.Why in java public class name and filename are same. Also mention the
reason for “why there should be only one public class in single java file”.

Assignment-3

11.Design a class to represent a bank account contains following members:


Data Members- Name of the depositor, account number, type of account
and balance in account.
Methods - to assign initial values, to deposit an amount, to withdraw an
amount after checking balance and to display account details.

12.Design and implement your choice any application to demonstrate how


access specifier and non access specifier are used in java.(Implement
access specifier table and non access specifier -- with data member,
method and class) . Also draw class diagram.

13.Display Hello world on console without creating any object and writing
any code in main method.
Count number objects create from class using static variable.
Also show the execution priority for Static block, initialization block,
static main method

14.Demonstrate how to use static data member and static method, non static
data member and non static method, in static method and non static
method.
Let, a is non static data member and b is static data member. Display is
non static method and show is static method. Both methods contain
addition logic for data member. Show that how a, b and display method is
accessible in show method. Also show that how a, b and show method
accessible in display.

15.Demonstrate how we will get following error in java program-


a) cannot assign value to variable,
b) cannot override method,
c) cannot subclass the class.

16.Count number of object created for concrete class.

17.Demonstrate abstract keyword with method and class. Also demonstrate


what are the illegal non access specifier combination and print why this
combination is illegal.

18.Write a Java Program to define a class, define instance methods and


overload them and use them for dynamic method invocation

19.Demonstrate how you are using access and non access specifier for
solving following problem.
Problem statement - Assume that the bank maintains two kinds of
account of its customers, one called saving account and the other current
account.
The saving account provides compound interest and withdrawal facility
but no cheque book facility. The current account provides cheque book
facility but no interest.
Current account holders should also maintain a minimum balance and if
the balance fall below the this level, a service charges imposed.
Create a class Account that stores customer name, account number and
type of account.
From this class Current-Account and Saving-Account, make them more
specific to their requirements. Includes necessary methods in order to
achieve the following task:
a) accept deposit from customer and update balance.
b) display the balance for account
c) display banks opening and closing balance and check this balance
is same after performing all transaction made on that period.
d) Compute and deposit interest.
e) Permit withdrawal and update balance
f) check for minimum balance, impose penalty if necessary and
update balance.
g) create and assign system generated account number to customer.
h) check no two customer contain same details, if details are same
then mark account as duplicate and make sure that duplicate type is
not allowed to change. Also delete previous account and update all
details in new account. (show the use of static, final, abstract and
access specifier). If required assume suitable data and mention
your assumption in program - either in comment form or call
method to print assumption on console.

20.Demonstrate different types of inner classes and show how to access data
member and methods in inner class. Also show how to access inner class
method.

21.Demonstrate how to override class method using anonymous class.

22.Write difference between nested class and static nested class. Mention
reason for why outermost class not allows with non access specifier
static.

23.Create a Outer Class contain non static data member a and static data
member b. Perform the addition of a and b, show result in data member.
(Inner Class- non static).

24.Create a student class. Student class contain the Create non-static data
member for storing information about 4 years mark and pass percentage.
Count the number student above BB grade.
25.To write a Java Program to design an abstract class / interface class for
Stack ADT and implement Stack ADT operation using array.
a) Create single level inheritance with parent class is abstract class.
b) Create single level inheritance in which parent class is interface
class.

26.Write a java program to create an abstract class named shape that


contains two integers and an empty method named printArea(). Provide
three classes named Rectangle, Triangle and Circle such that classes
contains only the method printArea() that prints the area of the given
shape

27.To develop a vehicle class hierarchy in Java to demonstrate the concept


of polymorphism. Declare a super class called vehicle with data elements
doors, wheels and seats. Derive another class called car and invoke an
overridden function tostring() to display the variables doors, wheels, and
seats. Derive another class called motorcycle with same data and method
called setseats(). Declare another sub class called Truck with 2
constructors and finally assign values to variables. In the main function,
create an object for class motorcycle and display all details of sub classes
through object.

28.Write a java program to create an abstract class named shape that


contains two integers and an empty method named printArea(). Provide
three classes named Rectangle, Triangle and Circle such that classes
contains only the method printArea() that prints the area of the given
shape.

29.Write a java program to create an abstract class named shape that


contains two integers and an empty method named printArea(). Provide
three classes named Rectangle, Triangle and Circle such that classes
contains only the method printArea() that prints the area of the given
shape. Implement above program using interface. create three interface
for each class and from that derive shape class.

30.Write a program to handle stock of a wholesale grocery shop using


interface. Maintain available stock of dairy product, wafers, vegetables,
beverages separately. Check the current demand by customers and place
an order if stock is not sufficient. Update the stock accordingly. Interface
includes all common methods also stock information is related to
interface not individual class assume that grocery shop handle only
limited orders.

31.Write a java program to show invalid interface declaration and use in


multiple inheritance. show errors.

32.Write a java program to create an abstract class named shape that


contains two integers and an empty method named printArea(). Provide
three classes named Rectangle, Triangle and Circle such that classes
contains only the method printArea() that prints the area of the given
shape. Implement above program using interface. create three interface
for each class. and from that derive shape class. Demonstrating how
interface derived from another interface. Assume display method present
in new interface.

33.Implement following diagram for your choice application.

34.Implement following diagram –


35.Write a Java program to implement the concept of importing classes from
user defined package and creating packages. Suppose student class
present in package-1. Exam class present in package-2. Use student class
in exam package and find how students are passed with grade A, B and C.

36.Write a program to implement the concept of Exception Handling using


predefined exception.

37.Write a program to implement the concept of Exception Handling by


creating user defined exceptions.

38.To write a multi-threaded Java program to print all numbers below


100,000 that are both prime and Fibonacci number (some examples are 2,
3, 5, 13, etc.). Design a thread that generates prime numbers below
100,000 and writes them into a pipe. Design another thread that generates
fibonacci numbers and writes them to another pipe. The main thread
should read both the pipes to identify numbers common to both.

Potrebbero piacerti anche