Questions
Define the exception class called TornadoException. The class should have two constructors including one default constructor....

Define the exception class called TornadoException. The class should have two constructors including one default constructor. If the exception is thrown with the default constructor, the method getMessage should return "Tornado: Take cover immediately!" The other constructor has a single parameter, m, of int type. If the exception is thrown with this constructor, the getMessage should return "Tornado: m miles away; and approaching!" Write a Java program to test the class TornadoException.

In: Computer Science

Problem: Write a Python module (a text file containing valid Python code) named p5.py. This file...

Problem: Write a Python module (a text file containing valid Python code) named p5.py. This file must satisfy the following.

Define a function named rinsert. This function will accept two arguments, the first a list of items to be sorted and the second an integer value in the range 0 to the length of the list, minus 1. This function shall insert the element corresponding to the second parameter into the presumably sorted list from position 0 to one less than the second parameter’s index.

Define a function named rinsort. This function will accept two arguments, the first a list of items to be sorted and the second an integer value in the range 0 to the length of the list, minus 1. This function shall sort the elements of the list from position 0 to the position corresponding to the second parameter, in ascending order using insertion sort. This function must be recursive.

It is highly recommended that you thoroughly test your module. This will mean writing code that exercises your module’s contents by setting up a suitable list or lists of parameters, importing your p5.py file and then looping through the test cases. You do not need to submit your test code. You should treat a negative second parameter in either rinsert or rinsort as an error, and a second parameter past the end of the list as an error.

In: Computer Science

40.0 mL of 0.10 M HA(aq) was titrated against 0.10 M NaOH(aq). HA (aq) is a...

40.0 mL of 0.10 M HA(aq) was titrated against 0.10 M NaOH(aq). HA (aq) is a weak acid with Kaof 6.3 x 10^-6.

            (a)        Calculate the initial pH of the 0.10 M HA (i.e. before adding NaOH).

            (b)        Calculate the pH at the equivalence point.

In: Chemistry

language c++ finish the code and hurry in an exam with less then 30 minutes #include...

language c++ finish the code and hurry in an exam with less then 30 minutes

#include <iostream>

#include <vector>

using namespace std;

int find(vector<int> & v, int value);

int main(){

vector<int> myVec = {2,30,10,50,100,32,19,43, 201, 311, 99,77,45,15,95, 105, 32, 15};

//complete code here

cout << "First Element is: " << endl;

cout << "Last Element is: " << endl;

cout << "The number of elements is: " << endl;

  

//Complete the missing code

cout << "Find 201 : result is at index " << endl;

cout << "Find 299 : result is at index " << endl;

  

return 0;

  

}

int find(vector<int> & v, int value){

//complete the code here

  

return -1;

}

  

  

  

  

return 0;

}

output should be like this

first element is : 2

Last element is :15

the number of element is :18

write a function find that takes in the vector and the value you would like to find

int find(vector<int)> & v, int value)

find 201: result is at index 8

find 299: result is at index -1

In: Computer Science

Was the social skills rating system analyzed for differential validity across groups? How was this analysis...

Was the social skills rating system analyzed for differential validity across groups? How was this analysis conducted?

In: Psychology

Use the Conflict Lens Model to explain an organizational conflict you either experienced firsthand or witnessed....

Use the Conflict Lens Model to explain an organizational conflict you either experienced firsthand or witnessed. Include some of the Lens' scale in your response as you describe the behaviors of the conflict participants.

In the end, was the outcome constructive or destructive? Why? Finally, do you think the participants' cultural history influenced the outcome? Why or why not?

Read the in class handouts and explain a conflict of your choice inter-personal (micro) or national (macro) level. Apply the 10 Strategies and explain the outcomes of each?

In: Psychology

“Sticks and stones may break my bones, but names will never hurt me.” We know that...

“Sticks and stones may break my bones, but names will never hurt me.” We know that words can indeed be hurtful. Describe an experience when someone’s (or your) use of a word or language was offensive and how it made you/others feel. Alternately, share an instance when someone’s words made you feel loved, accepted, relaxed, etc.

