Advertisement
siedenburg

Untitled

Nov 11th, 2015
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.25 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class BenzinP {
  4.  
  5.     private int row = 4;
  6.     private int col = 4;
  7.     private int[][] matrix;
  8.  
  9.     public BenzinP(int trow, int tcol) {
  10.  
  11.         this.row = trow;
  12.         this.col = tcol;
  13.     }
  14.  
  15.     public BenzinP(int trow, int tcol, int[][] m) {
  16.  
  17.         this.row = trow;
  18.         this.col = tcol;
  19.         this.matrix = m;
  20.     }
  21.     public int[][] fill(){
  22.         int[][] data = new int[row][col];
  23.         Scanner in = new Scanner(System.in);
  24.         for(int row = 0; row< matrix.length; row++){
  25.               for(int col = 0 ;col< matrix.length; col++){
  26.                   System.out.println("Date");
  27.                   data[row][0] = in.nextInt();
  28.                   System.out.println("Price");
  29.                   data[row][1] = in.nextInt();
  30.                }
  31.               System.out.println();
  32.           }
  33.  
  34.        for(int row = 0; row< matrix.length; row++){
  35.        for(int col = 0 ;col< matrix[row].length; col++){
  36.              System.out.print(data[row][col]);
  37.     }
  38.       System.out.println();
  39.     }
  40.          return data;
  41.     }
  42.  
  43.  
  44.  
  45.     public static void main(String[] args){
  46.         int[][] ma = new int[3][2];
  47.         BenzinP q2 = new BenzinP(3, 2,ma);
  48.         q2.fill();
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement