Nice shirt! In Java, write a program that uses a function that takes in the user's name and prints out compliments directed to them. The program should provide a sentinel value by asking if they've had enough compliments and will continue until they type "yes". Include 3 different compliments pulled at random and BE SURE TO USE A FUNCTION/METHOD to take in the user's name.
Sample output:
Enter your name: John Smith
John Smith, you have a great smile!
Would you like another compliment? [yes/no] yes
John Smith, you are tall and handsome!
Would you like another compliment? [yes/no] yes
John Smith, you are a quick learner!
Would you like another compliment? [yes/no] no
Have a nice day!
In: Computer Science
Instructions
Submission Guidelines
This assignment may be submitted for full credit until Friday, October 4th at 11:59pm. Late submissions will be accepted for one week past the regular submission deadline but will receive a 20pt penalty. Submit your work as a single HTML file. It is strongly recommended to submit your assignment early, in case problems arise with the submission process.
Assignment
For this assignment, you will write a timer application in HTML and JavaScript.
Your HTML document should contain the following elements/features:
Evaluation
Your assignment will be graded according to whether all the required elements are present and in the correct formats and all required functionalities are operable.
In: Computer Science
In: Computer Science
Javascript:
Create a loop that counts from 1 to 20. // If the current number is even, add it to this empty array: var myArray = []; // If the current number is odd, log an odd number warning to // the console. // However, if the number equals 19, set a debug breakpoint. // After the loop completes, print the array to the console.
var myArray = [];
for (var i = 1; i <= 20; i++) {
if (i % 2 === 1) {
console.warn("odd number");
} else {
myArray.push(i);
}
if (i === 19) {
console.debug();
}
}
console.log(myArray);
The code is not printing to my screen. help please
In: Computer Science
I wanted c++ program for the question
Problem 6 - Weighted Graph
In the vertex and edge structure defined below
Vertex Edge
Vertex
SFO 2702 BOS
SFO 1846 ORD
ORD 867
BOS
ORD 742
JFK
JFK 189
BOS
SFO 1464 DFW
DFW 802
ORD
DFW 1123 MIA
MIA 1092 JFK
MIA 1258 BOS
SFO 339
LAX
LAX 1235 DFW
LAX 2342 MIA
a) Find the shortest distance between
ORD and LAX.
b) Find the shortest distance between
JFK and SFO.
c) Find the minimum spanning tree.
In: Computer Science
For the problem below, please estimate the worst-case Running Time for a random array of size n, and prove that it is indeed ( ). Please show all your work. Just stating something like "since 2 Binary Search runs in ( ) time, our algorithm has the same runtime estimate" is not enough. A rigorous explanation is expected.
import java.util.*;
public class Main
{
static int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r - l) / 2;
// If the element is present at the middle itself
if (arr[mid] == x)
return mid;
// If element is smaller than mid, then it can only
// be present in left subarray
if (arr[mid] > x)
{ int rr= binarySearch(arr, l, mid - 1, x);
if(rr==-1)//modified
{
return binarySearch(arr, mid + 1, r, x);
}
return rr;
}
// Else the element can only be present in right
// subarray
int k =binarySearch(arr, mid + 1, r, x);
//modified part
if(k==-1)
{
return binarySearch(arr, l, mid - 1, x);
}
return k;
}
// We reach here when element is not present in array
return -1;
}
public static int FindIndex(int[] arr, int x)
{
if(arr.length==0)return -1;//if array is empty
return binarySearch(arr,0,arr.length-1,x);
}
public static void main(String[] args) {
int a[] = {3, 17, 28, 935, 1011, -10, 0, 2}
;//declaring array
int r = FindIndex(a,935);
System.out.println("index of
935:"+r);
r = FindIndex(a,-10);
System.out.println("index of
-10:"+r);
r = FindIndex(a,0);
System.out.println("index of
0:"+r);
r = FindIndex(a,1);
System.out.println("index of
1:"+r);
r = FindIndex(a,3);
System.out.println("index of
3:"+r);
r = FindIndex(a,2);
System.out.println("index of
2:"+r);
r = FindIndex(a,17);
System.out.println("index of
17:"+r);
}
}
In: Computer Science
How many types of errors can occur during the execution of a program? Discuss the circumstance when these types of errors can occur. Support your argument with examples.
In: Computer Science
A professor claimed that wire-based secure communication can be made secure using a continuum, grounded shield around the hot wire carrying the signal. He claimed that, if Eve drills a hole into the shield to probe the hot wire, Alice and Bob could detect the change of the shield resistance and uncover the eavesdropping. Consider tamper resistance. Is such secure communication unconditionally secure?
In: Computer Science
Create a python graphics of a smiley face that includes hair and eyebrows.
must start with : from graphics import * or import graphics
code must include these dimensions:
Head: Circle(Point(400,400), 200)
R Eye: Circle(Point(350,350), 20)
L Eye: Circle(Point(450,350), 20)
Mouth1: Oval(Point(300,500),Point(500,400))
Mouth2: Oval(Point(315,475), Point(485,375))
In: Computer Science
For an assignment you wrote the method sortByLargestDepth in the class QuakeSortInPlace to sort earthquakes by their depth from largest depth to smallest depth using the selection sort algorithm. Modify this method to do exactly 50 passes and then modify testSort to run this method on the file earthQuakeDataDec6sample2.atom. The file may not be completely sorted as there are more than 50 quakes in the file. After running your program of 50 Selection sort passes on this file, what is the depth of the last earthquake in the ArrayList?
In: Computer Science
Quiz
Question 1 (1 point)
What characteristic of WLAN makes it vulnerable to a different set of attacks from wired LANs?
Question 1 options:
|
WLAN often is connected to a wired LAN |
|
|
It's difficult to effectively contain the radio signals. |
|
|
WLAN is very difficult to setup and manage |
|
|
None of above |
Question 2 (1 point)
Which of the following can be categorized an integrity attack to a WLAN?
Question 2 options:
|
War driving |
|
|
Denial of service |
|
|
802.11 Frame Injection |
|
|
Radio frequency jamming |
Question 3 (1 point)
Which of following is (are) vulnerability (ies) of Bluetooth technology?
Question 3 options:
|
Encryption key length is negotiable |
|
|
No user authentication exists |
|
|
End-to-end security isn't performed |
|
|
All of above |
Question 4 (1 point)
Which of following is (are) the problem(s) of WEP?
Question 4 options:
|
Use 40 or 104 bits keys that are static and common to all users |
|
|
The encryption algorithm RC4 used in WEP is flawed |
|
|
The IV is 24bits which is too short |
|
|
All of above |
Question 5 (1 point)
In Bluetooth ________, the authentication and encryption are completely bypassed.
Question 5 options:
|
security mode 1 |
|
|
security mode 2 |
|
|
security mode 3 |
|
|
security mode 4 |
Question 6 (1 point)
VLAN creates LAN workgroups that are independent of physical locations.
Question 6 options:
|
True |
|
|
False |
Question 7 (1 point)
Which of the following is(are) common goal(s) of wireless security policy?
Question 7 options:
|
Identify required security practices and measures |
|
|
Dictate acceptable behavior and enforcement |
|
|
Serving as a vehicel for achieving consensus |
|
|
All of above |
Question 8 (1 point)
Which of the following is the most effective way to protect your wireless network
Question 8 options:
|
SSID cloaking |
|
|
MAC filitering |
|
|
Reducing the AP power level |
|
|
Using WPA2 security standard |
Question 9 (1 point)
____________ outlines the security concepts that are important to the company for managers and technical custodians.
Question 9 options:
|
Governing policy |
|
|
End-user policy |
|
|
Technical policy |
|
|
None of above |
Question 10 (1 point)
Which of following statement about VPN is FALSE?
Question 10 options:
|
It extends a private network across a public network. |
|
|
It can authenticate user |
|
|
It protects the data being transmitted using encryption |
|
|
VPN is very easy to deploy and manage |
In: Computer Science
C++
Write a program to declare an array of double of size 25, ask
the user to input all array elements from the keyboard, then write
a function named out_of_order that will test this array for the
condition a[0] >= a[1] >= a[2] >= ... > a[24]
The function returns a -1 if the elements are not out of order,
otherwise it returns the index of the first element that is out of
order. Explain what you do to avoid out of bounds array access.
In: Computer Science
Hello, I am using BASH. I need to write a conditional statement using grep. I want the computer to echo true if it detects any numerical character in the first line of StrepList.txt. However, the computer tells me that "grep: [0-9]: No such file or directory"
if (head -n 1 StrepList.txt | grep -o [0-9] -eq TRUE);then
echo "Contains numbers"
else
echo "No numbers"
fi
In: Computer Science
Using C# Design and implement a program (name it CheckPoint) that prompts the user to enter the x-coordinate then y-coordinate of a point (in a Cartesian plane) as integer values. The program prints out the entered values followed by the location of the point on the plane. The possibilities for a point are: the origin point, on the x-axis, on the y-axis, in the first quadrant, in the second quadrant, in the third quadrant, or in the fourth quadrant. Format the outputs following the sample runs below.
Sample run 1:
X-coordinate is 0
Y-coordinate is 0
(0, 0) is the origin point.
In: Computer Science
1. Introduction
This assignment will give you some experience working with C input (using scanf()) and output (using printf()), as well as arithmetic operations with variables. You will do some very basic circuit analysis, reading the values of a voltage source and three resistors, and calculating the voltage across and current through each of the resistors using three different circuit configurations.
Test cases for the program can be found at this link.
Remember, in addition to submitting your code, you MUST complete the Blackboard assignment "Program 2 style assessment" to get all of the points for this program. You can complete this "assignment" by typing a short message indicating you submitted your code through the textbook IDE.
2. Specification
Note that this specification refers to several figures, which can be found at the following link: Program 2 figures
In this program, you will deal with the three resistive circuits in Figure 1: a series circuit, a parallel circuit, and a circuit using resistors both in series and in parallel.
Those of you who are familiar with basic DC circuit analysis should be able to easily derive the voltage across and current through each resistor. For more details and equations, please see the Circuit Analysis Supplement in the Program 2 figures document.
Input Specification
Your program should prompt the user to enter the values of Vsource (in volts) and R1, R2, and R3 (in ohms). The source voltage should be entered on one line, while all three resistance values should be entered on a second line. (Note: remember, scanf() ignores whitespace when scanning numbers—you do not have to explicitly worry about varying numbers of spaces.)
The program could produce the first two lines below (the numbers are user inputs, not program outputs):
Enter voltage source value (V): 10 Enter three resistance values (ohms): 5 10 10
All input values should be treated as double-precision floating point values.
Output Specification
Once the voltage and resistance values have been read, you should print the following information for each circuit, as shown below:
See the Circuit Analysis Supplement in the Program 2 figures document for more details on determining the appropriate voltage and current through each resistor if you are unfamiliar with the analysis used. The output lines that would follow the example shown above would be:
SERIES CIRCUIT Current through circuit: 0.400000 A Voltage across R1: 2.000000 V Voltage across R2: 4.000000 V Voltage across R3: 4.000000 V PARALLEL CIRCUIT Voltage across each resistor: 10.000000 V Current through R1: 2.000000 A Current through R2: 1.000000 A Current through R3: 1.000000 A R2 & R3 IN PARALLEL Voltage across R1: 5.000000 V Current through R1: 1.000000 A Voltage across R2: 5.000000 V Current through R2: 0.500000 A Voltage across R3: 5.000000 V Current through R3: 0.500000 A
See the posted test cases for more sample program runs.
3. Hints
Order of operations
C operators follow the same order of operations you likely learned for basic arithmetic operations—multiplication and division take precedence over addition and subtraction. Parentheses have higher precedence than any of these operators. So, for example, if x = 5, y = 2, and z = 3:
Variables and expressions
Variables should be used to store values that are used more than once to avoid repeating calculations. For example, you could improve the following code by creating a variable to hold the value a + 2:
x = (a + 2) * 3; y = 5 / (a + 2); z = (a + 2) – (a + 2);
Values used only for output do not need variables, since printf() can print the value of any expression. Each of the following lines is therefore a valid use of this function. Assume you have variables int n and double x:
4. Grading Rubric
For this assignment, points are assigned as follows:
40 points: Your code uses appropriate coding style such as including appropriate comments, indenting the main() function body, and appropriate variable declarations. You must complete the Blackboard assignment "Program 2 style assessment" to earn any of these points.
60 points: Your code compiles and output matches the
desired test outputs shown below. Each test case has a different
number of points assigned to it, as shown in submit mode.
This section will be auto-graded, while I will assign the other
40 points after inspecting your program.
In: Computer Science