Questions
Write a simple Python program that will generate two random between 1 and 6 ( 1...

Write a simple Python program that will generate two random between 1 and 6 ( 1 and 6 are included).

If the sum of the number is grader or equal to 10 programs will display “ YOU WON!!!”. if the sum is less than 10, it will display “YOU LOST”.

After this massage program will ask users a question: “if you want to play again enter Y. if you want to exit enter ‘N’)

If the user enters Y they will continue to play and if they enter N the program terminates.

In: Computer Science

A medical statistician wanted to examine the relationship between the amount of sunshine (x) and incidence...

  1. A medical statistician wanted to examine the relationship between the amount of sunshine (x) and incidence of skin cancer (y). As an experiment he found the number of skin cancers detected per 100,000 of population and the average daily sunshine in eight counties around the country. These data are shown below.

Average Daily Sunshine

5

7

6

7

8

6

4

3

Skin Cancer per 100,000

7

11

9

12

15

10

7

5

  1. Find the least squares regression line.
  2. Draw a scatter diagram of the data and plot the least squares regression line on it.
  3. Calculate the coefficient of determination and interpret it.
  4. Calculate the coefficient of correlation and what does the coefficient of correlation calculated tell you about the direction and strength of the relationship between the two variables?

In: Statistics and Probability

1 Problem Description This lab will cover a new topic: linked lists. The basic idea of...

1 Problem Description

This lab will cover a new topic: linked lists. The basic idea of a linked list is that an address or a pointer value to one object is stored within another object. By following the address or pointer value (also called a link), we may go from one object to another object. Understanding the pointer concept (which has be emphasized in previous labs and assignments) is crucial in understanding how a linked list operates.

Your task will be to add some code to manipulate the list.

2 Purpose

Understand the concept of linked lists, links or pointers, and how to modify a linked list.

3 Design

A very simple design of a node structure and the associated linked list is provided lab7.cpp. Here is the declaration:

typedef int element_type; 

struct Node 

{ 

    element_type elem; 

    Node * next;

    Node * prev; // not used for this lab 

}; 

Node * head; 

NOTE: A struct is conceptually the same thing as a class. The only significant difference is that every item (each method and data field) is public. Structs are often used as simple storage containers, while classes encompass complex data and methods on that data. Nodes of a linked list are good examples of where a struct would be useful.

Since head is a pointer that points to an object of type Node, head->elem ( or (*head).elem ) refers to the elem field. Similarly, head->next refers to the next field, the value of which is a pointer and may point to another node. Thus, we are creating a chain of Nodes. Each node points to the next Node in the chain.

Note that in our program head should always points to the first node of the linked list. For a linked list that has no elements (an empty list), the value of head is NULL. When working with linked lists, it is usually helpful to draw them out in order to understand their operation.

4 Implementation

Note that this file contains a show() function that will display the contents of a linked list in order. As with previous labs, you must call show() after each of the following steps.

  1. Remove the first element from the linked list. Make sure to free the space for the Node correctly, and make sure that head is now pointing to the correct node in the list. When your code is working, you should see the node sequence [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15].
  2. Remove the last element from the list, assuming that we do not know how many nodes are in the linked list initially. Make sure to free the space and set the pointers correctly. Hint: we need to traverse the list to find the second to last Node. Once we have the pointer to that node we can safely remove the last node. One way to accomplish this is to store both a current pointer that points to the current node in the chain, and a previous pointer that points to the node containing the last element we saw. The previous pointer follows the current pointer through the list. When your code is working, you should see the node sequence [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14].
  3. Insert ten elements (0 to 9 for element values) to the beginning of the current linked list, each being placed at the beginning. You must use a loop here (so we can easily change the action to insert 1000 elements (0 to 999) for instance). When your code is working, you should see the node sequence [9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]. The basic procedure is to create a new node, set its next pointer to the head of the list, and then move the head to your new node.
  4. Insert ten elements (0 to 9 for element values) after the first node having value 7 in the current linked list. You will need to loop through the list to find the node that has 7 (again, do not assume you know where the 7 is. You should search for it.) Once you find the correct starting point, you will need to integrate your new nodes into the list one at a time. When your code is working, you should see the node sequence [9, 8, 7, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]. One possible procedure will be to first get the node after 7 (e.g. the first node containing a 6, note that current points to the node of 7 in the search is assumed in the following), and make variable “end” points to the node. Create a new node with proper value, set this node's next to the end (node 6), set current's next to the new node. Depending on the order of inserting these values, we may either update end so that it points to the new node or move current so that it points to the new node. Then repeat creating a new node action.

