Write a program that prompts the user to enter a 3 x 3 matrix of double values and tests whether it is a positive Markov matrix. There will be two methods which will be called from the main method: public static double [] [] createArray() 1. Creates a 3 by 3 two dimensional array of doubles 2. Prompts the user for values as shown in the sample run 3. Stores the numbers in the array in the order entered 4. Returns the array to the main method public boolean isMarkovMatrix(double [][] matrix) 1. Returns false if any value in the array is negative 2. Prints the sum of each column in the array 3. Returns false if any the sum of any of the columns is not equal to 1.0 4. Otherwise, it returns true. Sample Program running: Enter a 3 x 3 matrix by row 0.15 0.875 0.375 0.55 0.005 0.225 0.30 0.12 0.4 The sum of the columns 1.0 1.0 1.0 It is a Markov matrix Enter a 3 x 3 matrix by row -0.2 0.875 0.375 0.75 0.005 0.225 0.45 0.12 0.4 The sum of the columns 1.0 1.0 1.0 It is not a Markov matrix A response in Eclipse Java would be much appreciated. Thank you in advance
In: Computer Science
Based on the review of the materials for this week, compare the risks associated with internal versus external security threats. What are your thoughts on the question of whether internal or external threats pose the biggest problems for organizations? Support your answer with logical commentary and at least one practical example
In: Computer Science
Write a Java program that outputs the output below
Student Name: Andrew Johnson
Course: Biology 101
Quiz Average and percent weight (separated by a space):
87 15
Project Average and percent weight (separated by a space):
92 25
Exam Average and percent weight(separated by a space): 85
40
Final Exam and percent weight (separated by a space):
83 20
Final Grade in Biology 101 for Andrew Johnson is 86.7
The largest average was 92
The smallest average was 83
Thank you for using my grade program!!
In: Computer Science
PYTHON: Im writing a program to make a simple calculator that can add, subtract, multiply, divide using functions. It needs to ask for the two numbers from the user and will ask the user for their choice of arithmetic operation
1- subtract
2- add
3- divide
4- multiply
In: Computer Science
Complete the program to read in values from a text file. The values will be the scores on several assignments by the students in a class. Each row of values represents a specific student's scores. Each column represents the scores of all students on a specific assignment. So a specific value is a specific student's score on a specific assignment. The first two values in the text file will give the number of students (number of rows) and the number of assignments (number of columns), respectively.
For example, if the file contains:
3
4
9 6 10 5
2 2 0 0
10 10 9 10
then it represents the scores for 3 students on 4 assignments as follows:
| Assignment 1 | Assignment 2 | Assignment 3 | Assignment 4 | |
| Student 1 | 9 | 6 | 10 | 5 |
| Student 2 | 2 | 2 | 0 | 0 |
| Student 3 | 10 | 10 | 9 | 10 |
The program should:
1) Read in the first two values to get the number of students and number of assignments. Create a two-dimensional array of integers to store all the scores using these dimensions.
2) Read in all the scores into the 2-D array.
3) Print the whole array, row by row on separate lines, using Arrays.toString() on each row of the array
3) Print the average of the scores on each assignment. For example, if the data is given in the above example, the output would be:
Array of scores:
[9, 6, 10, 5]
[2, 2, 0, 0]
[10, 10, 9, 10]
Average score of each assignment:
Assignment #1 Average = 7.0
Assignment #2 Average = 6.0
Assignment #3 Average = 6.333333333333333
Assignment #4 Average = 5.0
Starter Code:
import java.util.Scanner;
import java.io.File; //needed to open the file
import java.io.FileNotFoundException; //needed to declare possible
error when opening file
import java.util.Arrays; //for the Arrays.toString() method
public class Scores {
public static void main(String[] args) throws FileNotFoundException
{
//create a Scanner to get input from the keyboard to ask the user
for the file name
Scanner keyboard = new Scanner(System.in);
System.out.println("What is the name of the file containing the
scores?");
//create another Scanner to read from the file
String fileName = keyboard.nextLine();
Scanner fileScan = new Scanner(new File(fileName));
//TODO: read in the values for the number of students and number of
assignments using the Scanner on the file
//TODO: create a 2-D to store all the scores and read them all in
using the Scanner on the file
System.out.println("Array of scores:");
//TODO: print the entire array, row by row, using
Arrays.toString()
System.out.println("Average score of each assignment:");
//TODO: compute and print the average on each assignment
In: Computer Science
Your task is to create a Java application that converts a specified amount of one currency into another currency for a user. The application must meet the following requirements:
1. Upon execution, the application shall display a brief welcome message to the user to let her know she is running the currency converter application.
2. The application shall allow a user to convert amounts between any two of the following currencies: United States Dollars (USD), British Pounds (GBP), Swiss Francs (CHF), and Indian Rupees (INR).
3. The application shall prompt the user for the following input: the currency she wishes to convert from (“source currency”); the amount of currency to be converted (“requested amount”) as either a decimal or a whole number (e.g., 21.45, 1.748484, or 34); and the currency she wishes to convert to (“result currency”).
4. The application shall limit the amount of the currency to be converted to no more than 1,000,000 (one million) units of that currency; if the user attempts to enter an amount larger than this number, the application should return a message alerting the user that she has exceeded the maximum amount, and prompt her to enter another amount.
5. The application shall handle incorrect user input (e.g., if the user inputs a character or string for the “requested amount” value) and prompt the user for correct input.
6. The application shall prevent the user from attempting to convert to a “result currency” that is the same as the “source currency” (e.g., the user should be prevented from converting United States Dollars to United States Dollars).
7. The application shall output the following information: the amount of the “result currency” that is equivalent to the “requested amount” in the “source currency”; this amount shall be returned as a decimal figure rounded to two decimal places (e.g., 67.49).
8. The application shall allow the user to exit the program at any time by accepting input of an exit character (for example “Q” for quit) to terminate the program.
9. After the user has successfully converted a currency, the application shall prompt the user to either perform another conversion or terminate the program.
10. Upon program termination, the application shall display an exit message to the user.
Program Data Your program should use the following data for currency conversions.
USD GBP CHF INR
USD 1.000000 1.227902 1.012514 0.013950
GBP 0.814349 1.000000 0.824820 0.011365
CHF 0.987370 1.212602 1.000000 0.013777
INR 71.687245 88.022221 72.582298 1.000000
In: Computer Science
1. Design a FA for the language L = {w : na(w) ≤ 4}.
2. Design a FA that accepts all strings that contain the substring aba.
3. Design a FA for the language L = {ai baj : i, j ≥ 0, i + j is odd}
4. Design a FA for the language L = {bnam : n ≤ 2, m ≥ 3}
In: Computer Science
Please write code in java and comment. Thanks. I would appreciate that.
Fitness Task:
public interface Fitness
Anaerobic Task:
(10pts) Anaerobic is a Fitness and we cannot give the actual implementation for the methods muscleTargeted() as we don't know the actual Anaerobic exercise. The descripton() method returns the string Anaerobic means "without oxygen.". Note that Anaerobic is a good candidate to be abstract class.
Define class yoga which are Anaerobic fitness exercises. Use the following table to define the classes. The classes also have:
| Exercise Type | Muscle affected |
|---|---|
| Yoga | Triceps,Biceps |
public class Profile
Assume the weight is in kgs, height in meters and gender is enum data type called Gender. In addition, this class must contain:
public class DailyExercise
public class WeeklyExercise
In: Computer Science
(Python)####But, what if we need just a sequence without
brackets, i.e., we want to have
####1, 2, 3, 4,... and not [1, 2, 3, 4, 5, ...]?
####We can do this:
##print(*accum, sep=", ") ## *accum 'unpacks' the list accum.
Ask for the left and the right range bounds with input:
##
##leftB = int(input('Enter the left bound: '))
##rightB = int(input('Enter the right bound: '))
## and if (rightB - leftB) is odd then print the list of the
numbers in this range,
## if (rightB - leftB) is even then print just sequence (no
brackets []) of the numbers in this range.
##
In: Computer Science
Processor/CPU Management
I. Five processes, J1, J2, J3, J4 and J5. arrive in the Ready Queue in sequence, one second apart. Each job takes 1 millisecond to load into memory. Each job will take 10, 2, 3, 1, 5 seconds to run respectively. Questions
A. Create a Google Sheet where each column represents a Job and reach row represents a second..
B. Show the state of the Ready Queue in the 7th second, the 11th second and the 20th second using the First Come, First Served, Shortest Job Next, Shortest Remaining Time First, amd Round Robin with time quantum of 2 seconds.
C. Which one is most efficient? Discuss advantage and disadvantage. Double spaced, one pag
In: Computer Science
Consider the three transactions T1, T2 and T3, and the schedules S1, S2, S3 and S4 given below. Which of the schedules is (conflict) serializable? The subscript for each database operation in a schedule denotes the transaction number for that operation. For each schedule, show all conflicts, draw the precedence graph, determine and write down if it is serializable or not, and the equivalent serial schedules if exist.
T1: r1(x); w1(x);
T2: r2(x);
T3: r3(x); w3(x);
S1: r1(x); r3(x); w1(x); r2(x); w3(x);
S2: r1(x); r3(x); w3(x); w1(x); r2(x);
S3: r3(x); r2(x); w3(x); r1(x); w1(x);
S4: r3(x); r2(x); r1(x); w3(x); w1(x);
In: Computer Science
The following code segment is stored in memory starting at memory location 0x00445670.
What are the two possible values for the contents of the PC after the branch instruction has executed?
bgez $a0, skip # mem location: 0x00445670
subu $s2, $s1, $t0 # branch NOT taken (false)
ori $v0, $t1, 0x0003 #
skip:
addi $t0, $t1, 2 # branch taken (true)
if taken:
if not taken:
Hint: Remember how many bytes each instructions takes.
In: Computer Science
write a C/C++ program that implements the banker's algorithm. Verify your implementation using the data from the textbook as well as the attached, but unverified (meaning that it is possible the system is already in an unsafe state), file. The file format is as follows:
Line 1 contains a number of resources (m).
Line 2 contains the quantity for each resource (I.e., the resource vector.
Line 3 contains the number of processes (n).
Lines 4 through 3+n contain the Claim matrix. Each line contains the maximum resource requirements for one process.
Lines 4+n and beyond contain the Allocation matrix. Each line contains the current number of resources allocated to the process.
The Claim and Allocation of matrices are in the same process order.
In: Computer Science
Clearly explain the input-process-output mechanism in a wearable computer using appropriate example?
In: Computer Science
JavaScript Programming Assignment
PLEASE NOTE: You must create and call a main function, and if instructed include additional functions called by the main. Make sure to use ES6 style of keywords => instead of the older function and for local scope variables use the keyword let and not a keyword var. Make sure to follow the requirements and recheck before submitting.
PROJECT GOAL:
Create a program that simulates tossing a coin. This program should be titled flippingacoin.js and will require you to include two functions, one of them is called main and the other flip. The use of a loop is required for this program. Make sure the program includes a user prompt asking how many times to toss the coin. Program a function called flip which does not include parameters and randomly (using math library random) returns either a String called heads or one called tails. Call onto this function in main as many times as requested by using a loop. Make sure to report the results.
Example output:
How many times should I toss the coin? 4000
Results of 4000 tosses.
Heads: # 2635, Tails: 1365
NOTE: End users should be able to enter a higher number of tosses such as 300500020 and receive accurate results.
Thank you for your help with this project.
In: Computer Science