Questions
// C++ Doubly linked list class clinknode{ friend class DList; public:     clinknode(){next = prev=0;data =0;}...

// C++ Doubly linked list

class clinknode{

friend class DList;

public:

    clinknode(){next = prev=0;data =0;}

protected:

    clinknode *next;

    clinknode *prev;

    int data;

}

class DList{

public:

DList(){first = last = 0;}

void insertFront(int key);

bool found(int key){ return search(key)!=0;}

void deleteAll(int key);

// other list functions...

private:

clinknode *search(int);

clinknode *first;

clinknode *last;

}

(20 points) Write the code for the deleteAll (int key) member function. It takes a key value and deletes all of the data in the list with that value. Make sure to preserve the integrity of the list. If no member with that value is in the list, this function should do nothing.

In: Computer Science

Can anyone use python to solve this problem: Part B: List of lists The aim of...

Can anyone use python to solve this problem:

Part B: List of lists

The aim of Part B is to learn to work with list of lists. You may want to open the file lab05b_prelim.py in the editor so that you can follow the task description. The first part of the file lab05b_prelim.py defines a variable called datasets. The variable datasets is a list of 4 lists.

This part consists of 2 tasks.

Task 1: We ask you to type the following commands in the console and observe the output. This is to get yourselves familiarised with indexing in the list of lists as well as list processing.

  1. datasets[0]
  2. datasets[2]
  3. datasets[1][3]
  4. datasets[2][6]
  5. len(datasets)
  6. max(datasets[2])
  7. len(datasets[3])

Note that list processing is covered in Week 3A's lecture. See the Python example file list_processing.py in Week 3's lecture (filed under code_prelim_3A).

Task 2:

For this task, you are asked to create a list called summary_list. The number of entries in summary_list is the same as the number of lists in the variable datasets. The entries of the list summary_list is computed as follows:

summary_list[0] = minimum value in datasets[0] / number of entries in datasets[0]

summary_list[1] = minimum value in datasets[1] / number of entries in datasets[1]

and so on.

You are asked to write the Python code to compute summary_list automatically from the variable datasets. You can complete your work in lab05b_prelim.py. Note that your code should be able to work with any variable datasets which is a list of lists of numbers. That is, if the contents of the variable datasets change, then your code should still compute the correct summary_list. You can test that by commenting/uncommenting Lines 10-15 in the file to change the number of lists within the list of lists.

In: Computer Science

Question 1: Watch the series of videos found here and hand in your responses to the...

Question 1: Watch the series of videos found here and hand in your responses to the red parts below:

https://www.youtube.com/watch?v=QSztChmDY44&list=PLaySzQJTCO1kxtP1zdoysPWoFmDHl2dLb

a. Spectroscopy (NMR, IR, Mass spec) Introduction (just watch the first 4 minutes, 45secs, the rest is an advertisement)

b. Proton NMR - How to Analyze the Peaks of H-NMR Spectroscopy (list the four factors covered in the video--i.e. the characteristics used to match the peaks to the regions of the molecule; watch the first 10 minutes, 32 seconds and move on to the next video)

c. Proton NMR Spectroscopy Analysis Using C3H7Cl (draw the H NMR spectrum and label it (hint: it corresponds to 1-chloropropane or 2-chloropropane); explain to me how symmetry, the number of types of hydrogens (peaks) and splitting patterns helped you to match the spectrum to the molecule you chose; watch the first 6 minutes, 10 seconds)

