1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Andrei [34K]
3 years ago
11

JAVA Programming.

Computers and Technology
1 answer:
jeka943 years ago
8 0

Answer:

// Java profram to perform Arithmetic operations on square matrices

// Comments are used for explanatory purpose

// Program starts here

import java.util.*;

import java.io;

public class Matrices {

// Multiply Method Here

static void multiply(int mat1[][],int mat2[][], int mulmat[][])

{

int i, j, k;

for (i = 0; i < N; i++)

{

for (j = 0; j < N; j++)

{

mulmat[i][j] = 0;

for (k = 0; k < N; k++)

mulmat[i][j] += mat1[i][k] * mat2[k][j];

}

}

System.out.println("Result matrix" + " is ");

for (i = 0; i < N; i++)

{

for (j = 0; j < N; j++)

System.out.print( mulmat[i][j] + " ");

System.out.println();

}

}

// Subtraction Method here

static void sub(int mat1[][],int mat2[][], int submat[][])

{

for(int i=0;i<N;i++){

for(int j=0;j<N;j++){

addmat[i][j]=mat1[i][j]-mat2[i][j]; //

System.out.print(submat[i][j]+" ");

}

}

// Addition Method here

static void add(int mat1[][],int mat2[][], int addmat[][])

{

for(int i=0;i<N;i++){

for(int j=0;j<N;j++){

addmat[i][j]=mat1[i][j]+mat2[i][j]; //

System.out.print(addmat[i][j]+" ");

}

}

// Main Method Starts here

public static void main (String [] args)

{

Scanner input = new Scanner (System.in);

// Declare type of square matrix

int N;

// input N

lbl: N = input.nextInt();

if(N>=2 && N<=6)

{

int mulmat[][] = new int[N][N] ;

int addmat[][] = new int[N][N] ;

int submat[][] = new int[N][N] ;

// Multiplication

mulmat(mat1, mat2, mulmat);

// Addition

addmat(mat1, mat2, addmat);

// Subtraction

submat(mat1, mat2,submat);

}

else

{

goto lbl;

}

}

You might be interested in
To create a multi-column and multi-row box for users to type into in an html form, use the ____________ tag pair
alexgriva [62]

To create a multi-column and multi-row box for users to type into in an html form, use the <textarea></textarea> tag pair.

<span>The html tags are the codes or the hidden keywords in the web browser to tell about its format and displayed content. The html tags mostly comes in pairs, pair consist of the start tag and end tag.</span>
4 0
3 years ago
Kelly is a college sophomore majoring in computer science. She is interested in gaining exposure to the most useful and current
Nonamiya [84]

Answer:

The correct answer for the given question is an option(b) i.e java.

Explanation:

Java is an object oriented programming language that is mostly used for the creating the websites.Java is most secure and reliable programming language than the other programming language.

C is a programming language but it is not object oriented programming language thats why this option is incorrect.

Visual basic is a Programming language it is also used to create a web page but it is not commonly used to create a web page  thats why this option is incorrect.

The scheme is not used to create a web page  thats why this option is also incorrect.

7 0
4 years ago
Create a TeeShirt class for Toby’s Tee Shirt Company. Fields include:
Ainat [17]

Answer:

Here is the TeeShirt class:

public class TeeShirt{  //class name

   private int orderNumber;  // private member variable of type int of class TeeShirt to store the order number

   private String size;  // to store the size of tshirt

   private String color;  //  to store the color of shirt

   private double price;  // to store the price of shirt

   public void setOrderNumber(int num){  //mutator method to set the order number

       orderNumber = num;     }    

   public void setColor(String color){  //mutator method to set the color

       this.color = color;        }      

       

     public void setSize(String sz){  //mutator method to set the shirt size

   size = sz;  

   if(size.equals("XXXL") || size.equals("XXL")){  //if shirt size is XXL or XXXL

       price = 22.99;  // set the price to 22.99 if shirt size is XXL or XXXL

   }else{  //for all other sizes of shirt

       price = 19.99;     }  }  //sets the price to 19.99 for other sizes

   public int getOrderNumber(){  //accessor method to get the order number stored in orderNumber field

       return orderNumber;     }  //returns the current orderNumber

   public String getSize(){  //accessor method to get the size stored in size field

       return size;     }  //returns the current size

   public String getColor(){  //accessor method to get the color stored in color field

       return color;     }  //returns the current color

   public double getPrice(){  //accessor method to get the price stored in price field

       return price;      }  } //returns the current price

Explanation:

Here is the sub class CustomTee:

public class CustomTee extends TeeShirt {  //class CustomTee that inherits from class TeeShirt

private String slogan;   //private member variable of type String of class CustomTee to store slogan

public void setSlogan(String slgn) {  //mutator method to set the slogan

slogan = slgn; }

public String getSlogan() {  //accessor method to get the slogan stored in slogan field

return slogan;}  } //returns the current slogan

Here is DemoTees.java

import java.util.*;

public class DemoTees{  //class name

public static void main(String[] args)  {  //start of main method

TeeShirt tee1 = new TeeShirt();  //creates object of class TeeShirt named tee1

TeeShirt tee2 = new TeeShirt(); //creates object of class TeeShirt named tee2

CustomTee tee3 = new CustomTee(); //creates object of class CustomTee named tee3

CustomTee tee4 = new CustomTee();  //creates object of class CustomTee named tee4

tee1.setOrderNumber(100);  //calls setOrderNumber method of class TeeShirt using object tee1 to set orderNumber to 100

tee1.setSize("XXL");  //calls setSize method of class TeeShirt using object tee1 to set size to XXL

tee1.setColor("blue");  //calls setColor method of class TeeShirt using object tee1 to set color to blue

tee2.setOrderNumber(101);  //calls setOrderNumber method of class TeeShirt using object tee2 to set orderNumber to 101

tee2.setSize("S");  //calls setSize method of class TeeShirt using object tee2 to set size to S

tee2.setColor("gray");  //calls setColor method of class TeeShirt using object tee2 to set color to gray

tee3.setOrderNumber(102);   //calls setOrderNumber method of class TeeShirt using object tee3 of class CustomTee to set orderNumber to 102

tee3.setSize("L");  //calls setSize method of class TeeShirt using object tee3 to set size to L

tee3.setColor("red");  //calls setColor method of class TeeShirt using object tee3 to set color to red

tee3.setSlogan("Born to have fun");  //calls setSlogan method of class CustomTee using tee3 object to set the slogan to Born to have fun

tee4.setOrderNumber(104);  //calls setOrderNumber method of class TeeShirt using object tee4 of class CustomTee to set orderNumber to 104

tee4.setSize("XXXL");  //calls setSize method to set size to XXXL

tee4.setColor("black");  //calls setColor method to set color to black

tee4.setSlogan("Wilson for Mayor");  //calls setSlogan method to set the slogan to Wilson for Mayor

display(tee1);  //calls this method passing object tee1

display(tee2);  //calls this method passing object tee2

displayCustomData(tee3);  //calls this method passing object tee3

displayCustomData(tee4);  }   //calls this method passing object tee4

public static void display(TeeShirt tee) {  //method display that takes object of TeeShirt as parameter

System.out.println("Order #" + tee.getOrderNumber());  //displays the value of orderNumber by calling getOrderNumber method using object tee

System.out.println(" Description: " + tee.getSize() +  " " + tee.getColor());  //displays the values of size and color by calling methods getSize and getColor using object tee

System.out.println(" Price: $" + tee.getPrice()); }  //displays the value of price by calling getPrice method using object tee

public static void displayCustomData(CustomTee tee) {  //method displayCustomData that takes object of CustomTee as parameter

display(tee);  //displays the orderNumber size color and price by calling display method and passing object tee to it

System.out.println(" Slogan: " + tee.getSlogan());  } } //displays the value of slogan by calling getSlogan method using object tee

5 0
3 years ago
Pharming involves: setting up fake Wi-Fi access points that look as if they are legitimate public networks. redirecting users to
sweet-ann [11.9K]

Answer:

Explanation:

Pharming involves redirecting users to a fraudulent website even when the user has typed in the correct address in the web browser. An individual can accomplish this by changing the hosts file of the web address that the user is trying to access or by exploiting a DNS server error. Both of which will allow the individual to convince the victim that they are accessing the website that they were trying to access, but instead they have been redirected to a website that looks identical but is owned by the individual. The victim then enters their valuable and private information into the website and the individual can see it all and use it as they wish. Usually, this is done to steal banking information.

7 0
3 years ago
In an image citation, what piece of information is listed first?
kondaur [170]
In a image citation the piece of information listed first is "last name"
can you give us multiple choice?
7 0
3 years ago
Other questions:
  • K. What are the types of page orientation?​
    7·1 answer
  • What kinds of online behaviors could be considered cyberbullying?
    7·2 answers
  • Which heat transfer can be described as currents of warm air rising and cool air falling
    12·1 answer
  • How does a MIPS Assembly procedure return to the caller? (you only need to write a single .text instruction).
    12·1 answer
  • Use the drop-down menus to complete the statements about changing mail options in Outlook.
    10·1 answer
  • A developer designed a process in UiPath Studio that is best-suited for a simple and linear process. Which Studio workflow type
    7·1 answer
  • _____moves the head to proper track
    13·2 answers
  • What is computer hadware​
    7·1 answer
  • Jazmine just finished setting up an operating system that's designed to work between a VM guest OS and computer hardware. What i
    8·1 answer
  • You want to set the sticky bit on an existing directory, subdir, without otherwise altering its permissions. to do so, you shoul
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!