Write the following two programs: Extend a multi-threading Java program to accept a number from the user at any moment. The program should also display the total of entered numbers so far every 2
Q: 2. Given a Python program, add comments to the code. strL = ["A","B","C","D","E","F"] for str in st...
A: Above given is the python code. We have to add comments to the code.
Q: using python In a jupyter notebook, implement a recursive function anagrams() that computes anagram...
A: The answer is given below:-
Q: b) When does the best case and worst-case complexity occurs in Quick sort? Explain it with the help ...
A: Quick sort is the fastest way of sorting elements in the list. Here in this sorting algorithm, one e...
Q: What is a disk?
A: the answer is given below:-
Q: Use the Bisection Method to find the first root of f(x) = -12 – 21x + 18x² – 2.75a. In doing so, use...
A: Following is the Matlab code for the given problem: %clear the command window clc; clear all; %give...
Q: What language does the CPU speak?
A: the answer is given below:-
Q: Part B. Arrange the following growth functions from the smallest running time to the biggest. 6. 4n ...
A: Arranged the given growth functions from the smallest to biggest running time
Q: Q)write and apply porngme inc+t) to convert Srom centigrate to fahrenleite where %3D
A: We have given the formula to calculate the Fahrenheit value from the user entered centigrade value. ...
Q: Complete the following program so that it prints the odd numbers from 3 through 501 inclusive. for i...
A: Ans: Code: for i in range(3, 501+1, 2): print(i)
Q: Implement an immutable class MyBigInteger using String Provide methods toString, add and subtract, m...
A: Below i have answered:
Q: 7128 LAB Variables/Assignments: Using math functions GIven three floating-point numbers xy and z out...
A: Step 1: start input three floating number calculate x to power y calculate x to the power of (y t...
Q: Write an x86 assembly program to count the odd numbers up to a NUMBER? Assume NUMBER variable holds ...
A: Here we write simple assembly code to count 5 odd number: ==========================================...
Q: Consider the following Python program (note that Python uses indentation to specify scope): 010 x = ...
A: Indentation is mandatory in python to define the blocks of statements
Q: Explain the different tools and techniques for charter development.
A: What is Charter development? Develop Project Charter is the process of developing a document that fo...
Q: I have the code bellow. Now I'm ask to display the number of elements in the arrays read from files...
A: #include <iostream>#include <fstream>using namespace std; class Multiplicity { //Class p...
Q: So, what's the difference between a thumb drive and a USB drive, exactly?
A: INTRODUCTION: A thumb drive is a compact solid-state drive that plugs into a USB port on a computer...
Q: Write a C Program to demonstrate pointers to functions in a menu-driven program. The program should ...
A: The code for following problem is given below.
Q: Create a Use Case Al systems to provide systems information about subjects, courses , professors, cl...
A: Answer: Introduction Use-case charts portray the significant level capacities and extent of a framew...
Q: I am having trouble having this code run correctly. I need some assistance as I am now lost. main.c...
A: Here is the explanation:
Q: Consider the following code fragment: After this code is executed, the array array2 contains what va...
A: A. {4, 3, 0, 0 }
Q: It's important to know what system image recovery is.
A: System image recovery is a way to back up and restore the Windows operating system and your data wit...
Q: 2. Write down the PEAS description for the following problems: i. Traffic light agent (2 marks) ii. ...
A: "PEAS stands for “Performance Environment Actuator Sensor”. where Performance judges the performance...
Q: internet {1 36 1} private (4) enterprises (1) cisco hp (11) 3Com Cabletron (9) (43) (52) Cigure 1 pr...
A: • private MIB intended for vendor equipment • IANA (Internet Assigned Numbers Authority) assigns ide...
Q: What exactly is the Single Audit Act, and how does it function? What effect has this statute had on ...
A: Introduction: Single Audit Act: All recipients of grants and funding are expected to compile their f...
Q: Write an XML file for the following project's screenshot. The project will display one image, one te...
A: Given :- Write an XML file for the following project'sscreenshot. The project will display oneimage,...
Q: What is the impact of MOOC in information access? 2. Can MOOCs replace the traditional mode of infor...
A: A Massive Open online courses (MOOC) is a model for turning in getting to know content material onli...
Q: Define the characteristics that are required for test-driven development. In the event that you wish...
A: Test-driven development refers to a style of programming in which three activities that are: coding,...
Q: Explain why the following series of steps is not an algorithm. Washing the dog 1. Rinse 2. Lather 3....
A: right step of the washing dog is in the series : stage : 1 (lather) stage : 2 (rinse) and next ...
Q: Let’s analyze the game Tetris. That game had a lot of different pieces of various shapes and sizes....
A: If I have to program one game Tetris so there are lots of logical approach to deal with it . In thi...
Q: Select the most appropriate data structure for each scenario. Search needs to be done frequently. A ...
A: The above question we have to find the most appropriate data structure for given scenario is answere...
Q: (b). What method is included in the client code?
A: Following methods are included in client code:- getSecurityManager()getOutputStream()readLine()
Q: Reversing a queue can be simply done by dequeuing the queue until it's empty and then enqueuing the ...
A: the answer is given below:-
Q: O(n- 2) 0(1) ○ 이2) O(n)
A: Lets see the solution.
Q: Suppose that L is a context-free language and that R is a regular language. Is L - R necessarily con...
A: Concepts: Operation that does not close context-free language: Set difference, intersection, and c...
Q: Write a program that reads a four-digit number from user, then the program separates digits of the n...
A: code
Q: This is the default value for fields declared to "hold" object instances.
A: Here the question is related to the default value for fields declared to hold object instances.
Q: QUESTION 3 Fill in the following three blank spaces with the code necessary to allocate 20 floats in...
A: These is called as the dynamic memory allocation. Programming languages like c allows user to grab t...
Q: What are the most pressing email security issues
A: Introduction: The most serious security problems concerning email communications security,
Q: Compute Average Memory Access Time (AMAT) for a system that consists of a 2- level cache design. The...
A: I'm providing the answer to above question. I hope this will be helpful for you
Q: Question 2 "To deal with a given risk, a network administrator chooses to mitigate it. What does thi...
A: When an administrator chooses to mitigate to deal with the given risk then it is referred to as Risk...
Q: Write a function void RotateLeft(int A[ ], int n, int x). which will rotate the elements of array ...
A: If x is greater than n then rotating array will repeat every n times so changing the value of x to i...
Q: Who made the first flash drive?
A: These gadgets store data without external power and turn it on when a commuter connects through a ...
Q: What are the advantages of using data modelling?
A: Advantage of data modelling
Q: USING PYTHON A tridiagonal matrix is one where the only nonzero elements are the ones on the main di...
A:
Q: Try to write a program in assembly language (emu8086) that adds ten numbers and store the result in ...
A: In the microprocessor, assembly language is used to write a program using mnemonics like A...
Q: What do assembly language instructions like MIV signify, and what are they called?
A: Introduction: Assembly language instructions. The designer can program in assembly language in terms...
Q: When a buffer is used, what happens to the data that is inside?
A: Buffer means temporary storage Buffer is a region of memory used to temporarily hold data while it i...
Q: There are different stages in the instruction cycle.
A: INTRODUCTION: The instruction cycle, also known as the fetch–decode–execute cycle or simply the fet...
Q: ite a program InOrder that reads in three different integers and prints the three integers in ascend...
A: In Python we use input function to get input from the user. We can use it like this a = input (" En...
Q: Please consider the following assembly code.
A: 3The hexadecimal value of 1800000000 is 0x6B49D200. And the "addl" instruction would give us eds = e...
Step by step
Solved in 2 steps with 1 images
- Exception in thread "main" java.lang.NumberFormatException: For input string: "x" for Java code public class Finder { //Write two recursive functions, both of which will parse any length string that consists of digits and numbers. Both functions //should be in the same class and have the following signatures. //use the if/else statement , Find the base case and -1 till you get to base case //recursive function that adds up the digits in the String publicstaticint sumIt(String s) { //if String length is less or equal to 1 retrun 1. if (s.length()<= 1){ return Integer.parseInt(s); }else{ //use Integer.praseInt(s) to convert string to Integer //returns the interger values //else if the CharAt(value in index at 0 = 1) is not equal to the last vaule in the string else {//return the numeric values of a char value + call the SumIt method with a substring = 1 return Character.getNumericValue(s.charAt(0) ) + sumIt(s.substring(1)); } } //write a recursion function that will find…In this assignment, you will create a Java program to search recursively for files in a directory.• The program must take two command line parameters. First parameter is the folder to search for. Thesecond parameter is the filename to look for, which may only be a partial name.• If incorrect number of parameters are given, your program should print an error message and show thecorrect format.• Your program must search recursively in the given directory for the files whose name contains the givenfilename. Once a match is found, your program should print the full path of the file, followed by a newline.• You can implement everything in the main class. You need define a recursive method such as:public static search(File sourceFolder, String filename)For each subfolder in sourceFolder, you recursively call the method to search.• A sample run of the program may look like this://The following command line example searches any file with “Assignment” in its name%java FuAssign7.FuAssignment7…Create and implement a different solution to the use of semaphores using pseudocode or some preferred language for the following approach: Five philosophers sit around a table and spend their lives dining and thinking. Each philosopher has a bowl of noodles and a fork to the left of your plate. To eat the noodles you need two forks and each philosopher you can only take the ones to your left and right. If any philosopher takes a fork and the other is busy, he will wait, fork in hand, until pick up the other fork, so you can start eating later. If two adjacent philosophers try to pick up the same fork at the same time, a race condition: they both compete to take the same fork, and one of them left without eating. If all the philosophers take the fork to their right at the same time, then everyone will be waiting forever, because someone must release the fork that is lack. No one will because everyone is in the same situation (hoping that someone put down their forks). Then the…
- 1. Write a running Java program that clears the screen, locates the cursor near the middle of the screen, asks for your name, age, prompts for two integers, adds the integers, and displays their sum. Let the program repeat the steps three times using a loop.JAVAWrite a program that will add and remove the following name and phone number list. (List on image below) Once lists of names and phone numbers are added to the program, the program will ask a user whether there is an item to be removed or not. If it is, it will be removed. Otherwise, the program is terminated. The program will delete items continuously if requested. The result of the program looks like following:Part 2: SynchronizationAssume that we have a file named “sharable.txt” which can be shared among several threads. Wewant to write a program that controls the access to that file in a way that only one thread at a timeis allowed to access it (i.e., for writing/appending purposes). Using Java multithreading, write aprogram that creates three threads and assigns a number to each thread. Then, each thread will startrunning by executing a code for opening the file “sharable.txt” and writing the following lines:Thread x started writingThread x is currently writingThread x finished writing – Student NameYour program should allow only one thread -at any given time-to access the file and write in it. Italso should keep away any thread from overwriting the lines written by any other threads (hint:use synchronized methods/blocks). Finally, when the execution of your program is completed, theoutput stored in “sharable.txt” should look like the following – put your name in place “YourName”:Thread x…
- help I am trying to make a java program with three threads. two representing client bob and Alice. a third thread representing a mail server. make Alice check their mailbox every 5 second if their is a mail form bob, Alice should send one back and bob should do the same thing. Pre-load Alice's mailbox with one mail from Bob. For the next minute or so, Alice should check for mail every 5 seconds and Bob should check for mail every 3 seconds. If they receive a mail, they should send one back. The body of the first mail should say "Hello", the body of the second mail should say "Hello Hello", and so on. Design a Mail class that has fields From, To, Date, Body. here is what I have but Im lost public class mailserver2 extends Thread{public boolean maildeliverd;public boolean maildeliverbob; public void checkMail(){ try{while (maildeliverd){Thread.sleep(5000); }}catch(Exception e){System.out.print("mail not recieved");}System.out.print("mail recieved");mailclass mc = new…Please do this in java In many computer systems and networks, different users are granted different levels of access to different resources. In this case, you are given a int[] rights, indicating the privilege level of each user to use some system resource. You are also given a int minPermission, which is the minimum permission a user must have to use this resource. YouaretoreturnaStringindicatingwhichuserscanand cannot access this resource. Each character in the return value corresponds to the element of users with the same index. 'A' indicates the user is allowed access, while 'D' indicates the user is denied access. Constraints users will contain between 0 and 50 elements, inclusive. Each element of users will be between 0 and 100, inclusive. minPermission will be between 0 and 100, inclusive. Examples a) {0,1,2,3,4,5} 2 Returns: "DDAAAA" Here, the first two users don't have sufficient privileges, but the remainder do. b) {5,3,2,10,0} 20 Returns: "DDDDD"…3. Please create a program in Java that will read through a file of 25 words(one of them being Waldo) and will store them in an array. The program should have two types of search (sequential and binary search). Use .equals() to find Waldo and System.nanoTime to find the time it took each of the methods to find Waldo. After that, print both times and in a separate line print which method was the fastest.
- A java file that reads a text file, in.txt, that contains a list of positive integers a positive integer) separated by spaces and/or line breaks. After reading the integers, the program must recursively figure out if the list of integers includes two equal integers. If the list includes two equal integers, the program prints out Yes. Otherwise, the program prints out No. Assume that in.txt contains at least 2 integers. It is important that your program be named Two and that the input file is named in.txt.Write a multithreaded java program where a person gains 1000 calories throughout the day. But, the person burns it off too. So, the balance is zero. That means no gain or loss in calories. Synchronization will enable you to achieve zero balance every time the program is run. Note: First, do not think about synchronization. Write the program with two threads, one java file can handle the task- I named it Zerosum. There are two functions here, gainCalories() and burnCalories(). Each thread handles one of those functions. The run() method of each thread will have the method details. You can also call those methods if you decide to develop it outside the thread block. You are keeping a count of 0 to 1000 calories for both gain and loss. You need to keep track of the balance, so that is your instance variable which you print at end of the program. At the beginning of the program balance is zero. When you run this multithreaded program without synchronization, each run will show a result - a…You are given a class with synchronized method A and a normal methodB. If you have two threads in one instance of a program, can they both execute A at the same time?Can they execute A and B at the same time?