Question(on Python). There is a Python program what could solve the simple slide puzzles problem by A* algorithm. Please fill in the body of the a_star() function.
In order to solve a specific problem, the a_star function needs to know the problem's start state, the desired goal state, and a function that expands a given node. To be precise, this function receives as its input the current state and the goal state and returns a list of pairs of the form (new_state, h'-score). There is exactly one such pair for each of the possible moves in the current state, with new_state being the state resulting from that move, paired with its h'-score. Note that this is not the f'-score but the h'-score, i.e., an (optimistic) estimate of the number of moves needed to reach the goal from the current state. The expand function does not know g’and therefore cannot compute f'; this has to be done by the a_star function.
The a_star function calls the expand function (in this context,
slide_expand) in order to expand a node in the search tree, i.e.,
obtain the states that can be reached from the current one and
their h’-scores. Again, please note that these are not f’-scores
but h’-scores;
a_star needs to compute the h’-scores for sorting the list of open
nodes. Also, note that slide_expand does not (and cannot) check
whether it is creating a search cycle, i.e., whether it generates a
state that is identical to one of its ancestors; this has to be
done by a_star. The given slide_expand function uses the same
scoring function as discussed in class – it simply counts the
number of mismatched tiles (excluding the empty tile).
Please add code to the a_star function so that slide_solver can find an optimal solution for Example #1 and, in principle, for any slide puzzle. You are not allowed to modify any code outside of the a_star function. Hints: It is best to not use recursion in a_star but rather a loop that expands the next node, prevents any cycles in the search tree, sorts the list of open nodes by their scores, etc., until it finds a solution or determines that there is no solution. It is also a good idea to keep a list of ancestors for every node on the list, i.e., the list of states from the start that the algorithm went through in order to reach this node. When a goal state is reached, this list of ancestors for this node can be returned as the solution.
A_Star.py
import numpy as np
example_1_start = np.array([[2, 8, 3],
[1, 6, 4],
[7, 0, 5]])
example_1_goal = np.array([[1, 2, 3],
[8, 0, 4],
[7, 6, 5]])
example_2_start = np.array([[ 2, 6, 4, 8],
[ 5, 11, 3, 12],
[ 7, 0, 1, 15],
[10, 9, 13, 14]])
example_2_goal = np.array([[ 1, 2, 3, 4],
[ 5, 6, 7, 8],
[ 9, 10, 11, 12],
[13, 14, 15, 0]])
# For a given current state, move, and goal, compute the new state and its h'-score and return them as a pair.
def make_node(state, row_from, col_from, row_to, col_to, goal):
# Create the new state that results from playing the current move.
(height, width) = state.shape
new_state = np.copy(state)
new_state[row_to, col_to] = new_state[row_from, col_from]
new_state[row_from, col_from] = 0
# Count the mismatched numbers and use this value as the h'-score (estimated number of moves needed to reach the goal).
mismatch_count = 0
for i in range(height):
for j in range(width):
if new_state[i ,j] > 0 and new_state[i, j] != goal[i, j]:
mismatch_count += 1
return (new_state, mismatch_count)
# For given current state and goal state, create all states that can be reached from the current state
# (i.e., expand the current node in the search tree) and return a list that contains a pair (state, h'-score)
# for each of these states.
def slide_expand(state, goal):
node_list = []
(height, width) = state.shape
(empty_row, empty_col) = np.argwhere(state == 0)[0] # Find the position of the empty tile
# Based on the positin of the empty tile, find all possible moves and add a pair (new_state, h'-score)
# for each of them.
if empty_row > 0:
node_list.append(make_node(state, empty_row - 1, empty_col, empty_row, empty_col, goal))
if empty_row < height - 1:
node_list.append(make_node(state, empty_row + 1, empty_col, empty_row, empty_col, goal))
if empty_col > 0:
node_list.append(make_node(state, empty_row, empty_col - 1, empty_row, empty_col, goal))
if empty_col < width - 1:
node_list.append(make_node(state, empty_row, empty_col + 1, empty_row, empty_col, goal))
return node_list
# TO DO: Return either the solution as a list of states from start to goal or [] if there is no solution.
def a_star(start, goal, expand):
return []
# Find and print a solution for a given slide puzzle, i.e., the states we need to go through
# in order to get from the start state to the goal state.
def slide_solver(start, goal):
solution = a_star(start, goal, slide_expand)
if not solution:
print('This puzzle has no solution. Please stop trying to fool me.')
return
(height, width) = start.shape
if height * width >= 10: # If numbers can have two digits, more space is needed for printing
digits = 2
else:
digits = 1
horizLine = ('+' + '-' * (digits + 2)) * width + '+'
for step in range(len(solution)):
state = solution[step]
for row in range(height):
print(horizLine)
for col in range(width):
print('| %*d'%(digits, state[row, col]), end=' ')
print('|')
print(horizLine)
if step < len(solution) - 1:
space = ' ' * (width * (digits + 3) // 2)
print(space + '|')
print(space + 'V')
slide_solver(example_1_start, example_1_goal) # Find solution to example_1
In: Computer Science
In: Math
JAVA
How to make a graph class that uses a linked list class to store nodes and linked list within each node to store adjacency list
The linked list class has been made already.
import java.util.*;
public class LinkedList implements Iterable
{
private int size = 0;
private Node head;
private Node tail;
private class Node
{
private T data;
private Node prev;
private Node next;
public Node(T data)
{
this.data = data;
}
}
public Iterator iterator()
{
return new LinkedListIterator(this);
}
private class LinkedListIterator implements Iterator
{
private Node iterNext;
public LinkedListIterator(LinkedList theList)
{
iterNext = theList.head;
}
public boolean hasNext()
{
return (iterNext != null);
}
public T next()
{
T value;
if (iterNext == null)
{
value = null;
}
else
{
value = iterNext.data;
iterNext = iterNext.next;
}
return value;
}
public void remove()
{
throw new UnsupportedOperationException("Not supported");
}
}
public void insertFirst(T value)
{
Node nodeVal = new Node(value);
if(isEmpty())
{
nodeVal.next = null;
nodeVal.prev = null;
head = nodeVal;
tail = nodeVal;
size++;
}
else
{
nodeVal.next = head;
nodeVal.prev = null;
head.prev = nodeVal;
head = nodeVal;
size++;
}
}
public void insertLast(T value)
{
Node nodeVal = new Node(value);
if (isEmpty())
{
nodeVal.next = null;
nodeVal.prev = null;
head = nodeVal;
tail = nodeVal;
size++;
}
else
{
tail.next = nodeVal;
nodeVal.next = null;
nodeVal.prev = tail;
tail = nodeVal;
size++;
}
}
public int size()
{
return size;
}
public boolean isEmpty()
{
return size() == 0;
}
public Node deleteFirst()
{
Node returnVal;
if (isEmpty())
{
throw new RuntimeException("Empty list");
}
else
{
Node temp = head;
returnVal = head;
head = temp.next;
head.prev = null;
size--;
}
return returnVal;
}
public Node deleteLast()
{
Node returnVal;
if (isEmpty())
{
throw new RuntimeException("Empty list");
}
else
{
Node temp = tail;
returnVal = tail;
tail = temp.prev;
tail.next = null;
size--;
}
return returnVal;
}
public Object peekFirst()
{
if (isEmpty())
{
throw new IllegalArgumentException("Empty list");
}
return head.data;
}
public Object peekLast()
{
if (isEmpty())
{
throw new IllegalArgumentException("Empty list");
}
return tail.data;
}
public void printNodes(LinkedList list)
{
Iterator itr = list.iterator();
System.out.println("Here is the current list");
if(isEmpty())
{
System.out.println("The list is empty\n");
}
else
{
while(itr.hasNext())
{
T o = (T)(itr.next());
System.out.print(o + " ");
}
}
}
}
IMPORTANT! The graph class must include these class fields;
vertices, edges (of type LinkedList)
and must include these methods;
a constructor, insertVertex, insertEdge, hasVertex, getVertexCount, getEdgeCount, getVertex, getEdge, getAdjacent, getAdjacentE
In: Computer Science
Fix the following java code
package running;
public class Run {
public double distance; //in kms
public int time; //in seconds
public Run prev;
public Run next;
//DO NOT MODIFY - Parameterized constructor
public Run(double d, int t) {
distance = Math.max(0, d);
time = Math.max(1, t);
}
//DO NOT MODIFY - Copy Constructor to create an
instance copy
//NOTE: Only the data section should be copied over,
not the links
public Run(Run source) {
this(source.distance,
source.time);
}
//DO NOT MODIFY (return speed in kmph)
public double speed() {
return distance*3600/time;
}
/**
* add an INSTANCE COPY of the passed object (using the
copy constructor)
* at the end of the list in which the calling object
exists.
* @param run
*/
public void addToEnd(Run run) {
System.out.println(run.next);
//to be completed
}
/**
* add an INSTANCE COPY of the passed object (using the
copy constructor)
* at the front of the list in which the calling object
exists
* @param run
*/
public void addToFront(Run run) {
//to be completed
}
/**
*
* @return number of objects in the list in which the
calling object exists
*/
public int size() {
return 0; //to be completed
}
/**
*
* @return the index of the calling object in the
list.
* the index of the first object in the list is
0.
*/
public int getIndex() {
return 0; //to be completed
}
/**
*
* @param idx
* @return the object that exists in the list at the
passed index.
* return null if there is no object at that
index
*/
public Run get(int idx) {
return null; //to be
completed
}
/**
* return a text version of the list in which the
calling object exists.
* use "->" as the separator.
*/
public String toString() {
return null; //to be
completed
}
//DO NOT MODIFY
public String toStringIndividual() {
return distance+" in "+time;
}
/**
* insert an INSTANCE COPY of the second parameter
(using the copy constructor)
* at index idx, thereby pushing all subsequent items
one place higher
* (in terms of index).
* @param idx
* @param run
* @return true if an INSTANCE COPY was successfully
added at
* the given index in the list, false otherwise.
*/
public boolean add(int idx, Run run) {
return false; //to be
completed
}
/**
*
* @param thresholdSpeed
* @return the highest number of consecutive items in
the list
* (to which the calling object belongs) that have a
speed more than
* the thresholdSpeed.
*/
public int longestSequenceOver(double thresholdSpeed)
{
return 0; //to be completed
}
/**
*
* @param thresholdSpeed
* @return an array containing representations of the
runs (in order of sequence)
* in the list to which the calling object belongs,
that have a speed more than
* the thresholdSpeed. return null if no such item
exists in the list.
*/
public String[] getRunsOver(double thresholdSpeed)
{
return null; //to be
completed
}
}
In: Computer Science
Having some trouble with this Java Lab (Array.java)
Objective:
This lab is designed to create an array of variable length and insert unique numbers into it. The tasks in this lab include:
Create and Initialize an integer array
Create an add method to insert a unique number into the list
Use the break command to exit a loop
Create a toString method to display the elements of the array
Task 1:
Create a class called Array, which contains an integer array called ‘listArray’. The integer array should not be initialized to any specific size.
Task 2:
Create a Constructor with a single parameter, which specifies the number of elements that needs to be created for listArray. The listArray needs to be created to this size.
Task 3:
Create a ‘add’ method to class Array which will search through the elements of listArray. A looping mechanism should be used to search the array of elements. If the value passed into add is not already in the list, it should be added. Once the element is added, you need to use the break statement to exit to search so the value isn’t added to each space in the array. If all elements of the array contain non-zero numbers, no more values will be added.
Task 4:
Create a ‘toString’ method to output the non-zero elements of the array. Use the program template and the Sample Output as a reference to guide your application development.
Sample output:
Enter Number of Elements to Create in Array: 10
Enter Number to Add to List (-1 to Exit): 4
4 (added)
Enter Number to Add to List (-1 to Exit): 9
9 (added)
Enter Number to Add to List (-1 to Exit): 21
21 (added)
Enter Number to Add to List (-1 to Exit): 4
4 (duplicate)
Enter Number to Add to List (-1 to Exit): 7
7 (added)
Enter Number to Add to List (-1 to Exit): -1
Array List: 4, 9, 21, 7,
Test Code (ArrayTest.java):
package arraytest;
import java.util.Scanner;
public class ArrayTest
{
public static void main(String[] args)
{
int elements, input;
Scanner keyboard = new Scanner( System.in );
Array arrayList;
System.out.print( "Enter Number of Elements to Create in Array: " );
elements = keyboard.nextInt(); // Read number of elements
arrayList = new Array( elements ); // Instantiate array with no elements
do
{
System.out.print( "Enter Number to Add to List (-1 to Exit): " );
input = keyboard.nextInt(); // Read new Number to add
if ( input != -1 )
{
arrayList.add( input ); // Add to array if not -1
}
} while ( input != -1 );
// call toString method to display list
System.out.println( arrayList );
}
}
In: Computer Science
Assignment
Write each of the following functions. The function header must be implemented exactly as specified. Write a main function that tests each of your functions.
Specifics
In the main function ask for a filename and fill a list with the values from the file. Each file should have one numeric value per line. This has been done numerous times in class. You can create the data file using a text editor or the example given in class – do not create this file in this program. Then call each of the required functions and then display the results returned from the functions. Remember that the functions themselves will not display any output, they will return values that can then be written to the screen.
If there are built in functions in Python that will accomplish the tasks lists below YOU CANNOT USE THEM. The purpose of this lab is to get practice working with lists, not to get practice searching for methods. DO NOT sort the list, that changes the order of the items. The order of the values in the list should be the same as the order of the values in the file.
Required Functions
def findMaxValue (theList) – Return the largest integer value found in the list.
def findMinValue (theList) – Return the smallest integer value found in the list.
def findFirstOccurance (theList, valueToFind) – Return the index of the first occurrence of valueToFind. If valueToFind does not exist in the list return -1.
def findLastOccurance (theList, valueToFind) – Return the index of the last occurrence of valueToFind. If valueToFind does not exist in the list return -1.
def calcAverage (theList) – Return the average of all the values found in the list.
def findNumberAboveAverage (theList) - Return the number of values greater than OR equal to the average. This requires you to call the calcAverage function from this function – DO NOT repeat the code for calculating the average.
def findNumberBelowAverage (theList) - Return the number of values less than the average. This requires you to call the calcAverage function from this function – DO NOT repeat the code for calculating the average.
def standardDeviation (theList) – Return the standard deviation of the values. To find the standard deviation start with the average of the list. Then for each value in the list subtract the average from that value and square the result. Find the average of the squared differences and then take the square root of that average.
For example, if the list contains the values 4, 5, 6, and 3 the average of those values would be 4.5. Subtract 4.5 from each value and square that results. The differences would be -0.5, 0.5, 1.5 and -1.5 respectively. The square of each of those differences would be 0.25, 0.25, 2.25, and 2.25 respectively. The average of these values is 1.25 ((0.25 + 0.25 + 2.25 + 2.25) / 4).
In: Computer Science
C++ Code
You will write a program to process the lines in a text file using a linked list and shared pointers.
You will create a class “Node” with the following private data attributes:
• Line – line from a file (string)
• Next (shared pointer to a Node)
Put your class definition in a header file and the implementation of the methods in a .cpp file. The header file will be included in your project. If you follow the style they use in the book of having a "#include" for the implementation file at the bottom of the header file, then you do not include your implementation file in the project.
You will have the following public methods:
• Accessors and mutators for each attribute
• Constructor that initializes the attributes to nulls (empty string)
You will make the linked list a class and make the processes class methods.
Your program will open a text file , read each line and store it in a Node. Make sure the file opened correctly before you start processing it. You do not know how many lines are in the file so your program should read until it gets to the end of the file. It will display the contents of the list (the lines that were read from the file) with all the duplicates.
Then your program will edit the list, removing any duplicate entries and display the list again once the duplicates have been removed.
Your linked list class should include the following methods, possibly more:
1. addNode – adds a node to the list given the value of the line
2. removeDuplicates – go through the entire list and remove any duplicate lines
3. displayList – displays each entry in the list
. You will write all of the code for processing the linked list - do not use any predefined objects in C++. You do not need to offer a user interface – simply display the list before and after removing duplicate lines.
To test the program, use the Stuff1.txt below:
Stuff1.txt
The sky is blue.
Clovis Bagwell
Shake rattle and roll.
The quick brown fox jumped over the lazy dog.
One red bean stuck in the bottom of a tin bowl.
Rats live on no evil star.
The sky is blue.
Mark Knopfler
The sky is blue.
Archibald Beechcroft
Oliver Crangle
Workers of the world unite.
Oliver Crangle
A squid eating dough in a polyethylene bag is fast and bulbous.
Somerset Frisby
Mark Knopfler
Oliver Crangle
Data structures is really hard.
It's raining and boring outside.
It's raining and boring outside.
It's raining and boring outside.
Somerset Frisby
Henry Bemis
Mark Knopfler
In: Computer Science
JAVA:
You're given 3 files. Demo.java, SampleInterace.java, and OverflowException.java. Use your Demo class to implement SampleInterface, and the OverflowException class should handle any errors that may come from the addNum method.
Demo.java:
public class Demo implements SampleInterface {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated constructor stub
}
@Override
public void addNum(int value) throws OverflowException {
// TODO Auto-generated method stub
}
@Override
public void removeNum(int value) {
// TODO Auto-generated method stub
}
@Override
public int sumOfNumbers() {
// TODO Auto-generated method stub
return 0;
}
@Override
public void clear() {
// TODO Auto-generated method stub
}
@Override
public boolean isFull() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isEmpty() {
// TODO Auto-generated method stub
return false;
}
}
SampleInterface.java :
public interface SampleInterface {
/**
* Method adds a value to the list if the list doesn't have the value already
* If your list is full then the
* is full this method throws a OverflowException.
*
* @throws OverflowException
*/
public void addNum(int value) throws OverflowException;
/**
* This method will remove a value in your list if it's present
* If the value does not exist in this list then the list should remain unchanged
*
*/
public void removeNum(int value);
/**
* Method should add all numbers currently stored in the list and return it
* @return the sum of all the numbers stored in this object.
*/
public int sumOfNumbers();
/**
* removes all numbers from this object.
*/
public void clear();
/**
* Checks if the current list is full or not.
* @return true if the list in this object is full. false otherwise.
*/
public boolean isFull();
/**
* Checks if the current list is empty or not.
* @return true if the list in this object is empty. false otherwise.
*/
public boolean isEmpty();
}
OverflowException.java :
public class OverflowException extends Exception {
/**
*
*/
public OverflowException() {
// TODO Auto-generated constructor stub
}
/**
* @param arg0
*/
public OverflowException(String arg0) {
super(arg0);
// TODO Auto-generated constructor stub
}
/**
* @param arg0
*/
public OverflowException(Throwable arg0) {
super(arg0);
// TODO Auto-generated constructor stub
}
/**
* @param arg0
* @param arg1
*/
public OverflowException(String arg0, Throwable arg1) {
super(arg0, arg1);
// TODO Auto-generated constructor stub
}
/**
* @param arg0
* @param arg1
* @param arg2
* @param arg3
*/
public OverflowException(String arg0, Throwable arg1, boolean arg2, boolean arg3) {
super(arg0, arg1, arg2, arg3);
// TODO Auto-generated constructor stub
}
}
In: Computer Science
please run it and show a sample. please dont change the methods.
public interface PositionalList extends Iterable {
/**
* Returns the number of elements in the list.
* @return number of elements in the list
*/
int size();
/**
* Tests whether the list is empty.
* @return true if the list is empty, false otherwise
*/
boolean isEmpty();
/**
* Returns the first Position in the list.
*
* @return the first Position in the list (or null, if empty)
*/
Position first();
/**
* Returns the last Position in the list.
*
* @return the last Position in the list (or null, if empty)
*/
Position last();
/**
* Returns the Position immediately before Position p.
* @param p a Position of the list
* @return the Position of the preceding element (or null, if p is
first)
* @throws IllegalArgumentException if p is not a valid position for
this list
*/
Position before(Position p) throws IllegalArgumentException;
/**
* Returns the Position immediately after Position p.
* @param p a Position of the list
* @return the Position of the following element (or null, if p is
last)
* @throws IllegalArgumentException if p is not a valid position for
this list
*/
Position after(Position p) throws IllegalArgumentException;
/**
* Inserts an element at the front of the list.
*
* @param e the new element
* @return the Position representing the location of the new
element
*/
Position addFirst(E e);
/**
* Inserts an element at the back of the list.
*
* @param e the new element
* @return the Position representing the location of the new
element
*/
Position addLast(E e);
/**
* Inserts an element immediately before the given Position.
*
* @param p the Position before which the insertion takes
place
* @param e the new element
* @return the Position representing the location of the new
element
* @throws IllegalArgumentException if p is not a valid position for
this list
*/
Position addBefore(Position p, E e)
throws IllegalArgumentException;
/**
* Inserts an element immediately after the given Position.
*
* @param p the Position after which the insertion takes place
* @param e the new element
* @return the Position representing the location of the new
element
* @throws IllegalArgumentException if p is not a valid position for
this list
*/
Position addAfter(Position p, E e)
throws IllegalArgumentException;
/**
* Replaces the element stored at the given Position and returns the
replaced element.
*
* @param p the Position of the element to be replaced
* @param e the new element
* @return the replaced element
* @throws IllegalArgumentException if p is not a valid position for
this list
*/
E set(Position p, E e) throws IllegalArgumentException;
/**
* Removes the element stored at the given Position and returns
it.
* The given position is invalidated as a result.
*
* @param p the Position of the element to be removed
* @return the removed element
* @throws IllegalArgumentException if p is not a valid position for
this list
*/
E remove(Position p) throws IllegalArgumentException;
/**
* Returns an iterator of the elements stored in the list.
* @return iterator of the list's elements
*/
Iterator iterator();
/**
* Returns the positions of the list in iterable form from first to
last.
* @return iterable collection of the list's positions
*/
Iterable> positions();
}
import java.util.Iterator;
import Position; (interface)
import PositionalList;(interface)
public class DoublyLinkedList implements PositionalList
{
private int NumberofNode;
private Node head;
private Node tail;
public DoublyLinkedList()
{
head = new Node();
tail = new Node();
head.next =tail;
tail.prev = head;
}
@Override
public int size()
{
return NumberofNode;
return size;
}
@Override
public boolean isEmpty()
{
if(NumberofNode < 1 )
return
true;
else
return
false;
//return size ==0;
}
@Override
public Position first()
{
if(NumberofNode >=1)
return
head;
return null;
}
@Override
public Position last()
{
if(NumberofNode >= 1)
return
tail;
return null;
}
@Override
public Position before(Position p) throws
IllegalArgumentException
{
return null;
}
@Override
public Position after(Position p) throws
IllegalArgumentException {
// TODO Auto-generated method
stub
return null;
}
@Override
public Position addFirst(E e) {
// TODO Auto-generated method
stub
return null;
}
@Override
public Position addLast(E e) {
// TODO Auto-generated method
stub
return null;
}
@Override
public Position addBefore(Position p, E e)
throws
IllegalArgumentException {
// TODO Auto-generated method
stub
return null;
}
@Override
public Position addAfter(Position p, E e)
throws
IllegalArgumentException {
// TODO Auto-generated method
stub
return null;
}
@Override
public E set(Position p, E e) throws
IllegalArgumentException {
// TODO Auto-generated method
stub
return null;
}
@Override
public E remove(Position p) throws
IllegalArgumentException {
// TODO Auto-generated method
stub
return null;
}
@Override
public Iterator iterator() {
// TODO Auto-generated method
stub
return null;
}
@Override
public Iterable> positions() {
// TODO Auto-generated method
stub
return null;
}
public E removeFirst() throws IllegalArgumentException
{
// TODO Auto-generated method
stub
return null;
}
public E removeLast() throws IllegalArgumentException
{
// TODO Auto-generated method
stub
return null;
}
}
In: Computer Science
****PLEASE ANSWER ALL QUESTIONS****
Question 1 (1 point)
164 employees of your firm were asked about their job satisfaction. Out of the 164, 47 said they were unsatisfied. What is the estimate of the population proportion? What is the standard error of this estimate?
Question 1 options:
|
|||
|
|||
|
|||
|
|||
|
Question 2 (1 point)
Suppose the nationwide high school dropout rate for 2014 was around 14.62%. If you checked the records of 472 students in high school in 2014, what is the probability that greater than 14.97% of them ended up dropping out?
Question 2 options:
|
|||
|
|||
|
|||
|
|||
|
Question 3 (1 point)
An airline records flight delays in and out of Chicago O'Hare airport for a year. The average delay for these flights is 9.64 minutes with a standard deviation of 3.51 minutes. For a sample of 49 flights, 94% of flights will have an average delay less than how many minutes?
Question 3 options:
|
|||
|
|||
|
|||
|
|||
|
Question 4 (1 point)
A U.S. census bureau pollster noted that in 411 random households surveyed, 252 occupants owned their own home. For a 95% confidence interval for the proportion of home owners, what is the margin of error?
Question 4 options:
|
|||
|
|||
|
|||
|
|||
|
Question 5 (1 point)
The Student Recreation Center wanted to determine what sort of physical activity was preferred by students. In a survey of 64 students, 39 indicated that they preferred outdoor exercise over exercising in a gym. They estimated the proportion of students at the university who prefer outdoor exercise as ( 0.452 , 0.7667 ), with 99% confidence. Which of the following is an appropriate interpretation of this confidence interval?
Question 5 options:
|
|||
|
|||
|
|||
|
|||
|
Question 6 (1 point)
The owner of a local phone store wanted to determine how much customers are willing to spend on the purchase of a new phone. In a random sample of 13 phones purchased that day, the sample mean was $493.254 and the standard deviation was $21.6007. Calculate a 90% confidence interval to estimate the average price customers are willing to pay per phone.
Question 6 options:
|
|||
|
|||
|
|||
|
|||
|
In: Statistics and Probability