From 1412505d334e48200d91b9fe68898aac9c4568bb Mon Sep 17 00:00:00 2001 From: Oleksii Aleshchenko Date: Thu, 1 Jun 2023 16:06:50 +0300 Subject: [PATCH] add lab5 --- .idea/misc.xml | 3 +++ src/lab5/Letter.java | 9 +++++++++ src/lab5/Main.java | 10 ++++++++++ src/lab5/Word.java | 18 ++++++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 src/lab5/Letter.java create mode 100644 src/lab5/Main.java create mode 100644 src/lab5/Word.java diff --git a/.idea/misc.xml b/.idea/misc.xml index d15472f..a67b4ae 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,5 +1,8 @@ + + diff --git a/src/lab5/Letter.java b/src/lab5/Letter.java new file mode 100644 index 0000000..f4c7a9f --- /dev/null +++ b/src/lab5/Letter.java @@ -0,0 +1,9 @@ +package lab5; + +public class Letter { + private char symbol; + + public Letter(char symbol) { + this.symbol = symbol; + } +} diff --git a/src/lab5/Main.java b/src/lab5/Main.java new file mode 100644 index 0000000..54bb4cc --- /dev/null +++ b/src/lab5/Main.java @@ -0,0 +1,10 @@ +package lab5; + +public class Main { + public static void main(String[] args) { + + + + System.out.println("Done!"); + } +} diff --git a/src/lab5/Word.java b/src/lab5/Word.java new file mode 100644 index 0000000..504f806 --- /dev/null +++ b/src/lab5/Word.java @@ -0,0 +1,18 @@ +package lab5; + +public class Word { + private Letter[] letters; + + public Word(Letter[] letters) { + this.letters = letters; + } + + public Word(String wordString) { + letters = new Letter[wordString.length()]; + + final char[] chars = wordString.toCharArray(); + for (int i = 0; i < chars.length; i++) { + letters[i] = new Letter(chars[i]); + } + } +}