Posts

CST 362 PROGRAMMING IN PYTHON(2019 scheme S6 Program Elective I )

CST 362 PROGRAMMING IN PYTHON(2019 scheme S6 Program Elective I )            🌈SYLLABUS            🕮TEXTBOOK : 1.   Kenneth A Lambert., Fundamentals of Python : First Programs, 2/e, Cengage Publishing, 2016 2.                                             2. Wes McKinney, Python for Data Analysis, 2/e, Shroff / O’Reilly Publishers, 2017 📖MODULES NOTES Module 1:  Programming Environment and Python Basics Module 2:  String & Text File                     Function ,List                     Dictionaries Sample Question Module 3:   Turtle                        Image Processing  ...

SOLID Principles

  🌟 SOLID Principles SOLID is a set of five object-oriented design principles that help you write clean, maintainable, and flexible code. S – Single Responsibility Principle (SRP) One class = One responsibility ✔ A class should do only one job ✔ It should have only one reason to change Example: A Book class should only store book data. Validation should be in another class. O – Open/Closed Principle (OCP) Open for extension, closed for modification ✔ You should be able to add new features ✔ Without changing existing code Example: Instead of modifying a class, create a subclass to extend behavior. L – Liskov Substitution Principle (LSP) Child classes should behave like parent classes ✔ A subclass should be usable wherever the parent class is used ✔ It should not break the program Example: A Square should behave like a Rectangle if it extends Rectangle. I – Interface Segregation Principle (ISP) No class should be forced to implement methods it doesn’t us...

Design Pattern

🎯 What Are Design Patterns? Design patterns are  proven solutions  to  common software design problems . They represent  best practices  refined over time by experienced developers. They help you: Write  reusable  and  maintainable  code. Improve communication between team members using a  common vocabulary  (e.g., "This uses the Singleton pattern "). Solve structural or behavioral challenges in object-oriented design. 🧩 Categories of Design Patterns Creational  – deal with object creation (e.g., Singleton , Factory ). Structural  – deal with class/object composition (e.g., Adapter , Decorator ). Behavioral  – deal with object communication (e.g., Observer , Strategy ). 🟨 1. Singleton Design Pattern (Creational) ✅ Purpose: Ensure  only one instance  of a class exists in the application and provide a  global point of access  to it. 🔧 When to Use: Configuration manager Database connection pool L...

BASIC STRING AND ARRAY QUESTION IN JAVA.

 BASIC STRING AND ARRAY QUESTION IN JAVA. 1. Write a java program to reverse a string.  2. Write a java program  to Check if String is Palindrome. 3. Write a java program  to  Count Vowels in a String. 4. Write a java program  to  Check whether two given strings are anagram of each other or not. 5. Write a Java program to find the frequency (count the occurrence) of each element in an integer array. 6. Write a Java program to sum the elements of an array. 7. Write a Java Program to print the elements of an array present on even position. 8. Write a Java Program to find largest element of an array. 9. Write a Java program to find smallest number in an array. 10. Write a Java Program to display Fibonacci series using loops 11. Write a Java Program to find Factorial using loops

BASIC STRING PROGRAMS IN JAVA

 BASIC STRING PROGRAMS IN JAVA 1. Find Length of a String public class StringLength { public static void main (String[] args) { String str = "Hello, Java!" ; System.out.println( "Length of the string: " + str.length()); } } 2. Compare Two Strings public class StringCompare { public static void main (String[] args) { String s1 = "Hello" ; String s2 = "hello" ; System.out.println( "Using equals(): " + s1.equals(s2)); System.out.println( "Using equalsIgnoreCase(): " + s1.equalsIgnoreCase(s2)); } } 3. Concatenate Two Strings j public class StringConcat { public static void main (String[] args) { String s1 = "Hello" ; String s2 = "World" ; String result = s1 + " " + s2; System.out.println( "Concatenated String: " + result); } } 4. Rever...

JAVA PROGRAMS USING OPERATORS

Image
✅ 1. Java Arithmetic Operators Arithmetic operators are used to perform arithmetic operations on variables and data. class Main {   public static void main(String[] args) {     // declare variables     int a = 12, b = 5;     // addition operator     System.out.println("a + b = " + (a + b));     // subtraction operator     System.out.println("a - b = " + (a - b));     // multiplication operator     System.out.println("a * b = " + (a * b));     // division operator     System.out.println("a / b = " + (a / b));     // modulo operator     System.out.println("a % b = " + (a % b));   } } 2. Java Assignment Operators Assignment operators are used in Java to assign values to variables class Main {   public static void main(String[] args) {     // create variables     int a = 4;     int var;     // assign value using = ...

BASIC JAVA PROGRAMS

 BASIC JAVA PROGRAMS ✅ 1.  Check if a Number is Even or Odd Problem : Read a number and check whether it is even or odd. import java.util.Scanner; public class EvenOddCheck { public static void main (String[] args) { Scanner sc = new Scanner (System.in); System.out.print( "Enter a number: " ); int num = sc.nextInt(); if (num % 2 == 0 ) System.out.println(num + " is Even." ); else System.out.println(num + " is Odd." ); } } ✅ 2.  Find the Largest of Three Numbers Problem : Take three numbers as input and find the largest among them. import java.util.Scanner; public class LargestOfThree { public static void main (String[] args) { Scanner sc = new Scanner (System.in); System.out.print( "Enter three numbers: " ); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); if (a ...