modified: Java/Lab 2/Lab_2.java
This commit is contained in:
parent
8013099c36
commit
acc2d533cb
|
@ -43,22 +43,25 @@ public class Lab_2 {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
short a, rows = 0, columns = 0;
|
short a, rows = 0, columns = 0;
|
||||||
String format;
|
String format;
|
||||||
|
|
||||||
Scanner input = new Scanner(System.in);
|
Scanner input = new Scanner(System.in);
|
||||||
|
|
||||||
a = protectedInput("Input a constant to multipy a matrix by: ", "A constant must be a short-data type integer, try again.", input);
|
a = protectedInput("Input a constant to multipy a matrix by: ",
|
||||||
|
"A constant must be a short-data type integer, try again.", input);
|
||||||
|
|
||||||
System.out.println();
|
System.out.println();
|
||||||
System.out.println("Input size of the matrix.");
|
System.out.println("Input size of the matrix.");
|
||||||
|
|
||||||
do {
|
do {
|
||||||
rows = protectedInput("Rows: ", "A number of rows must be a short-data type integer, try again.", input);
|
rows = protectedInput("Rows: ",
|
||||||
|
"A number of rows must be a short-data type integer, try again.", input);
|
||||||
} while (rows <= 0);
|
} while (rows <= 0);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
columns = protectedInput("Columns: ", "A number of columns must be a short-data type integer, try again.", input);
|
columns = protectedInput("Columns: ",
|
||||||
|
"A number of columns must be a short-data type integer, try again.", input);
|
||||||
} while (columns <= 0);
|
} while (columns <= 0);
|
||||||
|
|
||||||
input.close();
|
input.close();
|
||||||
|
|
||||||
short[][] matrix_B = new short[rows][columns];
|
short[][] matrix_B = new short[rows][columns];
|
||||||
|
|
Loading…
Reference in New Issue