|
public double get(String name_of_massive
|
бет | 29/76 | Дата | 06.02.2022 | өлшемі | 0,67 Mb. | | #79506 | түрі | Лекция |
| public double get(String name_of_massive, - public double get(String name_of_massive,
- int row, int column){
- //получение элемента массива с координатами row и column
- try{
- MasSize m=new MasSize();
- m.setName(name_of_massive);
- m.setColumns(0);
- m.setRows(0);
- if(!tables.contains(m)){
- System.out.println("there is no such
- massive");
- return -1; }
-
String str=“select“ - String str=“select“
- +"w"+String.valueOf(column)+”from“
- +name_of_massive+
- "where NUMBER="+String.valueOf(row+1);
- Statement stmt2 = conn.createStatement();
- ResultSet rs = stmt2.executeQuery(str);
- rs.next();
- double d=rs.getDouble(1);
- rs.close();
- return d;}
- catch(Exception e){
- System.out.println("In function get");
- e.printStackTrace();
- return -1;}}
public int Ncolumns(String name_of_massive) { - public int Ncolumns(String name_of_massive) {
- //кол-во столбцов в массиве name_of_massive
- try{
- MasSize m=new MasSize();
- m.setName(name_of_massive);
- m.setColumns(0);
- m.setRows(0);
- if(!tables.contains(m)) {
- System.out.println("there is no such massive");
- return -1; }
- MasSize m1=(MasSize)
- tables.get(tables.indexOf(m));
- return m1.getColumns();}
- catch(Exception e){
- System.out.println("In function Ncolumns");
- e.printStackTrace();
- return -1;}}
Достарыңызбен бөлісу: |
|
|