Please write in C++

Basic Linked Lists Starter Code:

#include <cstdlib>
#include <iostream>

using namespace std;

// Data element type, for now it is int, but we could change it to anything else
// by just changing this line
typedef int element_type;

// Basic Node structure
struct Node
{
    element_type elem;  // Data
    Node * next;        // Pointer to the next node in the chain
    Node * prev;        // Pointer to the previous node in the chain, not used for lab 7
};

// Print details about the given list, one Node per line
void show(Node* head)
{
    Node* current = head;
    
    if (current == NULL)
        cout << "It is an empty list!" << endl;
    
    int i = 0;
    while (current != NULL) 
    {
        cout << "Node " << i << "\tElem: " << '\t' << current->elem << "\tAddress: " << current << "\tNext Address: " << current->next << endl;
        current = current->next;
        i++;
    }
    
    cout << "----------------------------------------------------------------------" << endl;
}

int main() 
{
    const int size = 15;

    Node* head    = new Node();
    Node* current = head;

    // Create a linked list from the nodes
    for (int i = 0; i < size; i++)
    {
        current->elem = i;
        current->next = new Node();
        current       = current->next;
    }
    
    // Set the properties of the last Node (including setting 'next' to NULL)
    current->elem = size;
    current->next = NULL;
    show(head);

    // TODO: Your Code Here Please use show(head); after completing each step.
STEP 1:


STEP 2:


STEP3:    


STEP 4:

    // Clean up
    current = head;
    while (current != NULL)
    {
        Node* next = current->next;
        delete current;
        current = next;
    }
    
    return 0;
}

In: Computer Science

use formulas to solve the problems 7. Your financial objective is to have $3,000,000 upon your...

use formulas to solve the problems

7. Your financial objective is to have $3,000,000 upon your retirement 40 years from now. If you have committed to make an equal annual deposit into an investment account that provides 9 percent annual return, how much will the annual deposit be?

8. If you invest $30,000 a year, every year in an account that earns 8 percent annual return, how long will it take for the balance in the account to reach $2,000,000?

In: Finance

Consider the following contingency table of observed frequencies. Complete parts a. through d. below. Column Variable...

Consider the following contingency table of observed frequencies. Complete parts a. through d. below.

Column Variable

Row Variable

C1

C2

C3

R1

7

6

9

R2

11

9

8

a. Identify the null and alternative hypotheses for a​ chi-square test of independence with based on the information in the table. This test will have a significance level of

α=0.05.

Choose the correct answer below.

A.

H0​:

The variables

R1​,

R2​,

C1​,

C2​,

and

C3

are independent.

H1​:

At least one of the variables is not independent.

B.

H0​:

The row and column variables are independent of one another.

H1​:

The row and column variables are not independent of one another.Your answer is correct.

C.

H0​:

The row and column variables are not independent of one another.

H1​:

The row and column variables are independent of one another.

D.

H0​:

The variables

R1​,

R2​,

C1​,

C2​,

and

C3

are independent.

H1​:

None of the variables are independent.

​b, Calculate the expected frequencies for each cell in the contingency table.

Column Variable

Row Variable

C1

C2

C3

R1

nothing

nothing

nothing

R2

nothing

nothing

nothing

​(Round to two decimal places as​ needed.)

In: Economics

The tertiary education advisory board is interested in current attitudes within society toward gaining a university...