d. *H-NMR Example Matching The Molecule To The Graph (draw the H NMR spectrum, labeling the ordered peaks with integrals/heights, shifts (i.e. ppm), splitting (i.e. is it a singlet, doublet, etc. peak) and use arrows or labels to match the peaks with the corresponding H's on molecule A

e. *H-NMR Example (cont) Matching The Molecule To The Spectroscopy Graph (draw the correct H NMR spectrum, labeling the ordered peaks with integrals/heights, shifts (an estimate or range is ok), splitting (i.e. is it a singlet, doublet, etc. peak) use arrows or labels to match the peaks with the corresponding H's on molecules B, C, D, and E -

f. Degree of Unsaturation aka Index of Hydrogen Deficiency  (tell me how you can determine whether there are pi bonds/rings, how do you know how many pi bonds; also how do Oxygen, Nitrogen and Halogens change the hydrogen count; what formula can you use to account for all these effects ; watch the first 15 minutes, 15 seconds) This is going to help you draw the molecule based on the molecular formula and spectroscopy

In: Chemistry

Risk analysis is one way to monitor security in an organization. Risk analysis can be a...

Risk analysis is one way to monitor security in an organization. Risk analysis can be a time- consuming process; it involves a number
of steps, some of which require “educated guessing.” Nevertheless, the process alone raises awareness of security issues even if no immediate actions are taken as a result. The steps are:

i. Identify assets (infrastructure, people, hardware, software, reputation, etc.).

For the rest of this list, we’ll concentrate on a single asset.

ii. Determine vulnerability (what event or events might happen to the asset. For example, the building could catch fire, the website could be hacked, etc.).

For the rest of this list, we’ll concentrate on a single asset vulnerable to a single event.

ii. Estimate the probability per year of this event (based on past data, expert estimates, etc.). Take current security measures into account.

iv. Estimate the expected cost if this event occurs (cost to repair or replace, cost of lost business, etc.).

v. Compute risk exposure 5 cost estimate 3 probability estimate.

vi. Identify any additional security measure X that would help protect against this event, determine what it would cost, and do a calculation of the risk exposure with the additional security measure X in place.

vii. Do a cost-benefit analysis:
(Risk exposure without X – Risk exposure with X) − Cost of X

You have a small web-based business that uses a single server to manage your webpage and your customer information. Over the past four years, your website has been hacked and taken down twice. You estimate that the cost of this event is $600 to clean the server and reload the webpage and $12,000 in lost business while the server is down.

  1. You could purchase a backup server for a cost of $3,000, which you estimate would reduce the probability per year of losing your website to 0.2. Would this be a cost- effective security measure?

  2. What if you reevaluate the probability per year with the backup server to be 0.3. Does this change your answer?

In: Computer Science

Please included as much detail as possible, thank you! 1. List the six well-established anterior pituitary...

Please included as much detail as possible, thank you!

1. List the six well-established anterior pituitary hormones and their functions.

2. Discuss the relationships between dopamine, norepinephrine and epinephrine.

3.  List five functions of the respiratory system.   List and discuss the three physical properties of the lung that affect its function

In: Anatomy and Physiology

Use logical language Prolog. Use SWISH (SWI Prolog for Sharing) Write a Prolog program that finds...

Use logical language Prolog. Use SWISH (SWI Prolog for Sharing)

Write a Prolog program that finds the maximum of a list of numbers. Submission file should include a screenshot with tracing a program execution when a list only has 2 members and execution without tracing when a list has 8 elements.

In: Computer Science

Below are four bivariate data sets and the scatter plot for each. (Note that each scatter...

Below are four bivariate data sets and the scatter plot for each. (Note that each scatter plot is displayed on the same scale.) Each data set is made up of sample values drawn from a population.

x y
1.0 10.0
2.0 9.0
3.0 8.0
4.0 7.0
5.0 6.0
6.0 5.0
7.0 4.0
8.0 3.0
9.0 2.0
10.0 1.0

x

1

2

3

4

5

6

7

8

9

10

11

y

1

2

3

4

5

6

7

8

9

10

11

0

Figure 1
            
u v
1.0 7.3
2.0 9.1
3.0 7.2
4.0 5.3
5.0 8.0
6.0 5.2
7.0 4.2
8.0 7.1
9.0 6.2
10.0 3.6

u

1

2

3

4

5

6

7

8

9

10

11

v

1

2

3

4

5

6

7

8

9

10

11

0

Figure 2
w t
1.0 2.5
2.0 4.3
3.0 3.6
4.0 5.3
5.0 4.5
6.0 7.1
7.0 5.9
8.0 7.6
9.0 6.9
10.0 8.1

w

1

2

3

4

5

6

7

8

9

10

11

t

1

2

3

4

5

6

7

8

9

10

11

0

Figure 3
            
m n
1.0 3.8
2.0 6.7
3.0 8.0
4.0 8.8
5.0 9.6
6.0 9.8
7.0 9.0
8.0 8.0
9.0 6.7
10.0 4.0

m

1

2

3

4

5

6

7

8

9

10

11

n

1

2

3

4

5

6

7

8

9

10

11

0

Figure 4

Answer the following questions. The same response may be the correct answer for more than one question.

1. Which data set indicates the strongest negative linear relationship between its two variables? Choose onethe x, y data setthe u, v data setthe w, t data setthe m, n data set
2. In which data set is there evidence of a strong nonlinear relationship between the two variables? Choose onethe x, y data setthe u, v data setthe w, t data setthe m, n data setnone of the data sets
3. Which data set indicates a perfect positive linear relationship between its two variables? Choose onethe x, y data setthe u, v data setthe w, t data setthe m, n data setnone of the data sets
4. Which data set has an apparent positive, but not perfect, linear relationship between its two variables? Choose onethe x, y data setthe u, v data setthe w, t data setthe m, n data setnone of the data sets

In: Statistics and Probability

Data Analysis & Visualization Topic R vector and save the r code in a text file...

Data Analysis & Visualization
Topic R vector and save the r code in a text file

Problem 1.
Create two vectors named v and w with the following contents:

     v : 21,10,32,2,-3,4,5,6,7,4,-22

     w : -18,72,11,-9,10,2,34,-5,18,9,2

A) Print the length of the vectors

B) Print all elements of the vectors

C) Print elements at indices 3 through 7.