1. Describe the negative experience and the feelings surrounding it.
2. Describe the positive experience and the feelings surrounding it.
3. Explain ways you can effectively deal with being offended by someone’s use of a word?
4. Is it ethical to correct someone when s/he uses sexist language or makes a stereotypical remark about someone’s ethnicity, gender or sexual orientation? What if that person is your boss or teacher? Explain your response.

In: Psychology

Description of cystic fibrosis? What has changed in cystic fibrosis to allow it to cause a...

Description of cystic fibrosis?

What has changed in cystic fibrosis to allow it to cause a genetic disorder? Explain how this differs from the gene's normal function.Is it possible for parents to not have the disorder, but pass it on to their children?

What kind of dominance pattern does cystic fibrosis show?

What problem(s) is/are caused to a person who inherits the cystic fibrosis gene? Is this typically inherited from the mother or the father?

Describe an experiment that you could use to determine if a new drug is effective at treating cystic fibrosis. Be sure to mention the independent, dependent and control variables.

How you could use the scientific method to draw conclusions about cystic fibrosis or to treat this disorder?

In: Biology

1.) What do you think is being suggested in the writings “Art of Learning” and “Sacred...


1.) What do you think is being suggested in the writings “Art of Learning” and “Sacred Myth” about the difficulties of living an authentic, meaningful life? How do the ideas presented in these writings correspond with some of the ideas in The Five Stages of the Soul and chapter one in William Young's text? How would you relate or apply the ideas in these writings to your own life experiences?

2.) In what sense might Gilgamesh's quest be understood as a religious or "spiritual" quest? How does Gilgamesh's story correspond with the Five Stages of the Soul (Call, Search, Struggle, Breakthrough, Return)? The stage of the Struggle often involves people trying to discourage the Hero from continuing on the quest. What obstacles does Gilgamesh encounter on his quest to find immortality? In losing the plant, Gilgamesh loses immortality. What wisdom does he possibly gain in its place?

3.) Based on chapter two in Young's text answer the following questions in your essay: What does Young mean when he writes, "For indigenous people, all life is spiritual"? Discuss the importance of harmony, balance, and community in indigenous religions. Make sure to provide at least 2 or 3 examples.

In: Psychology

What will you still owe after the 13th year of a 15-year, $450,000 mortgage at 4.35%...

What will you still owe after the 13th year of a 15-year, $450,000 mortgage at 4.35% APR if you only make the minimum monthly payments?

A. $77,826

B. $114,827

C. $791,338

D. $78,201

Please work out the problem!

In: Finance

Assignment Purpose The purpose of this lab is to write a well commented java program that...

Assignment Purpose

The purpose of this lab is to write a well commented java program that demonstrates the use of one dimensional arrays and methods.

Instructions

  1. Write a method rotateArray that is passed to an array, x, of integers (minimum 7 numbers) and an integer rotation count, n. x is an array filled with randomly generated integers between 1 and 100.
  2. The method creates a new array with the items of x moved forward by n Elements that are rotated off the array will appear at the end. Forward rotation means moving elements from right to left on paper. For example, suppose x contains the following items in sequence:

1 2 3 4 5 6 7 and the value of n = 3

  1. Your program should first calculate the sum of numbers at even indexes (consider 0 as even) which in this case is 1 + 3 + 5 + 7 = 16, and then average of numbers at odd indexes which in this case is (2 + 4 + 6) / 3 = 4.
  2. After that it should make a call to rotateArray with arguments as x and n.

Sample output

-----------------------Output Begins-------------------------

The randomly generated integers in array are: 1 2 3 4 5 6 7

Sum of numbers at even indexes = 16

Average of numbers at odd indexes = 4

Enter rotation count: 3

Calling rotateArray with rotation count as 3………

After 1st rotation the array contents are         2 3 4 5 6 7 1

After 2nd rotation the array contents are        3 4 5 6 7 1 2

After 3rd rotation the array contents are        4 5 6 7 1 2 3

-----------------------End of Output----------------------------

