Intro to Computer Science in Java projects

Overview

This repository contains solutions to various exercises from the "Intro to Computer Science" course taken during the first semester of my Computer Science degree. Each exercise explores different fundamental programming concepts using Java, including recursion, basic algorithms, object-oriented design, and file handling.

Table of Contents

  1. Exercise 4
  2. Exercise 2
  3. Exercise 3
  4. Exercise 1

Exercise 4: Object-Oriented Geometry Painter

This exercise enhanced a geometric painting application. The project involved:

  • Adding new geometric shapes: rectangles and hexagons.
  • Implementing file save/load functionality for shapes.
  • Shape sorting by perimeter and allowing for the drawing of sorted shapes on a GUI using Java's Swing framework.

File: Ex4.java

See Full Description at java_ex4.pdf


Exercise 2: Image Processing Basics

In this task, the focus was on image manipulation. The program allows reading an image, processing it, and saving it back. Key operations include:

  • Grayscale conversion using RGB values.
  • Image rotation by 90 degrees.
  • Image smoothing through a blur filter.

File: Ex2.java

See Full Description at מטלה 2 - עדכון סופי.pdf


Exercise 3: String Manipulation and Rational Numbers

This exercise consisted of two main parts:

  1. String manipulation: Functions to split sentences into words, create a sorted dictionary of unique words, and handle text processing without using Java’s built-in utilities like split.
  2. Object-oriented programming: Implementing a class to handle rational numbers (Rational) with functionality for arithmetic operations, comparison, and simplification.

File: Ex3.java and Rational.java

See Full Description at Ex3.pdf


Exercise 1: Basic Recursion and Number Processing

In this exercise, we explored iterative and recursive number processing techniques. The tasks involved:

  • Summing the digits of a number iteratively until a single digit is obtained.
  • Checking if a number is "excessive", where the iterative sum of squares of its digits reaches 1.
  • Palindrome check to determine if a number is symmetrical.
  • Solving the Josephus problem using a mathematical formula.

File: EX1.java

See Full Description at Ex1.pdf


How to Run

To run the programs:

  1. Clone this repository.
    git clone https://github.com/elilfry/Intro_To_Programming_Java.git
  2. Compile the Java files using the Java compiler.
    javac EX1.java
  3. Run the compiled classes.
    java EX1

Make sure you have Java installed in your system to compile and run the code.