Cs508 Assignment 3 Solution Spring 2020

0
156
cs508 assignment 3 solution

Cs508 Assignment 3 Solution Spring 2020

Click On Any Ad and Get Solution

Download Now

 

Total Marks: 20

 

Due Date: July 27, 2020

Instructions

Please read the following instructions carefully before solving & submitting an assignment:

  1. It should be clear that your assignment will not get any credit if:
  2.  The assignment is submitted after the due date.
  3.  The submitted assignment does not open or file is corrupt.
  4. The assignment is completely or partially copied from (other student or ditto copied from handouts or the internet).
  5. Student ID is not mentioned in the assignment File or name of the file is other than student ID.
  6.   The assignment is not submit in .rar format.

 

Cs508 Assignment 3 Solution Spring 2020

Click On Any Ad and Get Solution

Download Now

Submission details

The following files must be submit in a single zip or rar file.

·         Code files(.java files)

·         A .gif file which shows working of your application (For Recording .gif a software named Screentogif is uploaded on LMS, or you can use any other gif recording tool as well)

Please note if you submit a doc or txt file you will be awarded 0 marks. Make sure to write your own VU ID in the assignment file(s) otherwise assignment will not be accepted.

If you do not submit any of the above-mentioned files 50% marks per file will be deducted.

Objective

The objective of this assignment is to give students an idea of how to implement Multithreading with Synchronization concepts in JAVA.

 

Lectures Covered: This assignment covers Lecture # 27-30

 

Problem Statement:

You are require to create a multithread console application in java having 4 classes which will calculate factorial of last 4 digits of your student id. These classes would be as follow:

1.      Main class

2.      Factorial Class having one method which will calculate factorial named print factorial().

3.      Thread1class which extends from Thread Class

4.      Thread2classwhich also extends from Thread Class

Working:

Store the last four digits of your student ID in two separate classes. For example, if your ID is bc123456789then store 67 in first Thread1 Class and 89 in Thread2 Class that will be pass to Factorial class later.

Thread1 class will pass 67 to the Factorial class and print factorial() will print factorial of all the numbers from 1 to 67.

Thread2 class will pass 89to the Factorial class and print factorial() will print factorial of all the numbers from 1 to 89.

You should use thread.sleep(10) after each calculation inside the loop.

As you know that you cannot store and print factorial of large numbers in simple integer or long type variables, so you are required to use BigInteger to store and print very long numbers.

the print factorial() method must be synchronize so that the results of Thread1 are print first then the result of Thread2 is calculate and print.

Note: Proper exception handling code must be written where required.

 

Cs508 Assignment 3 Solution Spring 2020

Click On Any Ad and Get Solution

Download Now