D) Print the sum of the elements in each vector.

E) Find the mean of each vector. (Use R's mean() function)

F) Sort the vectors in descending order and then print.

G) Add vectors v and w.

H) Multiply vectors v and w.

I) In vector v select all elements that are greater than zero.

J) In vector w select all elements that are less than zero.

K) Multiply each element of vector v by 6. And then print.

L) Find maximum and minimum of each vector.

M) In each vector, replace all negative values with the average of all numbers in the vector.

Problem 2.

Write a for loop to print the numbers 100, 98, 96, . . . , 4, 2.

Problem 3.
Create a data frame with the following content:

city

county

state

population

Chicago

Cook

IL

2853114

Kenosha

Kenosha

WI

90352

Aurora

Kane

IL

171782

Elgin

Kane

IL

94487

Gary

Lake(IN)

IN

102746

Joliet

Kendall

IL

106221

Naperville

DuPage

IL

147779

Arlington Heights

Cook

IL

76031

Bolingbrook

Will

IL

70834

Cicero

Cook

IL

72616

Evanston

Cook

IL

74239

Hammond

Lake(IN)

IN

83048

Palatine

Cook

IL

67232

Schaumburg

Cook

IL

75386

Skokie

Cook

IL

63348

Waukegan

Lake(IL)

IL

91452


Hint: Create vectors for each column and then create a data frame using vectors and the data.frame() function. A sample is given in the lecture notes.

city<- c("Chicago","Kenosha","Aurora","Elgin","Gary","Joliet","Naperville","Arlington Heights","Bolingbrook","Cicero","Evanston","Hammond","Palatine","Schaumburg","Skokie","Waukegan")


county<- c( "Cook", "Kenosha", "Kane", "Kane", "Lake(IN)", "Kendall", "DuPage", "Cook", "Will", "Cook", "Cook", "Lake(IN)", "Cook", "Cook", "Cook", "Lake(IL)")

state<- c( "IL", "WI", "IL", "IL", "IN", "IL", "IL", "IL", "IL", "IL", "IL", "IN", "IL", "IL", "IL", "IL")

population<-c(2853114,90352,171782,94487,102746,106221,147779,76031,70834,72616,74239,83048,67232,75386,63348,91452)

A) Print the mean of population.

B) Print the population of all cities greater than 800,000.

C) Print city, county,state and population of all cities with population less than 1,000,000.

D) Print city, county, state, and population of the most crowded city.

Hint: You can use subset() function with max() in your selection criteria in the subset() function.Then print the data in the subset.

E) Print the city and state of the least crowded city.

Hint: You can use subset() function with min() in your selection criteria in the subset() function. Then print the data in the subset.

In: Computer Science

My code works in eclipse, but not in Zybooks. I keep getting this error. Exception in...

My code works in eclipse, but not in Zybooks. I keep getting this error.

Exception in thread "main" java.util.NoSuchElementException at java.base/java.util.Scanner.throwFor(Scanner.java:937) at java.base/java.util.Scanner.next(Scanner.java:1478) at Main.main(Main.java:34)

Your output

Welcome to the food festival! Would you like to place an order?

Expected output

This test case should produce no output

in java

import java.util.Scanner;

