Implement the following function in the PyDev module functions.py and test it from a PyDev module named :
def wind_speed(speed):
"""
-------------------------------------------------------
description
Use: category = wind_speed(speed)
-------------------------------------------------------
Parameters:
speed - wind speed in km/hr (int >= 0)
Returns:
category - description of wind speed (str)
------------------------------------------------------
"""
Wind speeds are categorized as:
| Wind speed (km/h) | Category |
|---|---|
| < 39 | Breeze |
| 39 - 61 | Strong Wind |
| 62 - 88 | Gale Winds |
| 89 - 117 | Whole Gale |
| > 117 | Hurricane |
The function should return 'unknown' for a negative wind speed.
Sample testing:
Wind speed (km/h): 95 Category: Whole Gale
In: Computer Science
Implement the following function in the PyDev module functions.py and test it from a PyDev module named :
def fast_food():
"""
-------------------------------------------------------
Food order function.
Asks user for their order and if they want a combo, and if
necessary, what is the side order for the combo:
Prices:
Burger: $6.00
Wings: $8.00
Fries combo: add $1.50
Salad combo: add $2.00
Use: price = fast_food()
-------------------------------------------------------
Returns:
price - the price of one meal (float)
-------------------------------------------------------
"""
Sample testing:
Order B - burger or W - wings: B Make it a combo? (Y/N): N Price: $6.00 Order B - burger or W - wings: W Make it a combo? (Y/N): Y Add F - fries or S - salad: F Price: $9.50
In: Computer Science
The program will first prompt the user for a range of numbers. Then the game will generate a random number in that range. The program will then allow the user to guess 3 times. Each time the person takes a guess, if it is not the number then the game should tell them to guess higher or lower. They only get 3 guesses. If they have not guessed the number in three tries then the game should tell them the computer won and thank you for playing and ask them if they would like to play again. If the user wins then the game should congratulate them and ask them if they would like to play again. Each time the program repeats you should store the random number generated into an array. When the program is done the program should display the all of the random numbers back to the user.
In java language
In: Computer Science
The use of graphics and animation to inform, entertain and educate
In: Computer Science
MTN operating on a frequency of 2.3MHz aim at achieving 15Mbps of data throughput with a successful receiver interpreting an incoming signal to noise (S/N)dB = 12, 18, 25. Calculate the maximum bite rate of each S/N without using calculator explain the tradeoff factor, compare your results with the calculator results, which of this is enough for 4G which aim at achieving 14 Mbps and why?
In: Computer Science
Give a recurrence relation to find the length of the longest monotonically increasing subsequent of a array. Give the recursive algorithm based on the recurrence relation and explain the time complexity of this algorithm.
In: Computer Science
In the java programming language.
How would you find if numbers in an array element add up to a certain sum so for example if my array element consists of: INPUT: 200, 10, 50, 20 and my output asks if these elements add to: 210? YES (200+10) 260? YES (200+10+50) 30? NO What method would you suggest to look through the elements in an array (which im going to add through a text file) and determine if these sums exist in O(n^2)?
In: Computer Science
State whether each of the following is true or false. Justify your answer!
a. There are infinitely many finite languages.
b. Union of any two languages over alphabet {0, 1} is always regular.
c. The value of n3 +6n2 +5n is divisible by 6 for any integer n>0. Provide a proof.
d. Single state NFA can recognize only finite languages (languages with finitely many strings)
e. Intersection of any language and its complement is always regular.
In: Computer Science
Multiple choice
Consider the following ORACLE relations :
One (x, y) = {<2, 5>, <1, 6>, <1, 6>, <1,
6>, <4, 8>, <4, 8>}
Two (x, y) = {<2, 55>, <1, 1>, <4, 4>, <1,
6>, <4, 8>, <4, 8>, <9, 9>, <1, 6>}
Consider the following two SQL queries SQ1 and SQ2 :
SQ1 : SELECT * FROM One)
EXCEPT
(SELECT * FROM Two);
SQ2 : SELECT * FROM One)
EXCEPT ALL
(SELECT * FROM Two);
|
2 and 2 respectively |
||
|
1 and 2 respectively |
||
|
1 and 1 respectively |
||
|
2 and 1 respectively |
In: Computer Science
5. What is the Netflix churn rate and what are the reasons behind this rate?
In: Computer Science
Design a strategy that minimizes the expected number of questions you will ask in the fol- lowing game. You have a deck of cards that consists of one one, two twos, three threes, and so on up to nine nines for a total of 45 cards. Someone draws a card from the shuffled deck and looks at its value (hiding it from you). The goal is to determine the value of the card through asking a series of questions, each of which must be answerable with “yes” or “no” (such as “Is the card a nine?”).
To answer this question, you should express your strategy as a decision tree. You may either explicitly draw the decision tree or describe its construction in sufficient detail so that I could draw it from your description.
Furthermore, briefly explain why this minimizes the expected number of questions you will ask in this game. You are not required to give a formal proof.
Hint: The first question to ask in the optimal decision tree is “Is the card one of {4, 5, 9}?” Equivalently, the question can be “Is the card one of {1, 2, 3, 6, 7, 8}?”
In: Computer Science
Why is it important to include a time/date stamp in the security incident response form?
In: Computer Science
What is a sensible approach to building and validating a predictive model
In: Computer Science
//JAVA
//basic please for learning programming 2. Thank you.
Write the Class Variables
Class Box is to have the following private data members:
Write the following Overridden Method
Class Box is to have an overridden equals() method that does the
following:
Write the Get and Get Methods
Class Box is to have standard get/set methods for each data
member
Write the following Auxiliary Method
Class Box is to have an auxiliary method getVolume( ). The method
is to have an access of public and return a value of type double.
The method is to do the following:
Write the Constructors
Class Box is to have two constructors with the following
specifications:
Class: Box
Write the class header
Write the following Overridden Method
Class Box is to have an overridden toString() method that does the
following:
displays the following information in the format presented:
Height: display height of the object
Width: display the width of the object
Length: display the length of the object
Write the following application class: BoxApp.
Class BoxApp is to do the following:
Height: the value of the height property
Width: the value of the width property
Length: the value of the length property
In: Computer Science
Convert UTF-8 to UTF-16 and Back
Write two Java programs and verify that they work.
Program 1 should:
Program 2 should do the same as program 1, except program 2 goes from UTF-16 to UTF-8
Submit:
import java.io.*;
public class WriteUTF8 {
public static void main(String[] args) {
File file = new
File("utf8_output.txt");
FileOutputStream fs= null;
try {
fs = new
FileOutputStream(file);
}
catch (FileNotFoundException fnfe)
{
System.err.println("file not found");
}
try {
fs.write("Фёдор".getBytes("UTF-8"));
fs.close();
}
catch(IOException ioe){
System.err.println("unable to write to file");
}
}
}
---
import java.io.*;
public class WriteUTF16 {
public static void main(String[] args) {
File file = new
File("utf16_output.txt");
FileOutputStream fs= null;
try {
fs = new
FileOutputStream(file);
}
catch (FileNotFoundException fnfe)
{
System.err.println("file not found");
}
try {
fs.write("Фёдор".getBytes("UTF-16"));
fs.close();
}
catch(IOException ioe){
System.err.println("unable to write to file");
}
}
}
--
In: Computer Science