So after rotating by 3, the elements in the new array will appear in this sequence:

4 5 6 7 1 2 3

In: Computer Science

Originally, light is unpolarized. It then travels through 3 polarizers: the first with its transmission axis...

Originally, light is unpolarized. It then travels through 3 polarizers: the first with its transmission axis aligned vertical, the next at a 30 degree angle to the vertical and the last aligned at a 45 degree angle to the vertical (tilted the same direction as the first with respect to the vertical). The original intensity of light is 4 W/m2.

1-What is the intensity of light after the second polarizer?

2-What is the intensity of light after the third polarizer?

3-If the second polarizer is aligned at a 45 degree angle to the vertical (just like the third), what is the final intensity of light after the third polarizer?

4- If the second polarizer is aligned at a 45 degree angle to the vertical (but in the other direction), what is the final intensity of light after the third polarizer?

In: Physics

For simplicity, you can consider DNA sequences as strings in the alphabet of {A, C, G,...

For simplicity, you can consider DNA sequences as strings in the alphabet of {A, C, G, T}. Implement a special hash table to store all short DNA segments of certain length (e.g., 20) found in a long DNA sequence. Every DNA segment is stored as a (key, value) pair, where the key is the sequence of the segment, and the value is the position of the segment in the DNA. For example given a DNA sequence of ACGTACGTTT, there are 3 segments of length 8, so the corresponding (key, value) pairs are: (ACGTACGT, 0), (CGTACGTT, 1), and (GTACGTTT, 2). Use open hash table for this challenge. DNA segments with different keys may be hashed to the same slot (collision) and if it happens, all these DNA segments will be put in a linked list in the corresponding slot. If the keys are of length 20, there will be a total of different DNA segments of 20 letters. A hash table with these many slots can be very sparse (many slots won't be occupied). To avoid this problem, you will use a hash function that computes the index for each key only based on the first few letters, e.g., the first 4 letters in each key. There are a total of unique DNA segments with 4 letters: AAAA, CAAA, GAAA, TAAA, ACAA, CCAA, GCAA, .... and TTTT, so any function that maps each of these segments into a unique integer (in the range of [0,255]) will work well as a hash function for a hash table that stores the DNA segments. Given the length of DNA segments and the number of letters used for hashing, and a DNA sequence, your program needs to compute the number of slots needed for the hash table, and the number of slots that are filled (non-empty) after putting the segments from the given DNA into the table.

Sample Input 0

8 4
ACGTACGTAC

Sample Output 0

256 3

Explanation 0

In this case, n = 8 and k = 4. The input DNA is ACGTACGTAC so there are three (key, value) pairs: ("ACGTACGT", 0), ("CGTACGTA", 1), and ("GTACGTAC", 2). As the hash function computes the index based on the first four (k=4) letters of each key, and there are a total of  (256) diffent combinations of four letters, the hash table only needs 256 slots. Out of the 256 slots, only three are occupied.

In Java Please

In: Computer Science

Java Questions involving OOP: (Include java coding examples if possible) (1) What is an exception type...

Java Questions involving OOP:

(Include java coding examples if possible)

(1) What is an exception type an instance of?

(2) What are the conditions when a class implements an interface?

(3) What is/are the conditions of creating an abstract class object from its derived concrete class?

In: Computer Science

Five processes A, B, C, D, E arrive at the same time in this order ($A$...

Five processes A, B, C, D, E arrive at the same time in this order ($A$ first, $E$ last).
They have estimated services times of 12u, 8u, 10u, 6u, 4u, where u is some unit of time.

(a) Show the scheduling order under
First-Come-First-Served (FCFS), Shortest Process Next (SPN),
Shortest Remaining Time (SRT) next, Round-Robin with quantum of 2u (RR2).

Note: Write BCADE to indicate the order of execution if you believe that B executes first, then C, then A, etc.

The problem continues with the following two questions.

(b) (2pt) What is the turnaround time for processes A and E under RR?


(c)   (3pt) What is the wait time spent on the ready queue for processes B, C, and D?

In: Computer Science