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

Java Assignment

please answer and send the file by docx file
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Java Assignment

please answer and send the file by docx file
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Jimma Institute of technology

Faculty of computing and informatics

Individual assignment (20%) for IT 3rd year students


Instructions
● Copying from others or Chabot’s will yield no results.
● Late assignments will be penalized.
● Pay close attention to the questions and answers discussed, as they may be relevant to the
final exam.
Answer the following questions accordingly.
1. Explain the techniques involved in creating a method or constructor that can dynamically
handle a varying number of input parameters. Provide a code example demonstrating the
implementation of such a flexible method or constructor.
2. Develop a Java program that encrypts a given plaintext string using a Caesar cipher
technique. The encryption process involves shifting each character of the plaintext by a
fixed number of positions, determined by the encryption key. Implement the algorithm and
test its correctness with a variety of input strings and encryption keys.
3. Define the concepts of a class and an object in Java. Create a Car class with specific
attributes. Instantiate an object of the Car class. Display the attributes of the created object.
4. Explain the concept of inheritance in object-oriented programming. Create a base class
called Animal with a method makeSound(). Derive two subclasses, Dog and Cat, that
override the makeSound() method. Write a main method to demonstrate polymorphism by
calling the makeSound() method on objects of both subclasses.
5. Compare structural programming with object-oriented programming. Discuss key
differences in terms of code organization, reusability, and scalability. Provide examples in
Java to illustrate your points.
6. Differentiate between the following Java programming concepts. Provide an example to
illustrate your explanation.
a) this and super reference
b) Overloading and Overriding
c) Implicit and explicit casting
d) throw and throws
e) Encapsulation and abstraction
f) Interface and abstract class
g) Checked and unchecked exception
h) Methods and Constructors
7. Given

Figure 1. Frame

Questions
a. Develop a Java program to construct a graphical user interface (GUI) as depicted in Figure 1, with
dimensions of 250 pixels by 300 pixels.
b. Attach an action listener to each button. When a button is clicked, calculate the corresponding
operation (addition, subtraction, multiplication, division, or modulo) on the values in the first and
second text fields. Display the result in the result text field. Implement an action listener for the
exit button to close the application window.

Good luck!

You might also like