public class Main
{
   public static void display(String menu[])
   {
       for(int i=0; i<menu.length; i++)
       {
           System.out.println (i + " - " + menu[i]);
       }
       System.out.print ("Enter the number for your selection: ");
   }


   public static void main (String[] args)
   {
     
       String mainMenu[] = {"Nothing", "Appetizer", "Main Course", "Dessert"};
       String dessertMenu[] = {"Nothing", "Chocolate Cake", "Ice Cream", "Brownie"};
       String appetizerMenu[] = {"Nothing", "Shrimp", "Bread", "Mozerella Sticks"};
       String mainCourseMenu[] = {"Nothing", "Burgers", "Fish", "Pasta"};
       String toppingsMenu[] = {"Nothing", "Cheese", "Sprinkles", "Syrup"};
    
       String list = "";
    
     
       @SuppressWarnings("resource")
   Scanner sc = new Scanner(System.in);
    
       System.out.println ("Welcome to the food festival!");
       System.out.print ("Would you like to place an order?");
       String ans = sc.next();
    
       if(ans.equals("NO"))
       {
           System.out.println ("NO:(user answered NO)");
           System.out.println ("Thank you for stopping by, maybe next time you'll sample our menu");
           return;
       }
    
       if(ans.equals("YES"))
       {
           System.out.println ("YES:(user answered YES)");
         
           System.out.print ("What is your name for the order?");
           String name = sc.next();
        
           int m, n, k;
        
        
           System.out.println ("Select from menu, " + name);
           while(true)
           {
               display(mainMenu);
            
               n = sc.nextInt();
               if(n==0) break;
               switch(n)
               {
                   case 1:
                       System.out.println ("Appetizer Menu:");
                       display(appetizerMenu);
                    
                       m = sc.nextInt();
                       list = list + "Appetizer:[" + appetizerMenu[m] + ": ";
            
                       while(true){
                           display(toppingsMenu);
                           k = sc.nextInt();
                           if(k==0) break;
                           list = list + toppingsMenu[k] + " ";
                       }
                       list = list + "]\n";
                       break;
                     
                
                   case 2:
                       System.out.println ("Main Course Menu:");
                       display(mainCourseMenu);
                    
                       m = sc.nextInt();
                       list = list + "Main Course: [" + mainCourseMenu[m] + "]\n";
            
                       break;
                   case 3:
                       System.out.println ("Dessert Menu:");
                       display(dessertMenu);
                    
                       m = sc.nextInt();
                       list = list + "Dessert: [" + dessertMenu[m] + "]\n";
            
               }
           }
       }      
           System.out.println ("Here is your order ");
           System.out.println (list);
           System.out.println ("Enjoy your meal!");
            
       }
   }

In: Computer Science

CASE INCIDENT What Should Wilma and Frank Do? Frank and Wilma Rogers live in the Toronto...

CASE INCIDENT

What Should Wilma and Frank Do?

Frank and Wilma Rogers live in the Toronto area. Frank is a product engineer in the automotive industry and Wilma is a professor for a local community college. Wilma has been working on her doctorate for the last five years and is scheduled to graduate with her PhD in Business

Administration shortly. Wilma has just received an interesting telephone call and can’t wait to talk to Frank about it.Over dinner that night Wilma tells Frank about the phone call: a past boss of hers called to tell her about an open position at a university in Nunavut. As Wilma excitedly discusses the associate professor of business position and the opportunities it will bring, Frank is thinking to himself what a great opportunity it is, but that he doesn’t find the location appealing. He subsequently tells her this and nothing more is discussed. A week goes by and Wilma still finds herself yearning to know more about this position and wanting to apply. She calls Frank and explains this to him and he encourages her to apply. Wilma calls her former boss and applies for the position. Eventually she gets an offer. Wilma gives her notice at the college and within the next six months starts her new position. Wilma moves to Nunavut, but Frank stays in Toronto until he can find a job in Nunavut. A few more months go by and Frank has not been able to find a comparable job, so he pressures Wilma to consider moving back to Toronto and leaving her new position. Wilma is torn about what to do as she loves her new job but understands why Frank is frustrated.

Questions

1.According to Edgar Schein, what career anchors are driving Wilma’s and Frank’s careers at this point?

2.If Wilma wishes to stay in her new job, how could her employer assist her with this dilemma?

3.Is there anything Frank and Wilma should have done differently in your opinion? If so, what?

In: Psychology