Skip to content

Latest commit

 

History

History
135 lines (81 loc) · 7.35 KB

File metadata and controls

135 lines (81 loc) · 7.35 KB

Java Programming Lab (PCS-408)

This repository contains solutions to Java programming assignments covering various concepts and techniques.

Assignment Questions and Solutions

1. Command Line Input

Question: Write a java program to take input as a command line argument - your name, course, university roll number and semester. Display the information.

Solution: CommandLineInput.java

2. Bank Deposit Calculator

Question: Using the switch statement, write a menu-driven program to calculate the maturity amount of a bank deposit. The user can choose between Term Deposit and Recurring Deposit, with different formulas for each.

Solution: BankDepositCalculator.java

3. Friendly Pair Checker

Question: Program to find if the given numbers are Friendly pair or not (Amicable or not). Friendly Pair are two or more numbers with a common abundance.

Solution: FriendlyPairChecker.java

4. Replace Zeros with Ones

Question: Program to replace all 0's with 1 in a given integer.

Solution: ReplaceZerosWithOnes.java

5. ZigZag Array

Question: Printing an array into Zigzag fashion where the converted array should be in the form of e1 < e2 > e3 < e4 > e5 < e6.

Solution: ZigZagArray.java

6. Rearrange Positive and Negative Numbers

Question: The problem to rearrange positive and negative numbers in an array, with all negative numbers at the beginning.

Solution: RearrangePositiveNegative.java

7. Saddle Point Finder

Question: Program to find the saddle point coordinates in a given matrix. A saddle point is an element of the matrix, which is the minimum element in its row and the maximum in its column.

Solution: SaddlePointFinder.java

8. Binary Pattern Finder

Question: Program to find all the patterns of 0(1+)0 in the given string. The pattern requires at least one '1' between two '0's.

Solution: BinaryPatternFinder.java

9. Bank Management System

Question: Write a java program to create a class named 'Bank' to manage depositor information, generate unique account numbers, and perform operations like deposit, withdrawal, and address change.

Solution: Bank.java

10. Word Example Program

Question: Define a class WordExample to process sentences, count words beginning and ending with a vowel, and place such words at the beginning of the sentence.

Solution: WordExample.java

11. Array Function Overloading

Question: Write a Java program to create a class called ArrayDemo and overload arrayFunc() function to perform different operations on arrays.

Solution: ArrayDemo.java

12. Shape Area Calculator

Question: Write a java program to calculate the area of a rectangle, a square and a circle using abstract classes and methods.

Solution: ShapeArea.java

13. Temperature Converter

Question: Write a java program to implement abstract class and abstract method to convert between Fahrenheit and Celsius temperatures.

Solution: TemperatureConverter.java

14. Volume Calculator

Question: Write a java program to create an interface that consists of a method to display volume() as an abstract method and implement it in classes for Cone, Hemisphere, and Cylinder.

Solution: VolumeCalculator.java

15. Student Management System

Question: Design a student management system using Java packages to manage information about students, courses, and their enrollments.

Solution: StudentManagementSystem.java

16. Employee Validator

Question: Write a java program to accept and print the employee details during runtime with validation for name, employee ID, and department ID, raising exceptions for invalid data.

Solution: EmployeeValidator.java

17. Power Calculator

Question: Create a class MyCalculator with a power(int, int) method that handles exceptions for negative inputs and zero inputs.

Solution: MyCalculator.java

18. Palindrome Counter

Question: Write a java file handling program to count and display the number of palindromes present in a text file "myfile.txt".

Solution: PalindromeCounter.java

19. Multi-Threading Example

Question: Write a program MultiThreads that creates two threads - CSthread and ITthread - which display their names and execution counts.

Solution: MultiThreads.java

20. Producer-Consumer Problem

Question: Write a java program to solve the producer-consumer problem in which a producer produces a value and a consumer consumes the value before the producer generates the next value.

Solution: ProducerConsumer.java

21. Remove Even Length Strings

Question: Write a method removeEvenLength that takes an ArrayList of Strings as a parameter and removes all strings of even length.

Solution: RemoveEvenLength.java

22. Swap Pairs in ArrayList

Question: Write a method swapPairs that switches the order of values in an ArrayList of Strings in a pairwise fashion.

Solution: SwapPairs.java

23. Alternate Lists

Question: Write a method called alternate that accepts two Lists of integers as parameters and returns a new List containing alternating elements from the two lists.

Solution: AlternateLists.java

24. Vowel Counter GUI

Question: Write a GUI program that receives a string in one text field, counts the number of vowels, and displays the result in another text field when a button is clicked.

Solution: VowelCounterGUI.java

25. Movie Ticket Booking System

Question: Design a JavaFX-based movie ticket booking system where users can select a movie, choose a showtime, and specify the number of tickets they wish to purchase.

Solution: MovieTicketBookingSystem.java

26. URL

Question: url Checker .

Solution: URL.java