0% found this document useful (0 votes)
85 views

B. Sc. (H) Computer Science Semester II BHCS03 - Programming in JAVA

This document outlines the topics and chapters covered in the Programming in Java course, along with references and additional resources. It also provides a list of 13 practical programming assignments to complete as part of the course, covering topics like classes, inheritance, exceptions, file I/O, GUI programming using AWT and Swing. The practicals involve tasks such as defining classes for complex numbers, shapes, and implementing a stack with exception handling for overflow/underflow.

Uploaded by

nps
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views

B. Sc. (H) Computer Science Semester II BHCS03 - Programming in JAVA

This document outlines the topics and chapters covered in the Programming in Java course, along with references and additional resources. It also provides a list of 13 practical programming assignments to complete as part of the course, covering topics like classes, inheritance, exceptions, file I/O, GUI programming using AWT and Swing. The practicals involve tasks such as defining classes for complex numbers, shapes, and implementing a stack with exception handling for overflow/underflow.

Uploaded by

nps
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

B.

Sc. (H) Computer Science Semester II


BHCS03 – Programming in JAVA

Chapter Topic Contents

1 The History and Evolution of Java Complete

2 An Overview of Java Complete

3 Data Types, Variables and Arrays Complete

4 Operators Complete

5 Control Statements Complete

6 Introducing Classes Complete

7 A Closer Look at Methods and Upto pg 156


Classes

8 Inheritance Complete

9 Packages and Interfaces Complete

10 Exception Handling Complete

13 I/O, Try-with-Resources, and Other Upto pg 322 (before The transient and
Topics volatile Modifiers)

24 Event Handling Complete

25 Introducing the AWT: Working Upto pg 817


with Windows, Graphics and Text

26 Using AWT Controls, Layout Upto pg 837 (before Applying Check


Managers, and Menus Boxes)

31 Introducing Swing Complete

32 Exploring Swing Upto pg 1037




References
1. Schildt, H. (2018). Java: The Complete Reference. 10th edition. McGraw-Hill Education.

Additional Resources
1. Balaguruswamy, E. (2014). Programming with JAVA: A Primer. 5th edition. India: McGraw
Hill Education
2. Horstmann, C. S. (2017). Core Java - Vol. I – Fundamentals (Vol. 10). Pearson Education
3. Schildt, H., & Skrien, D. (2012). Java Fundamentals - A Comprehensive Introduction. India:
McGraw Hill Education.



B. Sc. (H) Computer Science Semester II
BHCS03 – Programming in JAVA
Practical List

1) Design a class Complex having a real part (x) and an imaginary part (y). Provide methods
to perform the following on complex numbers:
a) Add two complex numbers.
b) Multiply two complex numbers.
c) toString() method to display complex numbers in the form: x + i y
2) Create a class TwoDim which contains private members as x and y coordinates in
package P1. Define the default constructor, a parameterized constructor and override
toString() method to display the co-ordinates. Now reuse this class and in package P2
create another class ThreeDim, adding a new dimension as z as its private member.
Define the constructors for the subclass and override toString() method in the subclass
also. Write appropriate methods to show dynamic method dispatch. The main() function
should be in a package P.
3) Define an abstract class Shape in package P1. Inherit two more classes: Rectangle in
package P2 and Circle in package P3. Write a program to ask the user for the type of
shape and then using the concept of dynamic method dispatch, display the area of the
appropriate subclass. Also write appropriate methods to read the data. The main()
function should not be in any package.
4) Create an exception subclass UnderAge, which prints “Under Age” along with the age
value when an object of UnderAge class is printed in the catch statement. Write a class
exceptionDemo in which the method test() throws UnderAge exception if the variable
age passed to it as argument is less than 18. Write main() method also to show working
of the program.
5) Write a program to implement stack. Use exception handling to manage underflow and
overflow conditions.
6) Write a program that copies content of one file to another. Pass the names of the files
through command-line arguments.
7) Write a program to read a file and display only those lines that have the first two
characters as '//' (Use try with resources).
8) Write a program to create a frame using AWT. Implement mouseClicked(),
mouseEntered() and mouseExited() events such that:
a) Size of the frame should be tripled when mouse enters it.
b) Frame should reduce to its original size when mouse is clicked in it.
c) Close the frame when mouse exits it.
9) Using AWT, write a program to display a string in frame window with pink color as
background.
10) Using AWT, write a program to create two buttons named “Red” and “Blue”. When a
button is pressed the background color should be set to the color named by the button’s
label.
11) Using AWT, write a program using appropriate adapter class to display the message
(“Typed character is: <typedCharacter>”) in the frame window when user types any key.
12) Using AWT, write a program to create two buttons labelled ‘A’ and ‘B’. When button ‘A’
is pressed, it displays your personal information (Name, Course, Roll No, College) and
when button ‘B’ is pressed, it displays your CGPA in previous semester.
13) Rewrite all the above GUI programs using Swing.

You might also like