else if(text.startsWith("/add")){
for (Customer customer : Database.customerList) {
SendMessage msg = new SendMessage();
msg.setText(message.getText());
msg.setParseMode("Markdown");
msg.setChatId(String.valueOf(customer.getId()));
ComponentContainer.MY_TELEGRAM_BOT.sendMsg(sendMessage);
}
}
import java.util.ArrayList;
import java.util.List;
import static java.lang.Math.sqrt;
public class AreaTriangle {
private final List<Integer> numbers = new ArrayList<>();
public AreaTriangle(int a, int b, int c) {
numbers.add(a);
numbers.add(b);
numbers.add(c);
}
public int areaOfATriangle() {
int a = numbers.get(0);
int b = numbers.get(1);
int c = numbers.get(2);
double p = (a + b + c) * 1 / 2;
int s = (int) sqrt(p * (p - a) * (p - b) * (p - c));
return s;
}
public int getA() {
return numbers.get(0);
}
public int getB() {
return numbers.get(1);
}
public int getC() {
return numbers.get(2);
}
}
import static java.lang.Math.sqrt;
public class AreaTriangle {
private int a;
private int b;
private int c;
public AreaTriangle(int a, int b, int c) {
this.a = a;
this.b = b;
this.c = c;
}
public int areaOfATriangle() {
double p = (a + b + c) * 1 / 2;
int s = (int) sqrt(p * (p - a) * (p - b) * (p - c));
return s;
}
public int getA() {
return a;
}
public int getB() {
return b;
}
public int getC() {
return c;
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter a: ");
a = sc.nextInt();
System.out.print("Enter b: ");
b = sc.nextInt();
System.out.print("Enter c: ");
c = sc.nextInt();
AreaTriangle areaTriangle = new AreaTriangle(a, b, c);
System.out.println(" s = " + areaTriangle.areaOfATriangle());
}
public void positiveTriangleCheckTest() {
AreaTriangle areaTriangle = new AreaTriangle(1, 2, 3);
int a = areaTriangle.getA();
int b = areaTriangle.getB();
int c = areaTriangle.getC();
if (a + b > c & a + c > b & b + c > a)
System.out.println("Треугольник существует");
else
System.out.println("Треугольник не существует");
}