Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class BenzinP {
- private int row = 4;
- private int col = 4;
- private int[][] matrix;
- public BenzinP(int trow, int tcol) {
- this.row = trow;
- this.col = tcol;
- }
- public BenzinP(int trow, int tcol, int[][] m) {
- this.row = trow;
- this.col = tcol;
- this.matrix = m;
- }
- public int[][] fill(){
- int[][] data = new int[row][col];
- Scanner in = new Scanner(System.in);
- for(int row = 0; row< matrix.length; row++){
- for(int col = 0 ;col< matrix.length; col++){
- System.out.println("Date");
- data[row][0] = in.nextInt();
- System.out.println("Price");
- data[row][1] = in.nextInt();
- }
- System.out.println();
- }
- for(int row = 0; row< matrix.length; row++){
- for(int col = 0 ;col< matrix[row].length; col++){
- System.out.print(data[row][col]);
- }
- System.out.println();
- }
- return data;
- }
- public static void main(String[] args){
- int[][] ma = new int[3][2];
- BenzinP q2 = new BenzinP(3, 2,ma);
- q2.fill();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement