Questions
One hundred random draws with replacement are made from the box [1, 6, 7, 9, 9,...

One hundred random draws with replacement are made from the box [1, 6, 7, 9, 9, 10] (a) Calculate the probability of getting 12 nines. (b) Calculate the probability that the sum is at most 107.

In: Statistics and Probability

If a random sample of 100 items is taken from a population in which the proportion...

If a random sample of 100 items is taken from a population in which the proportion of items having a desired attribute is p=0.45, what is the probability that the proportion of successes in the sample will be less than or equal to 0.49

The probability will be ____

In: Statistics and Probability

On a block of ten houses, k are not insured. A tornado randomly damages three houses...

On a block of ten houses, k are not insured. A tornado randomly damages three houses on the block. The probability that none of the damaged houses are insured is 1/120. Calculate the probability that at most one of the damaged houses is insured.

In: Statistics and Probability

a) How many arrangements are there of the letters of the word FEEBLENESS? (b) What is...

a) How many arrangements are there of the letters of the word FEEBLENESS?

(b) What is the probability that if the letters are arranged at random four E’s will be together?

(c) In a random arrangement, what is the probability that exactly three E’ s will be together?

In: Statistics and Probability

a) How many arrangements are there of the letters of the word FEEBLENESS? (b) What is...

a) How many arrangements are there of the letters of the word FEEBLENESS?

(b) What is the probability that if the letters are arranged at random four E’s will be together?

(c) In a random arrangement, what is the probability that exactly three E’ s will be together?

In: Statistics and Probability

Patients arrive at the emergency room of Mercy Hospital at the average rate of 12 in...

Patients arrive at the emergency room of Mercy Hospital at the average rate of 12 in 60 minutes. what is the probability that 10 patients will arrive in 60 minutes? What is the probability that 4 patients will arrive in 30 minutes?

In: Statistics and Probability

The probability of winning on an arcade game is 0.678. If you play the arcade game...

The probability of winning on an arcade game is 0.678. If you play the arcade game 24 times, what is the probability of winning no more than 12 times? (Round your answer to 3 decimal places, if necessary.)

In: Statistics and Probability

probabilty students have pencil is 0.40. a) probability that at least 6 guesses are neededto have...

probabilty students have pencil is 0.40.
a) probability that at least 6 guesses are neededto have 3 students with pencik.
b) probability to have the first student with pencil in at least 3 guesses.

guesses=try

In: Statistics and Probability

ASSEMBLY LANGUAGE ONLY OR I WILL DOWNVOTE write a program that will allow a person to...

ASSEMBLY LANGUAGE ONLY OR I WILL DOWNVOTE

