Skip to content

Commit 71a4237

Browse files
committed
interfaces
1 parent 5339f8b commit 71a4237

File tree

9 files changed

+87
-10
lines changed

9 files changed

+87
-10
lines changed

JavaOOP/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
google-cloud-sdk/
2+
google-cloud-cli-linux-x86_64.tar.gz
3+
app-engine-project
4+
__pycache__/
5+
*.pyc

JavaOOP/Exercises/Interface/Downloadable.java renamed to JavaOOP/Exercises/Interface/BaiTap7_1/Downloadable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package Exercises.Interface;
1+
package Exercises.Interface.BaiTap7_1;
22

33
public interface Downloadable {
44
public void download();

JavaOOP/Exercises/Interface/Playable.java renamed to JavaOOP/Exercises/Interface/BaiTap7_1/Playable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package Exercises.Interface;
1+
package Exercises.Interface.BaiTap7_1;
22

33
public interface Playable {
44
public void play();
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package Exercises.Interface.BaiTap7_1;
2+
3+
public class Video implements Playable, Downloadable {
4+
5+
@Override
6+
public void play() {
7+
System.out.println("Press the button to play!");
8+
}
9+
10+
@Override
11+
public void pause() {
12+
System.out.println("Press the button to pause!");
13+
}
14+
15+
@Override
16+
public void stop() {
17+
System.out.println("Press the button to stop!");
18+
}
19+
20+
@Override
21+
public void download() {
22+
System.out.println("The system is dowloading file");
23+
}
24+
25+
@Override
26+
public void getFileSize() {
27+
System.out.println("Capacity of file");
28+
}
29+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package Exercises.Interface.BaiTap8_1;
2+
3+
public abstract class Book {
4+
protected String title;
5+
protected String author;
6+
protected String isbn;
7+
protected boolean available;
8+
9+
public Book(String title, String author, String isbn, boolean available) {
10+
this.title = title;
11+
this.author = author;
12+
this.isbn = isbn;
13+
this.available = available;
14+
}
15+
16+
public abstract void getType();
17+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package Exercises.Interface.BaiTap8_1;
2+
3+
import java.util.ArrayList;
4+
5+
public class Library {
6+
ArrayList<Book> books = new ArrayList<>();
7+
8+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package Exercises.Interface.BaiTap8_1;
2+
3+
public class Novel extends Book {
4+
public Novel(String title, String author, String isbn, boolean available) {
5+
super(title, author, isbn, available);
6+
}
7+
8+
@Override
9+
public void getType() {
10+
System.out.println("Type: Novel");
11+
}
12+
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package Exercises.Interface.BaiTap8_1;
2+
3+
public class TextBook extends Book {
4+
public TextBook(String title, String author, String isbn, boolean available) {
5+
super(title, author, isbn, available);
6+
}
7+
8+
@Override
9+
public void getType() {
10+
System.out.println("Type: Textbook");
11+
}
12+
13+
}

JavaOOP/Exercises/Interface/Video.java

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)