Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that creates three thread: one to print letter A ten times, seco

ID: 3647960 • Letter: W

Question

Write a program that creates three thread: one to print letter A ten times, second to print letter B five times, and the third one to print out integers from 1 t0 10. After creating the three threads, the main program should terminate. In your solution , adopt the following structure.


public class PrintChar implements Runnable

{

/** field(s)** /

/**constructor(s)**/

/**method(s)**/

}


public class PrintNum implements Runnable

{/** field(s)** /

/**constructor(s)**/

}


public class PrintDemo

{

public static void main(String[] args)

{ /**method's code **/ }

}


could someone help me fill in the /**...**/ . Thank you very much

Explanation / Answer

class PrintChar implements Runnable { /** field(s) **/ char printable; /** constructor(s)**/ public PrintChar(char c) { // TODO Auto-generated constructor stub } /**method(s)**/ @Override public void run() { // TODO write code } public char getPrintable() { return printable; } public void setPrintable(char printable) { this.printable = printable; } } class PrintNum implements Runnable { /** field(s) **/ /** constructor(s)**/ /**method(s)**/ @Override public void run() { // TODO write code } } public class PrintDemo { public static void main(String[] args) { /**method's code **/ new Thread(new PrintChar('A')).start(); //print A new Thread(new PrintChar('B')).start(); //print B new Thread(new PrintNum()).start(); //print 1..10 } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote