Skip to content

Commit 4becad3

Browse files
committed
init 30
1 parent cce93b0 commit 4becad3

File tree

6 files changed

+134
-0
lines changed

6 files changed

+134
-0
lines changed

NguyenTuanKiet_30/.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
target/
2+
!.mvn/wrapper/maven-wrapper.jar
3+
!**/src/main/**/target/
4+
!**/src/test/**/target/
5+
6+
### IntelliJ IDEA ###
7+
.idea/modules.xml
8+
.idea/jarRepositories.xml
9+
.idea/compiler.xml
10+
.idea/libraries/
11+
*.iws
12+
*.iml
13+
*.ipr
14+
15+
### Eclipse ###
16+
.apt_generated
17+
.classpath
18+
.factorypath
19+
.project
20+
.settings
21+
.springBeans
22+
.sts4-cache
23+
24+
### NetBeans ###
25+
/nbproject/private/
26+
/nbbuild/
27+
/dist/
28+
/nbdist/
29+
/.nb-gradle/
30+
build/
31+
!**/src/main/**/build/
32+
!**/src/test/**/build/
33+
34+
### VS Code ###
35+
.vscode/
36+
37+
### Mac OS ###
38+
.DS_Store

NguyenTuanKiet_30/pom.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>NguyenTuanKiet_30</groupId>
8+
<artifactId>NguyenTuanKiet_30</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<properties>
12+
<maven.compiler.source>21</maven.compiler.source>
13+
<maven.compiler.target>21</maven.compiler.target>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
</properties>
16+
17+
</project>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package NguyenTuanKiet_30;
2+
3+
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
4+
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
5+
public class Main {
6+
public static void main(String[] args) {
7+
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
8+
// to see how IntelliJ IDEA suggests fixing it.
9+
System.out.printf("Hello and welcome!");
10+
11+
for (int i = 1; i <= 5; i++) {
12+
//TIP Press <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
13+
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
14+
System.out.println("i = " + i);
15+
}
16+
}
17+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package NguyenTuanKiet_30;
2+
3+
public interface NhanVien {
4+
void Nhap();
5+
void Xuat();
6+
double tinhLuong();
7+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package NguyenTuanKiet_30;
2+
3+
public interface NhanVienMoi extends NhanVien {
4+
double LUONG_CO_BAN = 1000.0;
5+
@Override
6+
double tinhLuong();
7+
}
8+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package NguyenTuanKiet_30;
2+
3+
import java.util.Scanner;
4+
5+
public class NhanVienSanXuat implements NhanVienMoi {
6+
private String ten;
7+
private double heSoLuong;
8+
9+
public void setTen(String ten){
10+
this.ten = ten;
11+
}
12+
public String getTen(){
13+
return ten;
14+
}
15+
public void setHeSoLuong(double heSoLuong){
16+
this.heSoLuong = heSoLuong;
17+
}
18+
public double getHeSoLuong() {
19+
return heSoLuong;
20+
}
21+
public NhanVienSanXuat() {
22+
23+
}
24+
@Override
25+
public void Nhap() {
26+
Scanner scanner = new Scanner(System.in);
27+
System.out.println("Nhập tên nhân viên: ");
28+
setTen(scanner.nextLine());
29+
System.out.println("Nhập hệ số lương: ");
30+
setHeSoLuong(scanner.nextDouble());
31+
}
32+
@Override
33+
public void Xuat() {
34+
System.out.println("Tên nhân viên: " + getTen());
35+
System.out.println("Hệ số lương: " + getHeSoLuong());
36+
System.out.println("Lương: " + tinhLuong());
37+
}
38+
@Override
39+
public double tinhLuong() {
40+
return getHeSoLuong() * LUONG_CO_BAN;
41+
}
42+
public static void main(String[] args) {
43+
NhanVienSanXuat nhanVien = new NhanVienSanXuat();
44+
nhanVien.Nhap();
45+
nhanVien.Xuat();
46+
}
47+
}

0 commit comments

Comments
 (0)