-
Notifications
You must be signed in to change notification settings - Fork 0
/
Manage
29 lines (26 loc) · 786 Bytes
/
Manage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package hongbaoyouxi;
import java.util.ArrayList;
public class Manage extends User {
public Manage(String name, int money) {
super(name, money);
}
public Manage() {
}
public ArrayList<Integer> send(int sendmoney ,int count){
int totalmoney = super.getMoney();
ArrayList<Integer> list =new ArrayList<>();
if(sendmoney>totalmoney){
System.out.println("余额不足");
return list;
}
int leftmoney = totalmoney-sendmoney;
super.setMoney(leftmoney);
int avg = sendmoney/count;
int left = sendmoney%count;
for (int i = 0; i < count-1; i++) {
list.add(avg);
}
list.add(avg+left);
return list;
}
}