-
Notifications
You must be signed in to change notification settings - Fork 13
Evgen's #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Trixterfox1985
wants to merge
2
commits into
oleksandr-kazimirov:master
Choose a base branch
from
Trixterfox1985:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Evgen's #6
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| public class Cat extends Pet { | ||
|
|
||
| public Cat() { | ||
| } | ||
|
|
||
| @Override | ||
| public void voice(){ | ||
| System.out.println("Я кіт- Мяууу-Мяууу"); | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| public class Cow extends Pet { | ||
|
|
||
| public Cow() { | ||
| } | ||
|
|
||
| @Override | ||
| public void voice(){ | ||
| System.out.println("Я корова- Мууу-Мууу"); | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| public class Dog extends Pet { | ||
|
|
||
| public Dog() { | ||
| } | ||
|
|
||
| @Override | ||
| public void voice(){ | ||
| System.out.println("Я пес- Гаууу-Гаууу"); | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| public class MyMath { | ||
|
|
||
| private static final int ARG1 = 16; | ||
| private static final int ARG2 = 20; | ||
| private static final int ARG3 = -5; | ||
| private static final double ARG4 = 39.60; | ||
|
|
||
| static { | ||
| System.out.println("Параметри констант які були задані: "); | ||
| System.out.println("ARG1 -> " + ARG1); | ||
| System.out.println("ARG2 -> " + ARG2); | ||
| System.out.println("ARG3 -> " + ARG3); | ||
| System.out.println("ARG4 -> " + ARG4); | ||
| System.out.println(); | ||
| } | ||
|
|
||
| public static int getARG1() { | ||
| return ARG1; | ||
| } | ||
|
|
||
| public static int getARG2() { | ||
| return ARG2; | ||
| } | ||
|
|
||
| public static int getARG3() { | ||
| return ARG3; | ||
| } | ||
|
|
||
| public static double getARG4() { | ||
| return ARG4; | ||
| } | ||
|
|
||
| public static int mathsumall(){ | ||
| System.out.println("Вивести суму всіх значень -> " + (ARG1 + ARG2 + ARG3 + ARG4)); | ||
| System.out.println(); | ||
| return (int)(ARG1 + ARG2 + ARG3 + ARG4); | ||
| } | ||
|
|
||
| public static void mathround(){ | ||
| System.out.println("Округлити значення із плаваючою комою -> " + getARG4() + " -> " + Math.round(getARG4())); | ||
| System.out.println(); | ||
| } | ||
|
|
||
| public static void mathavg(){ | ||
| System.out.println("Визначити корінь кв. -> " + Math.sqrt(mathsumall())); | ||
| System.out.println(); | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import java.sql.SQLOutput; | ||
|
|
||
| public class MyMathExecution { | ||
| public static void main(String[] args) { | ||
| MyMath matemat = new MyMath(); | ||
|
|
||
| int i; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. assign the result to this variable at once |
||
|
|
||
| matemat.mathsumall(); | ||
| matemat.mathround(); | ||
| matemat.mathavg(); | ||
|
|
||
| i = Math.max(MyMath.getARG1(), MyMath.getARG2()); | ||
|
|
||
| System.out.println("З елементів " + matemat.getARG1() + " та " + matemat.getARG2() + " більший: " + i); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| public abstract class Pet { | ||
|
|
||
| public Pet() { | ||
| } | ||
|
|
||
| public abstract void voice(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| //Написати клас абстрактний Pet , в якому описати абстрактний метод voice(). Створити класи Cow, Cat, Dog , які наслідуються від Pet. Перевизначити в них метод voice(), так, | ||
| // щоб викликаючи його в методі main, на консоль виводилось : “Я кіт- Мяууу-Мяууу”, “Я пес- Гаууу-Гаууу”, “Я корова- Мууу-Мууу”. | ||
|
|
||
| public class PetExecution { | ||
| public static void main(String[] args) { | ||
|
|
||
| Pet dog = new Dog(); | ||
| Pet cat = new Cat(); | ||
| Pet cow = new Cow(); | ||
| Dog dog1 = new Dog(); | ||
|
|
||
| dog.voice(); | ||
| dog1.voice(); | ||
| cat.voice(); | ||
| cow.voice(); | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
camelcase