Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
2
20231104-KursPodstawowyALX
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Patryk Czarnik
20231104-KursPodstawowyALX
Commits
18bf1a05
Commit
18bf1a05
authored
Dec 03, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pierwsze zmiany w widoczoności - work in progress :)
parent
96d12e94
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
6 deletions
+13
-6
Osoba.java
src/main/java/p10_klasy/v5/Osoba.java
+2
-2
Przyklad.java
src/main/java/p10_klasy/v5/Przyklad.java
+5
-2
Student.java
src/main/java/p10_klasy/v5/Student.java
+6
-2
No files found.
src/main/java/p10_klasy/v5/Osoba.java
View file @
18bf1a05
package
p10_klasy
.
v5
;
public
class
Osoba
{
String
imie
,
nazwisko
;
int
wiek
;
protected
String
imie
,
nazwisko
;
protected
int
wiek
;
Osoba
()
{
}
...
...
src/main/java/p10_klasy/v5/Przyklad.java
View file @
18bf1a05
...
...
@@ -5,14 +5,17 @@ public class Przyklad {
public
static
void
main
(
String
[]
args
)
{
Osoba
osoba
=
new
Osoba
(
"Ala"
,
"Kowalska"
,
30
);
osoba
.
przedstawSie
();
System
.
out
.
println
(
"Imię i nazwisko: "
+
osoba
.
imie
+
" "
+
osoba
.
nazwisko
);
// System.out.println("Imię i nazwisko: " + osoba.imie + " " + osoba.nazwisko);
// osoba.imie = "Alicja";
osoba
.
przedstawSie
();
Student
student
=
new
Student
(
"Adam"
,
"Abacki"
,
21
,
2
,
"medycyna"
);
student
.
przedstawSie
();
student
.
dodajOcene
(
4
);
student
.
dodajOcene
(
4
);
student
.
dodajOcene
(
5
);
student
.
oceny
.
add
(
100
);
//NK student.oceny.add(100);
student
.
dodajOcene
(
100
);
System
.
out
.
println
(
"Średnia ocen: "
+
student
.
sredniaOcen
());
Sklep
zabka
=
new
Sklep
(
"Żabka"
,
6
);
...
...
src/main/java/p10_klasy/v5/Student.java
View file @
18bf1a05
...
...
@@ -6,7 +6,7 @@ import java.util.List;
public
class
Student
extends
Osoba
{
int
rok
;
String
kierunek
;
List
<
Integer
>
oceny
=
new
ArrayList
<>();
private
List
<
Integer
>
oceny
=
new
ArrayList
<>();
Student
()
{
}
...
...
@@ -25,7 +25,11 @@ public class Student extends Osoba {
// 2) Dodać nowe metody, których nie było w nadklasie
void
dodajOcene
(
int
ocena
)
{
oceny
.
add
(
ocena
);
if
(
ocena
>=
2
&&
ocena
<=
5
)
{
oceny
.
add
(
ocena
);
}
else
{
System
.
err
.
println
(
"błędna ocena "
+
ocena
);
}
}
double
sredniaOcen
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment