Answer:
A code was created to single list that contains the following collection of data in the order provided
Explanation:
Solution
#list that stores employee numbers
employeee_numbers=[1121,1122,1127,1132,1137,1138,1152,1157]
#list that stores employee names
employee_name=["Jackie Grainger","Jignesh Thrakkar","Dion Green","Jacob Gerber","Sarah Sanderson","Brandon Heck","David Toma","Charles King"]
#list that stores wages per hour employee
hourly_rate=[22.22,25.25,28.75,24.32,23.45,25.84,22.65,23.75]
#list that stores salary employee
company_raises=[]
max_value=0
#list used to store total_hourly_rate
total_hourly_rate=[]
underpaid_salaries=[]
#loop used to musltiply values in hourly_wages with 1.3
#and store in new list called total_hourly_rate
#len() is used to get length of list
for i in range(0,len(hourly_rate)):
#append value to the list total_hourly_rate
total_hourly_rate.append(hourly_rate[i]*1.3)
for i in range(0,len(total_hourly_rate)):
#finds the maximum value
if(total_hourly_rate[i]>max_value):
max_value=total_hourly_rate[i] #stores the maximum value
if(max_value>37.30):
print("\nSomeone's salary may be a budget concern.\n")
for i in range(0,len(total_hourly_rate)):
#check anyone's total_hourly_rate is between 28.15 and 30.65
if(total_hourly_rate[i]>=28.15 and total_hourly_rate[i]<=28.15):
underpaid_salaries.append(total_hourly_rate[i])
for i in range(0,len(hourly_rate)):
#check anyone's hourly_rate is between 22 and 24
if(hourly_rate[i]>22 and hourly_rate[i]<24):
#adding 5%
hourly_rate[i]+=((hourly_rate[i]/100)*5)
elif(hourly_rate[i]>24 and hourly_rate[i]<26):
#adding 4%
hourly_rate[i]+=((hourly_rate[i]/100)*4)
elif(hourly_rate[i]>26 and hourly_rate[i]<28):
#adding 3%
hourly_rate[i]+=((hourly_rate[i]/100)*3)
else:
#adding 2% for all other salaries
hourly_rate[i]+=((hourly_rate[i]/100)*2)
#adding all raised value to company_raises
company_raises.extend(hourly_rate)
#The comparison in single line
for i in range(0,len(hourly_rate)):
For this exercise i used ternary
operator hourly_rate[i]= (hourly_rate[i]+((hourly_rate[i]/100)*5)) if (hourly_rate[i]>22 and hourly_rate[i]<24) else (hourly_rate[i]+((hourly_rate[i]/100)*4)) if (hourly_rate[i]>24 and hourly_rate[i]<26) else hourly_rate[i]+((hourly_rate[i]/100)*2)
ALAP Help
what is a computer
Answer:An electronic device for storing and processing data, typically in binary form
Explanation:
A Transmission Control Protocol (TCP) connection is in working order and both sides can send each other data. What is the TCP socket state?
Answer:
The TCP socket state will be as 'Closed'.
Explanation:
TCP seems to be a framework that describes how well a web discussion can be established and maintained through which software applications could access information.
The accompanying is the finished status whenever the connection is suspended by TCP:
CLOSE-WAIT:
This means that the end destination had already chosen to take a similar requirement from the 'remote endpoint.'
CLOSING:
This indicates the position for the cancellation of server access verification from either the faraway TCP.
LAS-ACK:
This indicates the view for approval including its extermination previously sent through the cell tower TCP.
TIME-WAIT:
This symbolizes a lengthy delay for all the remote to accept verification of its cancellation request.
CLOSED:
This means that there is no link region or anything like that.
What keyboard functions lets you delete words
Answer:Backspace
Explanation:
If you want to delete words you use the backspace button.
Answer:
Backspace
Explanation:
Tamera and Rupert each applied for the same credit card through the same company. Tamera has a positive credit history. Rupert has a negative credit history.
Which compares their credit limits and likely interest rates?
Answer:
it is two by five credit limit
Answer:
Your answer is A Tamera’s credit limit is most likely higher than Rupert’s, and her interest rate is most likely lower.
Explanation:
I got it right on the test and I hope this answer helps
A contiguous subsequence of a list S is a subsequence made up of consecutive elements of S. For example, if S is 5,15,-30,10,-5,40,10 then 5,15,-30 is a contiguous subsequence but 5,15,40 is not.
1. Give a linear-time algorithm for the following task:
Input: A list of numbers, A(1), . . . , A(n).
Output: The contiguous subsequence of maximum sum (a subsequence of length zero has sum zero).
For the preceding example, the answer would be 10,-5,40,10 with a sum of 55.
Answer:
We made use of the dynamic programming method to solve a linear-time algorithm which is given below in the explanation section.
Explanation:
Solution
(1) By making use of the dynamic programming, we can solve the problem in linear time.
Now,
We consider a linear number of sub-problems, each of which can be solved using previously solved sub-problems in constant time, this giving a running time of O(n)
Let G[t] represent the sum of a maximum sum contiguous sub-sequence ending exactly at index t
Thus, given that:
G[t+1] = max{G[t] + A[t+1] ,A[t+1] } (for all 1<=t<= n-1)
Then,
G[0] = A[0].
Using the above recurrence relation, we can compute the sum of the optimal sub sequence for array A, which would just be the maximum over G[i] for 0 <= i<= n-1.
However, we are required to output the starting and ending indices of an optimal sub-sequence, we would use another array V where V[i] would store the starting index for a maximum sum contiguous sub sequence ending at index i.
Now the algorithm would be:
Create arrays G and V each of size n.
G[0] = A[0];
V[0] = 0;
max = G[0];
max_start = 0, max_end = 0;
For i going from 1 to n-1:
// We know that G[i] = max { G[i-1] + A[i], A[i] .
If ( G[i-1] > 0)
G[i] = G[i-1] + A[i];
V[i] = V[i-1];
Else
G[i] = A[i];
V[i] = i;
If ( G[i] > max)
max_start = V[i];
max_end = i;
max = G[i];
EndFor.
Output max_start and max_end.
The above algorithm takes O(n) time .
In the RSA system, the receiver does as follows:1. Randomly select two large prime numbers p and q, which always must bekept secret.2. Select an integer number E, known as the public exponent, such that (p 1)and E have no common divisors, and (q 1) and E have no commondivisors.3. Determine the private exponent, D, such that (ED 1) is exactly divisible byboth (p 1) and (q 1). In other words, given E, we choose D such that theinteger remainder when ED is divided by (p 1)(q 1) is 1.4. Determine the product n = pq, known as public modulus.5. Release publicly the public key, which is the pair of numbers n and E, K =(n, E). Keep secret the private key, K = (n, D).The above events are mentioned in the correct order as they are performed whilewriting the algorithm.Select one:TrueFalse
Answer:
False.
Explanation:
The correct option is false that is to say the arrangement is not true. So, let us check one or two things about the RSA System.
The RSA system simply refer to as a cryptosystem that was first established in the year 1973 but was later developed in the year 1977 by Ron Rivest, Adi Shamir and Leonard Adleman.
The main use of the RSA system is for encryption of messages. It is known as a public key cryptography algorithm.
The way the algorithm should have been arranged is;
(1). Randomly select two large prime numbers p and q, which always must bekept secret.
(2). Determine the product n = pq, known as public modulus.
(3). Select an integer number E, known as the public exponent, such that (p 1)and E have no common divisors, and (q 1) and E have no commondivisors.
(4). Determine the private exponent, D, such that (ED 1) is exactly divisible by both (p 1) and (q 1). In other words, given E, we choose D such that the integer remainder when ED is divided by (p1)(q 1) is 1.
(5). Release publicly the public key, which is the pair of numbers n and E, K =(n, E). Keep secret the private key, K = (n, D).
Therefore, The way it should have been arranged in the question should have been;
(1) , (4), (2), (3 ) and ( 5).
// isOrdered
//
// return true if the queue contents are in increasing order (back to front)
// Queue may be empty ; in which case the function should return true
// You must solve this USING RECURSION; you will need to use a helper function
// You may not use:
// any other Java classes, algorithms,
// the toString instance method
// You may not alter the invoking queue
//
// here are some conceptual examples ( they also mirror what your linked lists will look like)
// the back is on the left and the front is on the right.
// Example 1. A B C D E F G H I J --> answer true ,
// Example 2. C B A --> answer false
// Example 3. C --> answer true
//
Answer:
honestly i dont know but I used to have computer programming classes on java and I'd get all my answers from repl.it forums. Wist you best of luck!!
Consider the following C program: void fun(void) { int a, b, c; /* definition 1 */ ... while (...) { int b, c, d; /* definition 2 */ ... <------------------ 1 while (...) { int c, d, e; /* definition 3 */ ... <-------------- 2 } ... <------------------ 3 }... <---------------------- 4 } For each of the four marked points in this function, list each visible variable, along with the number of the definition statement that defines it.
Answer:
Check the explanation
Explanation:
1.
void func(void){
int a,b,c; /*definition 1*/
/////* a,b,c for definition 1 are visible */
//// d, e are not visible
while(...){
int b, c, d; /* definition 2*/
////*
a from definition 1 is visible
b, c, d from definition 2 are visible
*/ ///
while(...){
int c, d, e;/* definition 3*/
////*
a from definition 1 is visible
b from definition 2 is visible
c, d, e from definition 3 are visible
*/ ///
}
////*
a from definition 1 is visible
b, c, d from definition 2 are visible
e not visible
*////
}
/////* a,b,c for definition 1 are visible */
///// d, e are not visible
}
which of the following correctly declares an array:
Choose one answer .
a. int array
b.array(10);
c.int array(10);
d.array array(10);
Answer:
a.
Explanation:
The option that correctly declares an array is int array.
What is an array?This is a term that connote a regular system or arrangement. Here, numbers or letters are said to be arranged in rows and columns.
In computing, An array is a term that describe memory locations box having the same name. All data in an array is said to be of the same data type.
Learn more about array from
https://brainly.com/question/26104158
You and your friends are driving to Tijuana for springbreak. You are saving your money for the trip and so you want to minimize the cost of gas on the way. In order to minimize your gas costs you and your friends have compiled the following information.
First your car can reliably travel m miles on a tank of gas (but no further). One of your friends has mined gas-station data off the web and has plotted every gas station along your route along with the price of gas at that gas station. Specifically they have created a list of n+1 gas station prices from closest to furthest and a list of n distances between two adjacent gas stations. Tacoma is gas station number 0 and Tijuana is gas station number n. For convenience they have converted the cost of gas into price per mile traveled in your car. In addition the distance in miles between two adjacent gas-stations has also been calculated. You will begin your journey with a full tank of gas and when you get to Tijuana you will fill up for the return trip.
You need to determine which gas stations to stop at to minimize the cost of gas on your trip.
1. Express this problem formally with input and output conditions.
2. State a self-reduction for your problem.
3. State a dynamic programming algorithm based off your seld reduction that computes the minimum gas cost.
Answer:
Explanation:
.Car can Travel a m miles tank on a gas
2.For N distance there are n+1 adjacent gas stations.
Output Conditions:
Tacoma will fill the gas station while going.
Tijuana will fill up gas for the return trip
3.Dynamic self Reduction Algorithm
Start
if(n==0)
Tacoma is a gas station number 0;
else
Tijuana is a gas station n+1;
stop
In devising a route to get water from a local lake to its central water storage tank, the city of Rocky Mount considered the various routes and capacities that might be taken between the lake and the storage tank. The city council members want to use a network model to determine if the city's pipe system has enough capacity to handle the demand.
1. They should use ____________.
A. Minimal Spanning Tree Method
B. Shortest Path Method
C. Maximal Flow Method
D. Any of the above will do
Answer:
C. Maximal Flow Method
Explanation:
When it comes to optimization theory, Maximal Flow Method or problems have to do with finding a possible or viable flow through a flow network that obtains the maximum potential flow rate. The maximum flow problem can be viewed as an exceptional case of more complex and complicated network flow problems, such as that of the circulation problem.
Write a method that sums all the numbers in the major diagonal in an n x n matrix of double values using the following header: public static double sumMajorDiagonal(double[][] m) Write a test program that first prompts the user to enter the dimension n of an n x n matrix, then asks them to enter the matrix row by row (with the elements separated by spaces). The program should then print out the sum of the major diagonal of the matrix.
Answer:
Following are the code to this question:
import java.util.*; //import package for user input
public class Main //defining main class
{
public static double sumMajorDiagonal(double [][] m) //defining method sumMajorDiagonal
{
double sum = 0; //defining double variable sum
int i, j; //defining integer variable
for(i = 0; i <m.length; i++) //defining loop to count row
{
for(j = 0; j < m.length; j++) //defining loop to count column
{
if(i == j) //defining condition to value of i is equal to j
{
sum=sum+ m[i][j]; //add diagonal value in sum variable
}
}
}
return sum; //return sum
}
public static void main(String args[]) //defining main method
{
int n,i,j; //defining integer variable
System.out.print("Enter the dimension value: "); //print message
Scanner ox = new Scanner(System.in); //creating Scanner class object for user input
n = Integer.parseInt(ox.nextLine()); //input value and convert value into integer
double m[][] = new double[n][n]; //defining 2D array
for(i = 0; i < m.length; i++)
{
String t = ox.nextLine(); // providing space value
String a[] = t.split(" "); // split value
for(j = 0; j < a.length; j++) //defining loop to count array value
{
double val = Double.parseDouble(a[j]); //store value in val variable
m[i][j] = val; //assign val in to array
}
}
double d_sum = sumMajorDiagonal(m); //call method store its return value in d_sum variable
System.out.println("diagonal matrix sum: "+ d_sum); //print sum
}
}
output:
Enter the dimension value: 3
1 2 3
1 2 3
1 2 4
diagonal matrix sum: 7.0
Explanation:
Program description:
In the given java language code, a method "sumMajorDiagonal" is declared, that accepts a double array "m" in its parameter, inside the method two integer variable "i and j" and one double variable "sum" is defined, in which variable i and j are used in a loop to count array value, and a condition is defined that checks its diagonal value and use sum variable to add its value and return its value. In the main method first, we create the scanner class object, that takes array elements value and passes into the method, then we declared a double variable d_sum that calls the above static method, that is "sumMajorDiagonal" and print its return value with the message.Only one calendar can be visible at a time
in Outlook.
Select one:
a. False
b. True
Answer:
a. False
Explanation:
It is false as more than one calendar is visible in outlook.
Explanation:
it is false
i think it helps you
Write a program that prompts the user to enter the area of the flat cardboard. The program then outputs the length and width of the cardboard and the length of the side of the square to be cut from the corner so that the resulting box is of maximum volume. Calculate your answer to three decimal places. Your program must contain a function that takes as input the length and width of the cardboard and returns the side of the square that should be cut to maximize the volume. The function also returns the maximum volume.
Answer:
A program in C++ was written to prompts the user to enter the area of the flat cardboard.
Explanation:
Solution:
The C++ code:
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
double min(double,double);
void max(double,double,double&,double&);
int main()
{double area,length,width=.001,vol,height,maxLen,mWidth,maxHeight,maxVolume=-1;
cout<<setprecision(3)<<fixed<<showpoint;
cout<<"Enter the area of the flat cardboard: ";
cin>>area;
while(width<=area)
{length=area/width;
max(length,width,vol,height);
if(vol>maxVolume)
{maxLen=length;
mWidth=width;
maxHeight=height;
maxVolume=vol;
}
width+=.001;
}
cout<<"dimensions of card to maximize the cardboard box which has a volume "
<<maxVolume<<endl;
cout<<"Length: "<<maxLen<<"\nWidth: "<<maxLen<<endl;
cout<<"dimensions of the cardboard box\n";
cout<<"Length: "<<maxLen-2*maxHeight<<"\nWidth: "
<<mWidth-2*maxHeight<<"\nHeight: "<<maxHeight<<endl;
return 0;
}
void max(double l,double w,double& max, double& maxside)
{double vol,ht;
maxside=min(l,w);
ht=.001;
max=-1;
while(maxside>ht*2)
{vol=(l-ht*2)*(w-ht*2)*ht;
if(vol>max)
{max=vol;
maxside=ht;
}
ht+=.001;
}
}
double min(double l,double w)
{if(l<w)
return l;
return w;
}
Note: Kindly find the output code below
/*
Output for the code:
Enter the area of the flat cardboard: 23
dimensions of card to maximize the cardboard box which has a volume 0.023
Length: 4.796
Width: 4.796
dimensions of the cardboard box
Length: 4.794
Width: 4.794
Height: 0.001
*/
The purpose of this assignment is to determine a set of test cases knowing only the function’s specifications, reported hereafter:The program takes as input a 2D matrix with N rows. The program finds the column index of the first non-zero value for each row in the matrix A, and also determines if that non-zero value is positive or negative. It records the indices of the columns, in order, in the array W. It records whether each value was positive or negative, in order, in the array T (+1 for positive, -1 for negative). Assume that all rows have at least one column with a non-zero value.As this is black-box testing, you will not have access to the source so you must use what you have learned.You need to include a comment that describes how you chose your test cases.Students should identify the input equivalence partitions classes and select test cases on or just to one side of the boundary of equivalence classes.Students will gain 25 points for each input equivalence partition classes and valid test cases reported.Any language can be used, preferably C or C++ but it's not an issue if it's not in these two. Thanks!
Answer:
The program is written using PYTHON SCRIPT below;
N=int(input(" Enter number of Rows you want:"))
M=[] # this for storing the matrix
for i in range(N):
l=list(map(int,input("Enter the "+str(i+1)+" Row :").split()))
M.append(l)
print("The 2D Matrix is:\n")
for i in range(N):
print(end="\t")
print(M[i])
W=[] # to store the first non zero elemnt index
T=[] # to store that value is positive or negative
L=len(M[0])
for i in range(N):
for j in range(L):
if (M[i][j]==0):
continue
else:
W.append(j) # If the value is non zero append that postion to position list(W)
if(M[i][j]>0): #For checking it is positive or negative
T.append(+1)
else:
T.append(-1)
break
print()
print("The first Non Zero element List [W] : ",end="")
print(W)
print("Positive or Negative List [T] : ",end="")
print(T)
Explanation:
In order for the program to determine a set of test cases it takes in input of 2D matrix in an N numbet of rows.
It goes ahead to program and find the column index of the first non-zero value for each row in the matrix A, and also determines if that non-zero value is positive or negative. The If - Else conditions are met accordingly in running the program.
Complete data are very rare because some data are usually missing. There are typically four strategies to handle missing data.
Ignore the variables with missing data.
Delete the records that have some missing values.
Impute the missing values (i.e., simply fill in the missing values with some other value, such as the mean of similar records with data).
Use a data mining technique that can handle missing values, such as CART, which is one of a few techniques that handle missing data pretty well.
Suppose you are working on a project to model a hotel company's customer base. The goal is to determine which customer attributes are correlated with a high number of hotel stays. You have access to data from a customer survey, but one field (which is optional) is yearly income and has some missing values equaling roughly 5% of the records. Which of the strategies should be used? Explain why. Suppose you chose the third strategy. Explain how you would impute the missing incomes.
Answer:
see explaination
Explanation:
If I am to select I will select the strategy Impute the missing values . Because rather than deleting and all the other strategies. This is the best option because, this is an optional field as described there is no need for such accurate information about salary.
If we want to maintain this field we can just fill the value by identifying the similar records which is the other customers who is visiting the same no of times and fill that.
Write a BASH script to create a user account. The script should process two positional parameters: o First positional parameter is supposed to be a string with user name (e.g., user_name) o Second positional parameter is supposed to be a string with user password (e.g., user_password) The script should be able to process one option (use getopts command): o Option -f arg_to_opt_f that will make your script direct all its output messages to file -arg_to_opt_f
#!/bin/bash
usage() {
echo "Usage: $0 [ -f outfile ] name password" 1>&2
exit 1
}
while getopts "f:" o; do
case "${o}" in
f)
filename=${OPTARG}
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
name=$1
password=$2
if [ -z "$password" ] ; then
usage
fi
set -x
if [ -z "$filename" ] ; then
useradd -p `crypt $password` $name
else
useradd -p `crypt $password` $name > $filename
fi
Research and a well-written problem statement are important because
ANSWER: A) they give a clear understanding of the problem and its solution
Answer:
they give a clear understanding of the problem and its solution
Answer:
The answer is in the question,A
Explanation:
They give a clear understanding of the problem and its solution
p25: File Write and Read1) User enters a file name (such as "myMovies.txt").2) User enters the titles of 4 of their favorite moveis (use a loop!).3) Program Writes the 4 titles to a file, one per line, then closes the file (use a loop!).4) Program Reads the 4 titles from "myMovies.txt" stores them in a list and shows the list5) The program writes the titles in reverse order into a file "reverseOrder.txt"Sample Run:Please enter a file name: myMovies.txtPlease enter a movie title #1: movie1Please enter a movie title #2: movie2Please enter a movie title #3: movie3Please enter a movie title #4: movie4Writing the 4 movie titles to file 'myMovies.txt'Reading the 4 movie titles from file into a list: [movie1, movie2, movie3, movie4]Writing the 4 movie titles in revers to 'reverseOrder.txt'Note: Do not use reverse() , reversed()Content of myMovies.txt:movie1movie2movie3movie4Content of reverseOrder.txtmovie4movie3movie2movie1
Answer:
The program goes as follows
Comments are used to explain difficult lines
#include<iostream>
#include<fstream>
#include<sstream>
#include<string>
using namespace std;
int main()
{
//Declare String to accept file name
string nm;
//Prompt user for file name
cout<<"Enter File Name: ";
getline(cin,nm);
//Create File
ofstream Myfile(nm.c_str());
//Prompt user for 4 names of movies
string movie;
for(int i = 1;i<5;i++)
{
cout<<"Please enter a movie title #"<<i<<": ";
cin>>movie;
//Write to file, the names of each movies
Myfile<<movie<<endl;
}
Myfile.close(); // Close file
//Create an Array for four elements
string myArr[4];
//Prepare to read from file to array
ifstream file(nm.c_str());
//Open File
if(file.is_open())
{
for(int i =0;i<4;i++)
{
//Read each line of the file to array (line by line)
file>>myArr[i];
}
}
file.close(); // Close file
//Create a reverseOrder.txt file
nm = "reverseOrder.txt";
//Prepare to read into file
ofstream Myfile2(nm.c_str());
for(int j = 3;j>=0;j--)
{
//Read each line of the file to reverseOrder.txt (line by line)
Myfile2<<myArr[j]<<endl;
}
Myfile2.close(); //Close File
return 0;
}
See attached for .cpp program file
The code below uses the Space macro which simply displays the number of blank spaces specified by its argument. What is the first number printed to the screen after this code executes? (ignore the .0000 from Canvas) main PROC push 4 push 13 call rcrsn exit main ENDP rcrsn PROC push ebp mov ebp,esp mov eax,[ebp + 12] mov ebx,[ebp + 8] cmp eax,ebx jl recurse jmp quit recurse: inc eax push eax push ebx call rcrsn mov eax,[ebp + 12] call WriteDec Space 2 quit: pop ebp ret 8 rcrsn ENDP
Answer:
The code implements a recursive function by decrementing number by 1 from 10 to 4 recursively from the stack and add an extra space 2 using the macro function
Explanation:
Solution
The code implements a recursive function by decrementing number by 1 from 10 to 4 recursively from the stack and add an extra space 2 using the macro function mwritespace
The first number is printed after the code executes is 9
Code to be used:
Include Irvine32.inc
INCLUDE Macros.inc ;Include macros for space
.code
main proc
push 4 ;Push 4 to the stack
push 10 ;Push 10 to the stack
call rcrsn ;call the function
exit
;invoke ExitProcess,0 ;After return from the function
;call exit function
main ENDP ;end the main
rcrsn PROC ;define the function
push ebp ;push the ebp into stack
mov ebp,esp ;set ebp as frame pointer
mov eax,[ebp + 12] ;This is for second parameter
mov ebx,[ebp + 8] ;This is for first parameter
cmp eax,ebx ;compare the registers
jl recurse ;jump to another function
jmp quit ;call quit
recurse: ;Implement another function
inc eax ;increment count value
push eax ;push the eax value into stack
push ebx ;push ebx into stack
call rcrsn ;call above function
mov eax,[ebp + 12] ;This is for second parameter
call WriteDec ;write the value on the screen
mWritespace 2 ;Space macro print 2 spaces
;pause the screen
quit: ;Implement quit function
pop ebp ;pop the pointer value from the stack
ret 8 ;clean up the stack
rcrsn ENDP
end main
Why is it difficult to convince top management to commit funds to develop and implement a Strategic Information System
Answer:
It is difficult to convince top management to commit funds to develop and implement an SIS because it can lead to reengineering, which requires businesses to revamp processes to undergo organizational change to gain an advantage.
Explanation:
During testing, a student receives the incorrect answer back from a function that was supposed to be designed to return the largest value found in an array of double values provided as a parameter. Read the function definition used for this purpose, and identify the error:
int findMax (double arr [ ], int s )
{
int i;
int indexOfMax = 0;
double max = arr[0];
for ( i=1; i < s ; i++ )
{
if ( arr[ i ] > arr [indexOfMax] )
{
indexOfMax = i;
max = arr[indexOfMax];
}
}
return indexOfMax;
}
Answer:
dude what r u doin
Explanation:
One factor in algorithm performance that we've not had a chance to speak much about this quarter, but one that is certainly relevant in practice, is parallelism, which refers to the ability to speed up an algorithm by doing more than one thing at once. Nowadays, with most personal laptop or desktop computers having multicore processors, and with many workloads running on cloud infrastructure (i.e., potentially large numbers of separate machines connected via networks), the ability to run an algorithm in parallel is more important than ever.
Of course, not all problems can be parallelized to the same degree. Broadly, problems lie on a spectrum between two extremes. (In truth, most problems lie somewhere between these extremes, but the best way to understand what's possible is to know what the extremes are.)
Embarrassingly parallel problems are those that are composed primarily of independent steps that can be run in isolation from others and without respect to the results of the others, which makes them very easy to parallelize. Given n cores or machines, you could expect to run n steps simultaneously without any trouble.
Inherently serial problems are those whose steps have to be run sequentially, because the output of the first step makes up part of the input to the second step, and so on. Multiple cores or machines aren't much help for problems like this.
Now consider all of the sorting algorithms we learned about in our conversation about Comparison-Based Sorting. For which of the algorithms would you expect a multicore processor to be able to solve the problem significantly faster than a single-core processor would be able to solve it? For each of the ones that would benefit, briefly explain, in a sentence or two, why multiple cores would be beneficial. (There's no need to do any heavy-duty analysis here; we just want to see if you've got a sense of which might benefit from parallelism and why.)
Answer:
Quick sort and Merge sort supports parallelism
Explanation:
When we talk about parallelism, we are referring to the idea of breaking down a problem into a number of many subproblems after which we combine the solutions of these subproblems into a single solution. Here we allocate these subtasks to the multicore processors where each core gets assigned each of the subtasks are assigned to a core according to its ability or functionality. After each of the core are through with its evaluation, all their results are collated and combined to come up with a full rounded and complete solution to the given problem.
If we take a look at sorting algorithms such as selection sort, bubble sort and insertion sort, we will find out that these algorithms cant be simulated on a multicore processor efficiently because they are sequential algorithms.
On the other hand, we have sorting algorithms that can easily be simulated in a multicore processor since they can divide the given problem into subproblems to solve after which the solutions can be combined together to arrive at or come up with a complete solution to the problem. This algorithms includes Quick sort and Merge sort, they make use of Divide and Conquer paradigm.
How many seconds are required to make a left turn and join traffic?
How the full address space of a processor is partitioned and how each partition is used?
Answer:
?
Explanation:
?
You are planning to use Spark to create a machine learning model that recommends restaurants to users based on user details and past ratings for restaurants What is the simplest way to implement this model? Use a Logistic Regression algorithm to train a classifier. Use a K-Means algorithm to create clusters. Use an alternating least squares (ALS) algorithm to create a collaborative filtering solution. Use a Decision Trees algorithm to train a regression model.
Answer:
The third point i.e " Use an alternating least squares (ALS) algorithm to create a collaborative filtering solution" is the correct answer .
Explanation:
The Alternating Less Squares is the different approach that main objective to enhancing the loss function.The Alternating Less Squares process divided the matrix into the two factors for optimizing the loss .The divided of two factor matrix is known as item matrix or the user matrix.
As we have to build the machine learning model which proposes restaurants to restaurants that are based on the customer information and the prior restaurant reviews the alternating least squares is the best model to implement this .All the other options are not the correct model also they are not related to given scenario that's why they are incorrect options.Create two files to submit:
ItemToPurchase.java - Class definition
ShoppingCartPrinter.java - Contains main() method
Build the ItemToPurchase class with the following specifications:
Private fields
String itemName - Initialized in default constructor to "none"
int itemPrice - Initialized in default constructor to 0
int itemQuantity - Initialized in default constructor to 0
Default constructor
Public member methods (mutators & accessors)
setName() & getName()
setPrice() & getPrice()
setQuantity() & getQuantity()
(2) In main(), prompt the user for two items and create two objects of the ItemToPurchase class. Before prompting for the second item, call scnr.nextLine(); to allow the user to input a new string.
Answer:
Explanation:
public class ItemToPurchase {
private String itemName ;
private int itemPrice;
private int itemQuantity;
public ItemToPurchase(){
itemName = "none";
itemPrice = 0;
itemQuantity = 0;
}
public String getName() {
return itemName;
}
public void setName(String itemName) {
this.itemName = itemName;
}
public int getPrice() {
return itemPrice;
}
public void setPrice(int itemPrice) {
this.itemPrice = itemPrice;
}
public int getQuantity() {
return itemQuantity;
}
public void setQuantity(int itemQuantity) {
this.itemQuantity = itemQuantity;
}
}
ShoppingCartPrinter.java
import java.util.Scanner;
public class ShoppingCartPrinter {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
ItemToPurchase item1 = new ItemToPurchase();
ItemToPurchase item2 = new ItemToPurchase();
System.out.println("Item 1");
System.out.print("Enter the item name: ");
String name1 = scan.nextLine();
System.out.print("Enter the item price: ");
int price1 = scan.nextInt();
System.out.print("Enter the item quantity: ");
int quantity1 = scan.nextInt();
item1.setName(name1);
item1.setPrice(price1);
item1.setQuantity(quantity1);
scan.nextLine();
System.out.println("Item 2");
System.out.print("Enter the item name: ");
String name2 = scan.nextLine();
System.out.print("Enter the item price: ");
int price2 = scan.nextInt();
System.out.print("Enter the item quantity: ");
int quantity2 = scan.nextInt();
item2.setName(name2);
item2.setPrice(price2);
item2.setQuantity(quantity2);
System.out.println("TOTAL COST");
int item1Total = item1.getPrice() * item1.getQuantity();
int item2Total = item2.getPrice() * item2.getQuantity();
System.out.println(item1.getName()+" "+item1.getQuantity()+" for $"+item1.getPrice()+" = $"+item1Total);
System.out.println(item2.getName()+" "+item2.getQuantity()+" for $"+item2.getPrice()+" = $"+item2Total);
System.out.println();
System.out.println("Total: $"+(item1Total + item2Total));
ItemToPurchase.java
======================================================
package brainly;
//Class header definition for class ItemToPurchase
public class ItemToPurchase {
//Write the private fields
private String itemName;
private int itemPrice;
private int itemQuantity;
//Create the default constructor
//And initialize all the fields to their respective initial values
public ItemToPurchase(){
this.itemName = "none";
this.itemPrice = 0;
this.itemQuantity = 0;
}
//Create the accessor methods as follows:
public String getItemName() {
return itemName;
}
public void setItemName(String itemName) {
this.itemName = itemName;
}
public int getItemPrice() {
return itemPrice;
}
public void setItemPrice(int itemPrice) {
this.itemPrice = itemPrice;
}
public int getItemQuantity() {
return itemQuantity;
}
public void setItemQuantity(int itemQuantity) {
this.itemQuantity = itemQuantity;
}
} // End of class definition
=======================================================
ShoppingCartPrinter.java
=======================================================
package brainly;
//import the Scanner class
import java.util.Scanner;
//Class header definition for class ShoppingCartPrinter
public class ShoppingCartPrinter {
public static void main(String[] args) {
//Create an object of the Scanner class
Scanner scnr = new Scanner(System.in);
//prompt the user to enter the name of first item
System.out.println("Item 1: Enter the item name");
//Store the input in a String variable
String firstItemName = scnr.nextLine();
//Prompt the user to enter the price of the first item
System.out.println("Enter the item price");
//Store the input in an int variable
int firstItemPrice = scnr.nextInt();
//Prompt the user to enter the quantity of the first item
System.out.println("Enter the item quantity");
//Store the input in an int variable
int firstItemQuantity = scnr.nextInt();
//Call the scnr.nextLine() method to allow user enter the
// second item
scnr.nextLine();
//Prompt the user to enter the name of the second item
System.out.println("Item 2: Enter the item name");
//Store the input in a String variable
String secondItemName = scnr.nextLine();
//Prompt the user to enter the price of the second item
System.out.println("Enter the item price");
//Store the input in an int variable
int secondItemPrice = scnr.nextInt();
//Prompt the user to enter the quantity of the second item
System.out.println("Enter the item quantity");
//Store the input in an int variable
int secondItemQuantity = scnr.nextInt();
//Create the first object using the first item
ItemToPurchase item1 = new ItemToPurchase();
//Create the second object using the second item
ItemToPurchase item2 = new ItemToPurchase();
//Get the total cost of the first item
int totalcostofitem1 = firstItemPrice * firstItemQuantity;
//Get the total cost of the second item
int totalcostofitem2 = secondItemPrice * secondItemQuantity;
//Calculate total cost of the two items
int total = totalcostofitem1 + totalcostofitem2;
//Print out the result.
System.out.println("Total: $" + total);
}
}
=======================================================
Sample Output=======================================================
>> Item 1: Enter the item name
Chocolate Chips
>> Enter the item price
3
>> Enter the item quantity
1
>> Item 2: Enter the item name
Bottled Water
>> Enter the item price
1
>>Enter the item quantity
10
>>Total: $13
======================================================
Explanation:The above code has been written in Java and it contains comments explaining every line of the code. Please go through the comments carefully.
The actual lines of code are written in bold face to distinguish them from comments.
Also, in the sample output, the user inputs are written in bold face.
We have three containers whose sizes are 10 pints, 7 pints, and 4 pints, respectively. The 7-pint and 4-pint containers start out full of water, but the 10-pint container is initially empty. We are allowed one type of operation: pouring the contents of one container into another, stopping only when the source container is empty or the destination container is full. We want to know if there is a sequence of pourings that leaves exactly 2 pints in the 7-pint or 4-pint container.
(a) Model this as a graph problem: give a precise definition of the graph involved and state the specific question about this graph that needs to be answered.
(b) What algorithm should be applied to solve the problem?
(c) Find the answer by applying the algorithm.
Answer:
well, idc
Explanation:
Which body of water is most likely to be a marine ecosystem?
Answer:
The body of water that is most likely to be a marine ecosystem would be an estuary.
Explanation:
An estuary is a widened, often funnel-shaped mouth of a river, where fresh river water and salt sea water are mixed and thus brackish water is created, and where tidal differences can be observed. When a river flows as a system of branches, it is called a delta.
Estuaries often have a great natural value. They typically consist of swallows and salt marshes that are very rich in invertebrates and thus have a great attraction for birds, among other things.
mm
Donte needs to print specific sections in the workbook, as opposed to the entire workbook. Which feature should he use?
Page Setup
Backstage view
Print Area
Option
Mark this and retum
Save and Exit
Answer:
Print Area
Explanation:
First, I'll assume Donte is making use of a spreadsheet application (Microsoft Office Excel, to be precise).
From the given options, only "Print Area" fits the given description in the question.
The print area feature of the Excel software allows users to print all or selected workbook.
To print a selection section, Donte needs to follow the steps below.
Go to File -> Print.
At this stage, Donte will have the option to set the print features he needs.
Under settings, he needs to select "Print Selection"; this will enable him Print sections of the entire workbook.
Refer to attachment for further explanation
Answer:
C. print area
Explanation: