(Solved) : Use Code Using System Using Systemthreading Public Class Hw81 Public Static Void Main Firs Q42680455 . . .

• Program 1 - Start by using one thread to print your first and and a second thread to print your last name. • Program 2 - Mo

Use code below:

using System;
using System.Threading;

public class HW8_1 {
public static void Main() {
First first;
Last last;
HW.println(“——HW8-1—–“);
first = new First();
last = new Last();
HW.println(“Start”);
(new Thread(new ThreadStart(last.run))).Start();
(new Thread(new ThreadStart(first.run))).Start();
HW.println(“Finish”);
Console.ReadKey();
}
}

class First {
public void run(){
// CHANGE THIS OUTPUT TO YOUR NAME
HW.print(“F”);
HW.print(“I”);
HW.print(“R”);
HW.print(“S”);
HW.println(“T”);
}
}

class Last {
public void run(){
// CHANGE THIS OUTPUT TO YOUR NAME
HW.print(“L”);
HW.print(“A”);
HW.print(“S”);
HW.println(“T”);
}
}

class HW {
public static void print(string s) {
Console.Write(s); Console.Out.Flush();
Thread.Sleep(10);
}
public static void println(string s) {
Console.Write(s+”rn”); Console.Out.Flush();
Thread.Sleep(10);
}
}

• Program 1 – Start by using one thread to print your first and and a second thread to print your last name. • Program 2 – Modify Program 1 to use arrays of 15 threads for first and last name. Rerun until the output looks something similar to: First Finish LFLFLFLFLFLFLFLFLaiaiaiaiaiaiaiaiasrsrsrsrsrsrsrsrst + in + un Hints: First first[] = new First[15]; Start each thread individually. Show transcribed image text • Program 1 – Start by using one thread to print your first and and a second thread to print your last name. • Program 2 – Modify Program 1 to use arrays of 15 threads for first and last name. Rerun until the output looks something similar to: First Finish LFLFLFLFLFLFLFLFLaiaiaiaiaiaiaiaiasrsrsrsrsrsrsrsrst + in + un Hints: First first[] = new First[15]; Start each thread individually.

Expert Answer


Answer to Use code below: using System; using System.Threading; public class HW8_1 { public static void Main() { First first; Last…

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us

× How can I help you?