. Write a function that takes, as arguments, two objects, value1 and value2. If value1 and value2 are either integers or strings containing only digits, cast value1 and value2 to integers and compute their average. If their average is greater than 50, return the string “Above 50” and if the average is less than 50, return the string “Below 50”. If the average is equal to 50, return the string “Equal to 50”, and if value1 or value2 are not integers or strings containing only digits, return the string “Invalid Input”. Name this function compareToFifty(value1, value2). value1 value2 compareToFifty(value1, value2) 25 25 “Below 50” 100 “300” “Above 50” “45” “100” “Above 50” 25 75 “Equal to 50” 24.5 67 “Invalid Input” “hello” “world” “Invalid Input”
In: Computer Science
1.Discuss the interdependence that exists between DSDLC stages.
2.How does normalization eradicate update anomalies from a relation?
3.The scope of database security extends beyond just DBMS controls. Discuss the role of the database administrator in database security and recovery.
In: Computer Science
Reverse the following selection sort to sort the items from right to left by computing the max instead of min in java. (just write the algorithm)
public class Selection{
public static void sort(Comparable[] a) {
// Sort a[] into increasing order.
int N = a.length;
// array length
for (int i = 0; i < N; i++) {
// Exchange a[i] with smallest entry in a[i+1...N).
int min = i;
// index of minimal entr.
for (int j = i+1; j < N; j++)
if (less(a[j], a[min])) min = j;
exch(a, i, min);
}
}
}
In: Computer Science
identify a company that you consider as Agile and another company that is not. Explain the rationale for your selections and compare and contrast the two companies.
In: Computer Science
•Use commented pseudo-code to describe a process for each of the following:
1)Assigning a shopper to one of several checkout lines based on:
•the number of shoppers already in each line, and
•the number of items in the shopper’s cart, and
•the type of items (e.g., “Food”, “Clothing”, “Housewares”, etc.)
2)Assigning a new student into the correct desk in a room of students seated in alphabetical order
•Design classes (attributes and methods) for the following data structures:
4)Stack
5)Queue
In: Computer Science
Write in Python and as 2 seperate programs
Write a program that allows the user to enter the total rainfall for each of 12 months into a LIST. The program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest rainfall amounts. Data: January 7.9 inches February 10.1 inches March 3.4 inches April 6.7 inches May 8.9 inches June 9.4 inches July 5.9 inches August 4.1 inches September 3.7 inches October 5.1 inches November 7.2 inches December 8.3 inches
Write comments through both programs (file creation program, and display program) telling what the program is doing
In: Computer Science
Asymptotic Notation. (a) [10 pts.] Prove that n3 −91n2 −7n−14 = Ω(n3). Your answer must clearly specify the constants c and n0. (b) [10 pts.] Let g(n) = 27n2 +18n and let f(n) = 0.5n2−100. Find positive constants n0, c1 and c2 such that c1f(n) ≤ g(n) ≤ c2f(n) for all n ≥ n0. Be sure to explain how you arrived at the constants.
In: Computer Science
You are required to write an interactive program that prompts the user for seven (7) real numbers and performs the following tasks:
Program requirements:
- The program must contain at least five functions using necessary parameters. These functions should read the data, perform the above tasks, and print the results.
- The program must be fully documented.
- You must submit a properly labeled output. .
- Test your program for different values using real numbers.
Please submit with through comments & spacings/indentations from the source code.
In: Computer Science
Java Programming. I'm writing this in an IDE called Eclipse.
If you could also use comments to help me understand the code / your way of thinking, I'd highly appreciate your efforts.
This needs to use a for each loop, it will generates and return= an array of random 2-digit integers and it also needs to be printed out all on one line, separated by spaces.
Program71:
Write a program with a custom method that generates and returns an array of random 2-digit integers. The main method should prompt the user to specify the size of the array and call the custom method with this input as an argument. Use a foreach loop in main to display the integers all on one line separated by spaces.
Sample Output (user input in blue)
How many random 2-digit integers are desired?
12
Here are your integers:
43 76 22 38 64 30 87 14 55 63 35 42
In: Computer Science
Write a c++ program to load two column of numbers, do arithmetic operations to the data points by following the steps below carefully. Also we need to capture the running time in microseconds for each of these and also the time taken for basic operation.
Steps to complete.
0. Download the data file named Datafile1.data from the file area of the assignment.
1. Load two columns of data points, each column into a storage area, preferably a vector.
2. Initialize/start the clock to capture start of addition clock.
3. Add each position of the data and store it in another storage area.
4. Capture the clock for capturing time end for additions.
5. Start the clock for capturing multiplication
6. Multiply each position of the data and store it to another storage area.
7. Capture the clock for end of multiplications.
8. Print both elapsed time for addition and multiplication in microseconds.
9. Print basic operation time for addition and multiplication in microseconds.
10. Write the results of addition and multiplication to a file named Output.data
Datafile1.data
9.144548371 0.62072663
7.766500067 1.107554175
6.428523445 0.409904615
4.864271967 1.142139412
7.064106885 1.138740729
2.262955152 1.198965847
9.800966285 0.624420569
8.466914743 0.172152387
7.089199692 0.650149663
6.042680886 0.526675179
1.320701358 0.893658642
3.576178301 0.966546628
4.939756105 0.53583099
3.386905283 0.24428521
5.231554752 0.660683916
3.736280728 0.378121052
7.527971435 0.917047269
2.533630929 1.029850114
9.188222671 0.237647807
1.800088589 0.763132902
9.702171329 1.187835787
4.713240732 0.602808579
0.350114291 0.126105779
1.375572924 0.534626533
3.699384174 0.670885379
7.183110563 1.327536861
7.434890545 1.174302317
9.781202522 1.271484048
7.153021655 0.99647769
0.516259776 0.868291689
9.637573135 0.596947716
7.056519481 0.350322259
0.160533268 0.565683307
9.008315924 0.919842547
9.173718748 0.593500412
6.921833783 0.015908284
6.736418485 0.719292318
3.353631576 1.363438995
1.604967361 0.679785674
5.672035588 0.171718917
7.794867595 0.550310846
5.889160186 0.07760882
1.690701207 0.829202546
4.155650455 0.94739278
6.018503489 0.989127529
1.46468541 1.171169011
2.670443291 0.505688273
8.22853784 0.514127061
9.631840542 0.238298413
1.669453846 1.27499486
3.311515543 0.789657118
5.969493897 0.053853209
2.478574394 1.206080543
7.696244495 0.099599082
3.769765061 1.193693451
1.992200015 0.895544331
4.030882115 0.398607671
2.939993773 0.360149058
8.499182913 0.645159168
1.33467738 0.264472403
3.475730127 0.826362657
7.471431245 1.220818624
6.140279634 0.462733534
3.740656241 1.363952935
5.174154405 1.157155608
9.466008548 0.261690906
9.225005657 0.158991829
7.061522707 0.200296564
2.527050453 0.668705617
3.989058951 0.659984653
5.969333965 0.297768248
6.813173789 1.23032852
7.47467435 0.289477322
0.27004337 0.808100642
0.226724804 0.947863653
8.491775489 0.703714179
9.67169797 0.439579426
7.171630039 0.893035833
8.435125276 0.053497387
1.740878827 1.135864744
1.624571489 0.537973501
9.398492585 1.285333242
9.855769556 1.156707773
5.536670988 0.524629176
In: Computer Science
using this code under, I want when the user input only letter q an error message appears that there is no second smallest, how I can do that?
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
using namespace std;
int secondSmallestNumber(vector<int> &I);
int main() {
cout << "Enter the numbers in random order: (close by entering q)" << endl;
vector<int> I;
int input;
stringstream ss;
string str;
bool flag = false;
while (!flag) {
getline(cin, str);
ss.clear();
ss << str;
while (ss >> input || !ss.eof()) {
if (ss.fail()) {
flag = true;
break;
}
I.push_back(input);
}
}
int result;
try {
result = secondSmallestNumber(I);
cout << "The second smallest number is: " << result << endl;
}
catch (const runtime_error& e ) {
cout << "error: no second smallest" << endl;
}
return 0;
}
int secondSmallestNumber(vector<int> &I){
std::sort(I.begin(), I.end());
int number = I.at(0);
for (int i = 0; i < I.size() - 1; i++) {
if (I.at(i + 1) > number) {
return I.at(i + 1);
}
}
throw runtime_error("error");
}
In: Computer Science
1. Keeping in mind the various definitions of operating system, consider whether the operating system should include applications such as web browsers and mail programs. Argue both that it should and that it should not, and support your answers
2. How does the distinction between kernel mode and user mode function as a rudimentary form of protection (security) system?
In: Computer Science
You need to complete the methods getSmallerValue, getLargerValue, compareTo, and equals.
Code:
public class Domino implements Comparable<Domino> {
/**
* The smallest possible value for a side of a domino.
*/
public static final int MIN_VALUE = 0;
/**
* The largest possible value for a side of a domino.
*/
public static final int MAX_VALUE = 6;
/**
* The two values on the domino.
*/
private int val1;
private int val2;
public Domino() {
this(0, 0);
}
public Domino(int value1, int value2) {
if (!isValueOK(value1) || !isValueOK(value2)) {
throw new IllegalArgumentException();
}
this.val1 = value1;
this.val2 = value2;
}
public Domino(Domino other) {
this(other.val1, other.val2);
}
private static boolean isValueOK(int value) {
return value >= MIN_VALUE && value <= MAX_VALUE;
}
@Override
public int hashCode() {
return this.getSmallerValue() + 11 * this.getLargerValue();
}
@Override
public String toString() {
return "[" + this.getSmallerValue() + " : " + this.getLargerValue() + "]";
}
/*
* You need to implement the four methods below. Both compareTo and equals
* should make use of getSmallerValue and getLargerValue.
*/
public int getSmallerValue() {
}
public int getLargerValue() {
}
@Override
public int compareTo(Domino other) {
}
@Override
public boolean equals(Object obj) {
}
}
In: Computer Science
Which subnet (network address) does host 25.17.102.51 255.255.248.0 belong to?
In: Computer Science
Rotating bits in C
This rotates bits to the left which means the bits that were shifted off are then moved to the right side.
I need B5DE1FAA to become 7787EAAD
uiOrig = B5DE1FAA
k = 6
unsigned int rotateLeft(unsigned int uiOrig, int k){
}
In: Computer Science