The tertiary education advisory board is interested in current attitudes within society toward gaining a university qualification. The advisory board believes that a person’s attitude toward university qualifications will be influenced by their age. The variables to use in answering this question are Age (i.e. 18-38, 39-59 or 60+), and Attitude (i.e. a person’s attitude toward gaining a university qualification). Attitude was measured on a seven-point semantic differential scale that was anchored 1=not at all important to 7=very important. Is there a relationship between age and attitude toward gaining a university qualification? - Chi-square test for independence because we want to identify the relationship between two categorical variables row 1(going down): Age Row 2 (going down): Attitude
The tertiary education advisory board is interested in current
attitudes within society toward gaining a university qualification.
The advisory board believes that a person’s attitude toward
university qualifications will be influenced by their age. The
variables to use in answering this question are Age (i.e. 18-38,
39-59 or 60+), and Attitude (i.e. a person’s attitude toward
gaining a university qualification). Attitude was measured on a
seven-point semantic differential scale that was anchored 1=not at
all important to 7=very important. Is there a relationship between
age and attitude toward gaining a university qualification? -
Chi-square test for independence because we want to identify the
relationship between two categorical variables row 1(going down):
Age Row 2 (going down): Attitude
2   6
2   6
2   7
2   1
2   7
2   7
2   6
2   7
2   1
2   7
2   1
2   7
2   6
2   6
2   5
2   6
2   7
2   7
2   7
2   6
2   6
2   6
2   6
2   6
2   6
2   6
2   7
2   6
2   7
2   7
2   7
2   7
2   7
2   6
2   6
2   7
2   6
2   1
2   7
2   7
2   7
2   6
2   6
2   1
2   7
2   6
2   7
2   6
2   7
2   6
2   6
2   7
2   6
2   7
2   6
2   7
2   1
2   6
2   6
2   1
1   6
1   6
1   7
1   7
1   7
1   6
1   7
1   7
1   7
1   6
1   1
1   1
1   1
1   6
1   7
1   7
1   7
1   6
1   7
1   7
1   7
1   6
1   7
1   6
1   1
1   7
1   5
1   6
1   7
1   6
1   7
1   6
1   5
1   7
1   1
1   7
1   6
1   7
1   7
1   7
1   6
1   7
1   7
1   7
1   7
1   1
1   5
1   6
1   1
1   7
1   5
1   6
1   7
1   6
1   7
1   6
1   6
1   7
1   7
1   6
3   7
3   1
3   6
3   6
3   6
3   1
3   6
3   1
3   7
3   6
3   1
3   1
3   6
3   7
3   6
3   1
3   6
3   1
3   6
3   6
3   6
3   1
3   6
3   6
3   1
3   7
3   1
3   7
3   1
3   7
3   1
3   6
3   1
3   1
3   6
3   6
3   7
3   1
3   6
3   1
3   6
3   7
3   1
3   6
3   6
3   1
3   1
3   1
3   6
3   6
3   7
3   1
3   7
3   6
3   1
3   1
3   1
3   1
3   6
3   1

In: Statistics and Probability

A potato chip company claims that their chips have 130 calories per serving. We think this...

A potato chip company claims that their chips have 130 calories per serving. We think this claim is too low, so we buy 40 bags of chips and test the calories per stated serving size.  Our sample yields a mean of 132 calories per serving, with a standard deviation of 6 calories. Is the manufacturer's claim too low? \

Use alpha = 0.05.

In: Statistics and Probability

A hockey puck (1) of mass 130 g is shot west at a speed of 8.40...

A hockey puck (1) of mass 130 g is shot west at a speed of 8.40 m/s. It strikes a second puck (2), initially at rest, of mass 124 g. As a result of the collision, the first puck (1) is deflected at an angle of 32° north of west and the second puck (2) moves at an angle of 40° south of west. What is the magnitude of the velocity of puck (1) after the collision?

In: Physics

Question 4: Using _______________________, you will ping sweep 5 targets. fping -g 172.217.4.36 172.217.4.40 fping -g...

Question 4: Using _______________________, you will ping sweep 5 targets.

  1. fping -g 172.217.4.36 172.217.4.40
  2. fping -g 172.217.4.36-40
  3. fping -g 172.217.4.36-5
  4. All of the above

Question 5: The following is not a valid Fping command.
                       Note: This question is about the Fping utility.

  1. fping -g 172.217.4.3 172.217.4.10
  2. fping -g 192.168.1.0/24
  3. fping -g 139.67.8.128-130
  4. None of the above

In: Computer Science

Toby wants to calculate her COGS for a fertilizing job she did last week. She used...

Toby wants to calculate her COGS for a fertilizing job she did last week. She used 40 pounds of fertilizer that she bought in bulk ($1,000 for 2,000 pounds). It took her employee 1.5 hours to spread the fertilizer (she is paid $15/hour) with the motorized spreader. Toby paid $4,000 for the spreader three years ago and it is estimated to last 10 years or 10,000 pounds. To get to the job site, a company truck and trailer was used (cost: $40,000 expected to last 10 years or 200,000 miles, the site visit was 30 miles round trip). This was the only use of the truck, trailer, and spreader for that day. Additional employee costs include 10% payroll tax and $730 per year in worker’s compensation insurance. You may assume an employee works 2000 hours per year.

Construct a balance sheet and income statement and include calculations done by formula within Excel (include cell references). Separate and label the parts of the calculation as Direct Material (DM), Direct Labor (DL), or Overhead (OH). Please make two calculations comparing the straight-line depreciation method with the units of production method.

In: Accounting