Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

5 Commits

Repository files navigation

University of West Attica

UNIVERSITY OF WEST ATTICA
SCHOOL OF ENGINEERING
DEPARTMENT OF COMPUTER ENGINEERING AND INFORMATICS

University of West Attica · Department of Computer Engineering and Informatics


Software Development Methodologies

Java I/O

Vasileios Evangelos Athanasiou
Student ID: 19390005

GitHub · LinkedIn


Supervision

Supervisor: Georgios Prezerakos, Professor

UNIWA Profile · LinkedIn

Co-supervisor: Angelos Georgoulas, Assistant Professor

Scholar · LinkedIn


Athens, April 2023



README

Java I/O

The purpose of this exercise set is to practice core Java Input/Output (I/O) operations, file handling, and basic programming structures.
It covers reading from standard input, file manipulation (reading/writing), and exception handling.


Table of Contents

SectionFolder/FileDescription
1INSTALL.mdInstallation and execution instructions
2README.mdProject overview and usage guide
3assign/Assignment description documents
3.1assign/SDM Exercise 2 (Input & Output).pdfAssignment description (English)
3.2assign/ΜΑΕ Ασκήση 2 (Input & Output).pdfAssignment description (Greek)
4src/Java source code projects demonstrating input/output operations
4.1src/CopyFiles/Java project for copying the contents of files
4.1.1src/CopyFiles/build/Compiled build output
4.1.2src/CopyFiles/build.xmlApache Ant build configuration
4.1.3src/CopyFiles/manifest.mfApplication manifest file
4.1.4src/CopyFiles/myfile.txtExample input file
4.1.5src/CopyFiles/myfile2.txtExample output/second file
4.1.6src/CopyFiles/nbproject/NetBeans project configuration files
4.1.7src/CopyFiles/src/copyfiles/Java source code package
4.2src/CountStatistics/Java project that calculates statistics from file data
4.2.1src/CountStatistics/build/Compiled build output
4.2.2src/CountStatistics/build.xmlApache Ant build configuration
4.2.3src/CountStatistics/manifest.mfApplication manifest file
4.2.4src/CountStatistics/myfile.txtExample input file
4.2.5src/CountStatistics/nbproject/NetBeans project configuration files
4.2.6src/CountStatistics/src/countstatistics/Java source code package
4.3src/Fibonacci/Java project that generates Fibonacci numbers and writes them to a file
4.3.1src/Fibonacci/build/Compiled build output
4.3.2src/Fibonacci/build.xmlApache Ant build configuration
4.3.3src/Fibonacci/manifest.mfApplication manifest file
4.3.4src/Fibonacci/fib50.txtExample file containing Fibonacci numbers
4.3.5src/Fibonacci/nbproject/NetBeans project configuration files
4.3.6src/Fibonacci/src/fibonacci/Java source code package
4.4src/ScannerExercise/Java project demonstrating the use of the Scanner class
4.4.1src/ScannerExercise/build/Compiled build output
4.4.2src/ScannerExercise/build.xmlApache Ant build configuration
4.4.3src/ScannerExercise/manifest.mfApplication manifest file
4.4.4src/ScannerExercise/nbproject/NetBeans project configuration files
4.4.5src/ScannerExercise/src/scannerexercise/Java source code package

1. Key Subjects Covered

  • Data Reading: Handling bytes and characters from standard input.
  • File Streams: Utilizing FileStreams for read/write operations.
  • Exception Handling: Managing runtime errors using try-catch blocks.
  • Logic Structures: Implementing if-else and while loops.
  • String & Scanner: String manipulation and using the Scanner class.

2. Exercises Description

2.1: Student Grade Processor

Create a console program that calculates the average grade for students based on standard input.

2.1.1 Input Format

  • Student registration number followed by pairs of:
    [Course Name] [Grade]

2.1.2 Termination Rules

  • Enter end to finish entering grades for a specific student.
  • Enter 000000 as a registration number to exit the program.

2.1.3 Output

  • Prints the student registration number and their calculated average grade.

2.2: File Copy Utility

Develop a program that copies the contents of one text file to another.

2.2.1 Process

  • The user provides:
    • The full path of the source file
    • The destination (copy) file path

2.2.2 Implementation Note

  • Use FileWriter and FileReader wrapped in Buffered Streams for better efficiency.

2.2.3 Error Handling

  • Use try-catch blocks to handle:
    • Invalid file paths
    • Missing files
    • Read/write errors

2.3: Text Statistics Analyzer

A program that reads a text file, displays its content, and calculates specific character statistics.

2.3.1 Statistics Tracked

  • Greek characters:

    • Alpha (Α, α)
    • Gamma (Γ, γ)
    • Omega (Ω, ω)
  • Odd digits:

    • 1, 3, 5, 7, 9

2.3.2 Implementation Tip

Use the read() method to process the file character by character.

2.4: Fibonacci Sequence to File

This program calculates the first 50 terms of the Fibonacci sequence and saves them to a text file.

2.4.1 File Format

Each term should appear on a new line:

F(0) = 0
F(1) = 1
F(2) = 1
...

2.4.2 Phase 2

Include an additional method that:

  1. Reads the generated Fibonacci file.
  2. Prints only the numerical values to the console.

About

Java exercises demonstrating file handling, input/output streams, and exception handling through practical programming examples (Software Devlopment Methodologies, UNIWA).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages