8.13 ** (The Location class)
来源:互联网 发布:琵琶 知乎 编辑:程序博客网 时间:2024/06/06 03:37
问题及代码:Main.javapackage first; import java.util.Scanner; public class Main { public static void main(String[] args) { int row, column ; System.out .print("Enter the number of tows anf columns of the array: "); Scanner cin = new Scanner(System.in); row = cin.nextInt(); column = cin.nextInt(); System.out.println("Enter the array: "); double [][]array = new double[row][column]; for(int i=0;i<row;++i) { for(int j=0;j<column;++j) { array[i][j]=cin.nextDouble(); } } Location a=new Location(row,column,array); Point x=new Point(); x=a.getmaxPoint(); System.out.println("The location of the largest element is "+(int)a.max +" at ("+(int)x.getx()+","+(int)x.gety()+")"); } }Location.javapackage first; public class Location { public int row, column; double [][]array; double max; Point maxPoint=new Point(); Location (int a,int b,double a1[][]) { row=a; column=b; array=a1; } Point getmaxPoint() { max=array[0][0]; for(int i=0;i<row;++i) { for(int j=0;j<column;++j) { if(array[i][j]>max) { max=array[i][j]; maxPoint.setPoint(i,j); } } } return maxPoint; } }Point.javapackage first;public class Point {double a,b;Point(){a=0;b=0;}Point(double x,double y){a=x;b=y;}void setPoint(double x,double y){a=x;b=y;}double getx(){return a;}double gety(){return b;}}运行结果:
2 0
- 8.13 ** (The Location class)
- driver class jar location
- The Location API @ JDJ
- Using the Location Manager
- Obtaining the Current Location
- Displaying the Location Address
- R连接hbase错误(Can't get the location)
- Getting the Last Known Location
- BIRT2.2 Event handler class location
- HDU6015 Skip the Class (Map)
- HDU 6015 Skip the Class (枚举)
- HDU:6015 Skip the Class(map)
- Rockie's Android Porting Guide(5)——Change your location and add the screenlock
- ICE Manual(Documentation for Ice 3.5)---The Ice Run Time in Detail(Location Transparency)
- Description Resource Path Location Type Java compiler level does not match the version of(图解)
- ILMerge(Dll合并工具)遇到Could not load assembly from the location...错误
- Description Resource Path Location Type Java compiler level does not match the version of(图解)
- Description Resource Path Location Type Java compiler level does not match the version of(图解)
- Java的集合容器(下)
- cookie 和session 的区别详解
- 洛谷P1541/CODEVS1068 乌龟棋
- Codeforces Round #327 (Div. 2) A. Wizards' Duel(水)
- 约瑟夫
- 8.13 ** (The Location class)
- 动态生成矩阵选择器,选择面板
- iOS之触摸事件和手势
- 调试那些事儿
- 移植BOA到mini2440
- socket网络编程复习笔记(四):认识套接字函数
- 025 Reverse Nodes in k-Group [Leetcode]
- Android 生成图标的有力工具 Android Asset Studio
- Codeforces Round #327 (Div. 2) B. Rebranding (字符串)