Write a multithreaded
For example, suppose your program is passed the integers:
12 75 30 91 49 52 76
The program will report :
The average value is 55
The maximum value is 91
The minimum value is 12
The variables representing the average, maximum, and minimum values will be stored globally. The worker threads will set these values, and the parent thread will output the values once the workers have exited.
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 3 images
- in python create a function that raises a keyerror if the key is duplicatedarrow_forwardUnix-based operating systems usually include a tool named tail. It displays the last 10 lines of a file whose name is provided as a command line argument. Write a Java program that provides the same behavior i.e. the user can specify how many lines to print from the terminal. Display an appropriate error message if the file requested by the user does not exist, or if the command line argument is omitted. Note: Make sure to display the last n lines of a file whose name is provided as a command line argument. You might need to pass a file as an argument, therefore make sure to have access to a sample file, the contents of which you want to print out.arrow_forwardcan you please double-check this code? thank you!arrow_forward
- Create a python program that will create a tkinter GUI that will provide the user the means to select an integer 1-60 and display the resulting value. The value displayed will be the from a thread/process that will calcuate the nth prime (where the first prime number is 2) and then returning the result to the gui. The 52nd prime is 239, while prime 60 is 281, which is why it has to select values of n from 1 to 60.arrow_forwardWrite a Java program TestComputer, which creates three Computer objects with the informationbelow:a) - Manufacturer: Dell- Disk Size: 1189160321024 bytes- Manufacturing Date: April 1, 2020- Number of cores: 2b) - Manufacturer: Apple Inc- Disk Size: 269283712040 bytes- Manufacturing Date: March 31, 2020- Number of cores: 4c) Create your own Object. You can mimic your actual personal computer or use a no-argsconstructor.arrow_forwardWrite a python program that creates a dictionary whose values are lists of anagrams of words read from a file. using: def norm(s): def AnagramDicionary(f): def printWordList(L): def main():arrow_forward
- In Java Suppose you are given a text file that contains the names of people. Every name inthe file consists of a first name and a last name. Unfortunately, the programmer thatcreated the file of names had a strange sense of humor and did not guarantee thateach name was on a single line of the file. Write a program that reads this file ofnames and writes them to the console, one name per line.For example, if the input file (Names.txt) contains:Bob Jones FredCharles EdMarstonJeffWilliamsThe output should be:Bob JonesFred CharlesEd MarstonJeff Williams Sample Output:Enter the name of the input file:Names.txtBob JonesFred CharlesEd MarstonJeff WilliamsFile processing completed.arrow_forwardJava, the user selects an item from the text files ranging 1-15, repeats the loop until 'q'. the program provides a list of what they ordered including discounts, then calculates the total bill and how much they saved. The bottom is my the code I'm working on class BillProcessor {public static void prepareBill(LinkedHashMap<String, Integer> purchases, LinkedHashMap<String,Double>items,LinkedHashMap<String,String> sales, ArrayList<String> itemNames){double totalCost, totalDiscount, actualCost, discount; //note actualCost is the price of a single itemtotalCost = 0.00;totalDiscount = 0.00;actualCost = 0.00;discount = 0.00;for(Map.Entry<String,Integer>set: purchases.entrySet()) {if (sales.get(set.getKey()) != null) {if (sales.get(set.getKey()).equals("bogo") == true) {actualCost = set.getValue() * items.get(set.getKey());totalCost += actualCost;System.out.println("Item Name : " + set.getKey() + "\tItem Quantity(bogo) : " + (set.getValue() * 2 + "\tItem Cost :…arrow_forwardWrite a python program that prompts the user for their favorite basketball team. It should be able to read the list of teams provided below in a file called favorite_teams.txt and check if their team is in that file. Teams in the file:JazzBullsMavericksSpursIf the team is in the file let the user know that their team is in the list of favorites. If the team is not in the file, add the team to the end of the file. Also, let the user know that their team will be added to the file.Sample Run in File:What is your favorite NBA team? Jazz [Enter]Your team Jazz is in the listFile before and after run: JazzBullsMavericksSpurs Sample Run not in File:What is your favorite NBA team? Pelicans [Enter]Your team Pelicans is not in the list. It will be added.File before run: JazzBullsMavericksSpursFile after run:JazzBullsMavericksSpursPelicansarrow_forward
- Write a Java program that reads from a URL and searches for a given word in the URL and creates a statistic file as an output. The statistic file needs to include some information from the URL. URL address Number of words in the URL page Number of repetitions for a given word displays the number of times the word appears. You need to have two functions, one for reading from the URL and the other function for searching the word.arrow_forwardWrite a java program that will generate a permuterm index from the terms in the files in an input directory. The program should prompt the user for a single directory and find all of the terms (after processing) in each file in it. The program should then find the permutations of each term and store them (keeping track of the original word each permutation comes from). After all of the text files in the directory have been read, the output of the program should display the permutations in sorted order along with the original term. Use the dollar sign as the end of term symbol.arrow_forwardUsing python in jupyterlabarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education