write a program that will allow a person to play a Guess a C♠rd Game. This section specifies the required functionality of the program. The interface must be a BlueJ Terminal Window, otherwise zero marks will be awarded. Only a simple screen presentation of the game is required; however, more marks will be gained for a game that is easy to follow with clear informative messages to the player. The aim of the Guess a C♠rd Game is for a player to correctly guess a playing card drawn randomly by the computer. The player has a set number of attempts to guess the card. However, they are allocated points at the start of the game and are penalised for each incorrect attempt. The game ends when a correct guess is entered, the points are zero or less, or the player has run out of guesses. The points remaining at the end of the game are counted as the score for the game. The player may play a series of games, with cumulative game results displayed after the final game when the player decides to stop playing. The deck of cards from which the cards are drawn is a standard fifty-two card deck. It has four suits: Hearts♥, Diamonds♦, Clubs♣ and Spades♠. Each suit has thirteen cards: an Ace, which is regarded as number 1 for this game; cards numbered 2 to 10 inclusive. Each suit also three “face cards”: a Jack, number 11 for this game; a Queen, number 12 for this game; and a King, number 13 for this game. Game play The Guess a C♠rd Game begins with a welcome message followed by a message inviting the player to enter their name. The player’s name cannot be blank and can contain only alphabetic characters. Two numbers, the first with a value from 1 to 4 (inclusive) and the second with a value from 1 to 13 (inclusive), are then randomly generated by the program but hidden from the player. The two numbers represent the card drawn from the deck. So, if the random numbers were 2 and 1, this would mean the card drawn was the Ace of Diamonds. The random numbers 4 and 13 would mean the card drawn was the King of Spades … and so on. The player starts each game with a point score of 40 points. They will first guess the suit of the card drawn from the deck. The player will enter a single character to signify their choice of suit: H for Hearts, D for Diamonds, C for Clubs and S for Spades. The player has three attempts to guess the correct suit. Points are deducted from the player’s score each time the player guesses incorrectly. The points deducted during this part of the game are shown in Table 1. Incorrect guess Points deducted 1 st 5 2 nd 10 3 rd 15 Table 1: Point deductions for incorrect guesses for the card suit. For example, 2 incorrect guesses will be 15 points deducted. If the player guesses incorrectly on the first two attempts, a message is displayed informing them so and they are invited to enter another guess. After a third incorrect guess the player is informed once again of their incorrect guess, then shown the correct suit by the program and the game moves to the next phase. If the player guesses correctly, on either of their first, second or third attempts, they are shown a message informing them so and the game also moves to the next phase. After correctly guessing, or failing to guess and been shown the suit of the card drawn from the deck, the player then has four attempts to guess the correct card number. To do this the player will enter an integer value. Points are deducted from the player’s score each time the player guesses incorrectly. The points deducted during this part of the game are shown in Table 2. Incorrect guess Points deducted 1 st 2 2 nd 6 3 rd 12 4 th 20 Table 2: Point deductions for incorrect guesses for the card number. For example, 3 incorrect guesses will be 20 points deducted. The game continues while the player’s points score is greater than 0, until the player guesses correctly, or they have run out of guesses. If the player guesses incorrectly on the first three attempts and they have a points score above 0, the player is shown a message informing them that the correct card number is higher or lower than their last guess. After a fourth incorrect guess the player is shown the correct card number, the game ends, and they lose the game. If the player guesses correctly on any one of their four attempts, they win the game and are shown a message informing them so. At the end of each game, the player is also shown their points score for the game they have just played. They are also asked if they want to play another game. If they choose not to play another game, they are shown the number of games they have played, the number of games they have won and their highest score for the games they played. The program then terminates. Please note that your program must deal with invalid values entered by the player with respect to the data values mentioned in the previous sections. During the running of the game, if the player enters an invalid value for either the card suit or the card number, the program should display a warning message and the player should be invited to enter another number without penalty (the invalid value entered will not be counted as a guess). Program design Your program must demonstrate your understanding of the object-oriented concepts and general programming constructs presented in the course. Students are advised to follow good programming practices and to use loops and appropriate fields where required to ensure good program design. The data type of each field must be chosen carefully and you must be able to justify the choice of the data type. You may want to include comments in the class to state any assumptions made. Each class should also include appropriate accessor and mutator methods for its fields. Validation of values for fields and local variables should also be implemented where appropriate. You should not allow an object of a class to be set to an invalid state. Class designs Your program should consist of at least four classes: Player, Card, Game and RandomNumber. This section gives an outline of these classes with suggested fields and some behaviours. Player class The Player class will specify the attributes and behaviours of a player. An object of the Player class will have the following fields (at least): name – the name of the player. score – the current game score guess – the last suit or number guessed highestScore – the highest game score achieved numberOfGamesPlayed – the total number of games played numberOfGamesWon – the total number of games won The class must also have a non-parameterised (“default”) constructor and parameterised constructor that accepts a value for the name of the player. A Player object should also be able to return its state in the form of a String. Card class The Card class will specify the attributes and behaviours of card. An object of the Card class will have the following fields (at least): suit – the card suit. number – the card number The class must also have a non-parameterised (“default”) constructor and parameterised constructor that accepts values for the suit and number of the card. A Card object should also be able to return its state in the form of a String. Game class The Game class will manage the playing of a game. It will have the following field (at least): cardGamePlayer (an object of type Player) The Game class will have methods to manage the playing of the game. These should include (at least) the following behaviours: • Display a welcome message on the screen. • Request the player to enter their name. • Request the player to enter a suit. • Request the player to enter a card number • Compare the suit entered by a player with the hidden suit. • Compare the number entered by a player with the hidden number. • Display the result of the attempt at guessing the suit. • Display the result of the attempt at guessing the number. • Display the result for the end of a game. • Display the overall result when the player decides to stop playing. Note that all code for input from the terminal or output to the screen must be in the Game class. There should be no code for input from the terminal or output to the screen in any other class. RandomNumber class An object of the RandomNumber class will generate a random number from 1 to a maximum value specified. The maximum value should be specified via a paramaterised constructor.

In: Physics

