Example of Tutorial - zhamri/MyClass-STIW3054 GitHub Wiki

T001

INSTRUCTION:

  1. Create a new directory/folder called 'STIW3054' on your Desktop.

  2. Copy a test_file (HelloWorld.java) and paste it inside the STIW3054 folder.

  3. Then write a java program using Netbeans IDE to compile and run HelloWorld.java

T002

Modify TestSleep2.java to display the output as below: (You are not allowed to add extra threads)

ONE
TWO
THREE
xxxxxxxxxx
ONE
TWO
THREE
xxxxxxxxxx
ONE
TWO
THREE
xxxxxxxxxx

T003

TestAtomicInteger1p.java failed to produce the correct result. Modify TestAtomicInteger1p.java to display "Count=10".

T004

Write a program to compare execution times between normal thread and synchronized thread. The results should be displayed in 'second'.

Example of output:

Normal thread = 0.00000012 seconds
Synchronized thread = 0.00000025 seconds

T005

Write a program to find a maximum number in a list of 1,000,000 random numbers using sequential program and concurrent program. Then compare the execution times for both approaches. The results should be displayed in 'second'.

Example of output:

Sequential Program = 11.000012 seconds
Concurrent Program = 5.000025 seconds

T006

Write a Java program to find MIN, MOD and MEDIAN in a list of 1,000,000 random numbers using THREE (3) threads (excluding the main thread).

Example of output:

MIN = xxxxxx
MOD = xxxxxx
MEDIAN = xxxxxx

T007

Write a Java program to generate 1,000 random numbers between 500 and 3,000. These random numbers will represent the waiting times of each execution in TWO (2) threads. If the total values of Thread-1 greater than the total values of Thread-2, the following number will be incremented by Thread-2. Finally, count the total numbers executed by each thread.

Example of output:

Thread-1 = 452
Thread-2 = 548
Total = 1000

T008

Write a Java program to generate 1,000,000 random numbers between 0 and 100. Every random number will be displayed in a chart every 0.5 seconds. The example of the output is shown below:

stiw3054-example

T009

Below is the example of pom.xml.

pom

Write a Java program to insert the dependency codes into the pom.xml file. The example of dependency codes is shown below.

dependency

T010

Write a Java program to search and count 'class' files (example: Xyz.class) in a specific directory/folder. Then display all the class files. Please consider the sub-directories as well.

T011

Write a Java program to search and count repositories in "https://github.com/zhamri". Then display all the repositories.

T012

Write a Java program to search and count contents in "https://github.com/zhamri/STIW3054-RT-Programming" repository. Then display all the contents.

T013

Write a Java program to search and count issues in "https://github.com/zhamri". Then display all the issues.

T014

Write a Java program to search and count all contributors in "https://github.com/zhamri" issues. Then display the list of contributors (using github id) and the number of contributions for each contributor.

Example of output:

  1. syeel (10)
  2. wzul (10)
  3. zaemie (9)
  4. Jiayin328 (7)
  5. ......
  6. ......

T015

Search how to stop or terminate thread. Then submit a pull request to Branch: Exercise08 in https://github.com/zhamri/STIW3054-RT-Programming.

T016

Below is the example of pom.xml.

pom

Write a Java program using thread to insert the plugin codes into the pom.xml file. If the codes already exist, the thread will be terminated immediately. The example of plugin codes is shown below.

plugin

T017

Write a Java program to search and count all team members' contributions in "https://github.com/STIW3054" repositories. Then display the list of team members (using github id) in each team and the number of contributions for each team member. Finally display the execution time in seconds (Hints: use java.util.concurrent.TimeUnit).

Example of output:

Team-1
syeel (10)
chinonn (8)

Team-2
MarJr (11)
NurSyammila (7)
......
......

Execution Time: 57.34 seconds

T018

Rewrite your program in TimeUnit #1 by implementing Thread Executer. The number of thread is depending on the number of teams in STIW3054.

T019

You are required to develop a simple program using TWO (2) threads to simulate Deadlock.

T020

Modify program in Issue #3, to solve the deadlock issue by allowing user to key-in “STIW3054” code for stopping the thread. (Hints: Must use volatile keyword).

T021

Write a Java program to calculate the number of days and the number of minutes between 1st Issue and today's issue. (Hints: use java.util.Calendar & java.util.concurrent.TimeUnit)
Example of the output:

Days = 60
Minutes = 86400

T022

You are requitred to explore and provide:

  1. Example related to Java ThreadGroup.
  2. The result
  3. References