Question

Complete a multithreaded application that solves a problem of your choice, e.g., Sudoku solution validator (Chapter...

Complete a multithreaded application that solves a problem of your choice, e.g., Sudoku solution validator (Chapter 4, Project 1), multithreaded sorting application (Chapter 4, Project 2), matrix multiplication, factorial solver, etc. While I recommend using C, you may use Java or any other language if you choose. Turn in both your source code and a readme explaining what problem your program solves and how to use it.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

import java.lang.*;
import java.io.*;
class multiplication extends Thread
{
static int m1[][];
static int m2[][];
static int out[][];
static int n=2;
int row;
multiplication(int i)
{
row=i;
this.start();
}
public void run()
{
int i,j;
for(i=0;i<n;i++)
{
out[row][i]=0;
for(j=0;j<n;j++)
out[row][i]=out[row][i]+m1[row][j]*m2[j][i];
}
}
public static void main(String args[])
{
int i,j;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter the order of Matrix : ");
try
{
n=Integer.parseInt(br.readLine());
}catch(Exception e){}
m1=new int[n][n];
m2=new int[n][n];
out=new int[n][n];
System.out.println("Enter the First Matrix : ");
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
try
{
m1[i][j]=Integer.parseInt(br.readLine());
}catch(Exception e){}
}
}
System.out.println("Enter the Second Matrix : ");
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
try
{
m2[i][j]=Integer.parseInt(br.readLine());
}catch(Exception e){}
}
}
multiplication mat[]=new multiplication[n];
for(i=0;i<n;i++)
mat[i]=new multiplication(i);
try
{
for(i=0;i<n;i++)
mat[i].join();
}catch(Exception e){}
System.out.println("OUTPUT :");
for(i=0;i<n;i++)
for(j=0;j<n;j++)
System.out.println(out[i][j]);
}
}

Add a comment
Know the answer?
Add Answer to:
Complete a multithreaded application that solves a problem of your choice, e.g., Sudoku solution validator (Chapter...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C language Credit for work. Please design a multithreaded application in C with Pthreads - it...

    C language Credit for work. Please design a multithreaded application in C with Pthreads - it determines whether the solution to a Sudoku puzzle is valid. Validate two puzzles In your program, please hard-code the following two 9x9 grids (say in two variables puzzle1 and puzzle2), and determine if each solution is valid. While each grid should be validated by multiple parallel threads, you can validate puzzle1 and then puzzle2 in sequential order (as illustrated) by a single invocation of...

  • Do the following project: Following is the file to be programmed in Linux kernel. Run this...

    Do the following project: Following is the file to be programmed in Linux kernel. Run this program. Include the screenshot of the results. Multi threaded Sorting Application Write a multithreaded sorting program that works as follows: A list of integers is divided into two smaller lists of equal size. Two separate threads (which we will term sorting threads) sort each sub list using a sorting algorithm of your choice. The two sub lists are then merged by a third thread—a...

  • JAVA 1336 Problem: Complete Programming Project 1 (pg. 339, Savitch). The defined class will be HotDogStand.java...

    JAVA 1336 Problem: Complete Programming Project 1 (pg. 339, Savitch). The defined class will be HotDogStand.java and will also contain: • A default constructor • An overloaded constructors Getters and Setters A 'copy' constructor, -3 A 'toString' method, An 'equals' method, A finalize' method, Remember to THOROUGHLY test the application in a separate test file, HotDogStandTest.java. Requirements: You will submit the following with this lab (face-to-face sections). Online sections will turn their labs in through Blackboard as usual: a. The...

  • The purpose of the project is to perform a timing experiment. You are required to complete...

    The purpose of the project is to perform a timing experiment. You are required to complete the following activities: Write a computer program that prompts the user for a number, creates an array for that number of random integers, and then usees the bubble sort to order the array. The program should print out the array prior to the call to the sorting algorithm and afterwards. You can write the program in either Java, C++, C#, or whatever language you...

  • Problem 1 Write your code in the file MatrixOps.java. . Consider the following definitions from matrix...

    Problem 1 Write your code in the file MatrixOps.java. . Consider the following definitions from matrix algebra: A vector is a one-dimensional set of numbers, such as [42 9 20]. The dot product of two equal-length vectors A and B is computed by multiplying the first entry of A by the first entry of B, the second entry of A by the second entry of B, etc., and then summing these products. For example, the dot product of [42 9...

  • C programming is the main one and pick another code of choice!!! Background This assignment is...

    C programming is the main one and pick another code of choice!!! Background This assignment is based on one of the Big Ideas in this course, namely that reading C source code is a real aid in learning how to write C code. To that end, in this project, you write a program that scans C source from the 'Net and calculates some simple statistics. We're learning lots of concepts, and by running the program you write here on several...

  • In this exercise, you’ll modify the Future Value Calculator application to include a header and footer....

    In this exercise, you’ll modify the Future Value Calculator application to include a header and footer. Review the project Open the header.jsp file and note that it contains the code necessary for the start of an HTML page including the opening html, head, and body tags, the title for the web page, and a link including the CSS file. Open the footer.jsp file and note that includes a copyright notice and the closing body and html tags. Modify the code...

  • MAT 125 6.2 Worksheet - Part of Chapter 6 Project ame To find the optimal solution in an applicat...

    MAT 125 6.2 Worksheet - Part of Chapter 6 Project ame To find the optimal solution in an application with Calculus Step 1) Read and understand the problem o Write the information in a table or in a clearly labeled diagram o Assign variables to the unknown quantities in your table or diagram. o Be clear on what is known and what is to be found. Step 2) Combine the information into a function Write a primary equation that represents...

  • 1. Problem Description Language: JAVA The game of Poker Dice is a bit like standard poker...

    1. Problem Description Language: JAVA The game of Poker Dice is a bit like standard poker but played with dice instead of cards. In this game, five fair dice are rolled. We will recognize one of seven different hands, in order of increasing value: None alike: Five distinct die values occur. Example: 1, 3, 4, 5, 6 One Pair: Four distinct die values occur; one die value occurs twice and the other three die values occur once each. Example: 1,...

  • For this assignment your job is to create a two class application that examines the concept...

    For this assignment your job is to create a two class application that examines the concept of a numerical palindrome. A numerical palindrome is a non-negative whole number that is the same forwards and backwards, e.g. 2332, 12321, etc. Here's the catch: suppose you do the following. Start with any positive whole number. If it's a palindrome, you're done; if it isn't, reverse the number, add the reversal to the original value, and test this new result. It it's a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT