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
|
Average Daily Sunshine |
5 |
7 |
6 |
7 |
8 |
6 |
4 |
3 |
|
Skin Cancer per 100,000 |
7 |
11 |
9 |
12 |
15 |
10 |
7 |
5 |
In: Statistics and Probability
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.
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 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
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 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 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 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.
Question 5: The following is not a valid Fping
command.
Note:
This question is about the Fping utility.
In: Computer Science
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