It is about C++linked list code. my assignment is making 1 function, in below circumstance,(some functions...

It is about C++linked list code. my assignment is making 1 function, in below circumstance,(some functions are suggested for easier procedure of making function.)

void pop_Stack (struct linked_list* list, int number) //*This is the function to make and below is the explanation that should be written in given code.

This function removes some nodes in stack manner; the tail of the list will be removed, repeatedly. The parameter (variable number_of_nodes) means the number of nodes that will be removed. When parameter is bigger than 1, popping a node with n times, you do not remove node at one go. If there is only one node in the list, please make sure it frees (de-allocates) both the node and the list. If the list is not a stack type, print the error message “Function pop_Stack: The list type is not a stack” and exit the function. If the number_of_nodes parameter is less than 1 or more than the number of nodes in the stack, respectively print the error message “Function popStack: The number of nodes which will be removed is more than 1” and “Function popStack: The number of nodes which will be removed is more than that in the stack”, then exit the function. The removed nodes should be freed.

Given code is written below,(There is a function to fill in last moment in this code)

linked_list.h: This is the header file of linkLQS.c that declares all the functions and values that are going to be used in linkLQS.c. You do not have to touch this function.

-----------------------------------------------------------------------

(Below code is about linked_list.h)

#include <stdio.h>
#include <stdlib.h>
#include <time.h>


struct linked_node{
   int value;
   struct linked_node* next;
   struct linked_node* prev;
};

struct linked_list{
   int type_of_list; // normal = 0, stack = 1
   struct linked_node* head;
   struct linked_node* tail;
   int number_of_nodes;
};

--------------------------------------------------------

#include "linked_list.h"
#include "string.h"
extern int list_exist;

struct linked_list* create_list (int number_of_nodes, int list_type)
{
   int a[number_of_nodes];
   int i, j;
   int bFound;

   if (number_of_nodes < 1)
   {
       printf("Function create_list: the number of nodes is not specified correctly\n");
       return NULL;
   }
   if(list_exist == 1)
   {
       printf("Function create_list: a list already exists\nRestart a Program\n");
       exit(0);  
   }
   if(list_type != 0 && list_type != 1)
   {
       printf("Function create_list: the list type is wrong\n");
       exit(0);  
   }
   struct linked_list * new_list = (struct linked_list*)malloc(sizeof(struct linked_list));
   new_list->head = NULL;
   new_list->tail = NULL;
   new_list->number_of_nodes = 0;
   new_list->type_of_list = list_type;

   //now put nodes into the list with random numbers.
   srand((unsigned int)time(NULL));
   if(list_type == 0)
   {
       for ( i = 0; i < number_of_nodes; ++i )
       {
           while ( 1 )
           {
  
               a[i] = rand() % number_of_nodes + 1;
               bFound = 0;
               for ( j = 0; j < i; ++j )
               {
                   if ( a[j] == a[i] )
                   {
                       bFound = 1;
                       break;
                   }
               }
               if ( !bFound )
                   break;
           }
           struct linked_node* new_node = create_node(a[i]);
           insert_node(new_list, new_node);
       }
   }
   else if(list_type == 1)
   {
       for ( i = 0; i < number_of_nodes; ++i )
       {
           while ( 1 )
           {
  
               a[i] = rand() % number_of_nodes + 1;
               bFound = 0;
               for ( j = 0; j < i; ++j )
               {
                   if ( a[j] == a[i] )
                   {
                       bFound = 1;
                       break;
                   }
               }
               if ( !bFound )
                   break;
           }
           struct linked_node* new_node = create_node(a[i]);
           push_Stack(new_list, new_node);
       }
   }
   list_exist = 1;
   printf("List is created!\n");
   return new_list;
}

struct linked_node* create_node (int node_value)//This functon is the example for reference of the assignment function
{
   struct linked_node* node = (struct linked_node*)malloc(sizeof(struct linked_node));
   node->value = node_value;
   node->next = NULL;
   node->prev = NULL;
   return node;
}

void insert_node(struct linked_list* list, struct linked_node* node)//This functon is the example for reference of the assignment function
{
   node->next = NULL;
   node->prev = NULL;

   if(list->head == NULL)       //if head is NULL, tail is also NULL.
   {
       list->head = node;
       list->tail = node;
       list_exist = 1;
   }
   else if(list->head == list->tail)
   {
       node->next = list->head;
       list->head->prev = node;
       list->head = node;
   }
   else if(list->head != list->tail)
   {
       node->next = list->head;
       list->head->prev = node;
       list->head = node;
   }
   (list->number_of_nodes)++;
}

void pop_Stack(struct linked_list* list, int number)//The function to be written!!
{
~~~~~~~~~~~~~ //your code starts from here
}


In: Computer Science