Questions
Exhibit 1:   We have the following information about number of violent crimes (Y) and the number...

Exhibit 1:  

We have the following information about number of violent crimes (Y) and the number of police personnel (X) for a certain year for a sample of three metropolitan areas. We also know the following statistics: SST = 1250, SSE = 937.5

Crime (Y)

Police Personnel (X)

300

5000

325

3000

350

4000

Question 6

  1. To answer this question, refer to Exhibit 1 in question 1.

    What does value of r2 tell you?

    A.

    25 percent of variation in crime is explained by the number of police personnel.

    B.

    50 percent of variation in crime is explained by the number of police personnel.

    C.

    75 percent of variation in crime is explained by the number of police personnel.

    D.

    None of the above

Question 7

  1. To answer this question, refer to Exhibit 1 in question 1.

    The coefficient of correlation is (to 2 decimal places)

    A.

    0.87

    B.

    -0.87

    C.

    0.5

    D.

    -0.5

Question 8

  1. To answer this question, refer to Exhibit 1 in question 1.

    What is the estimate of the standard error of the overall regression (to 2 decimal places)?

    10.91

    30.62

    45.88

    55.67

  

Question 9

  1. To answer this question, refer to Exhibit 1 in question 1.

    What is the estimate of the standard error of slope estimate (to 3 decimal places)?

    0.001

    0.015

    0.022

    0.053

Question 10

  1. To answer this question, refer to Exhibit 1 in question 1.

    Is police personnel a significant variable affecting crime in the above data?

    No because we cannot reject the null the slope is 0.

    Yes because we can reject the null the slope is 0.

    Need more information to answer the question

In: Math

Let’s define a new number system, where we represent a number by the remainder we get...

Let’s define a new number system, where we represent a number by the remainder we get on
dividing by successive primes, i.e., by 2, 3, 5, 7, 11, 13, 17, etc. Thus, 15 might be represented as
[1,0,0], and 27 might be [1,0,2].

1.) What numbers do [1, 1, 1, 1] and [1, 2, 3, 4] represent? Are the representations unique? What
other numbers might these lists represent?

2.) We know that 15 + 27 = 42. What is the representation of 42? Can you see how to get this from
the representations for 15 and 27?

In: Computer Science

As you know a number of States have passed right-to-work laws while a number of States...

As you know a number of States have passed right-to-work laws while a number of States have no right-to-work laws. Discuss the meaning of the term “right-to-work” and pros and cons of “right-to-work”. What problems, if any, do you see in a company workplace in Missouri where the majority of the workers want to belong to the union, but where right-to-work laws allow non-union workers as well?

In: Operations Management

C++ Programming level 1 using step number 2 is a must Guess the Number Introduction In...

C++ Programming level 1

using step number 2 is a must

Guess the Number

Introduction In this assignment you will create a program that will simulate a number guessing game.

Skills: random, while-loop, Boolean flags

Algorithm to win

The guess the number game has an algorithm to lead to the winning value. The way it works is say you have the set of numbers 1 to 100. You always begin by choosing the half-way point, then a hint will be provided if you do not guess correctly. Based on that hint, you shift either the beginning or end point. For instance, for 1 to 100, select 50. Let’s say the system says “higher,” then you set your potential range from 51 to 100. Next, we would choose the half-way point between these two values, so 75. Let’s say that now we are told, “lower.” Our new range becomes 51 to 74. The half-way point would be 62, let’s say that this is our number the game would end.

main.cpp

Your program should follow these steps and generate similar output. Do not change the design and follow naming conventions:

1) Create two constants with appropriate name: smallest value set to 1, largest value set to 100.

2) Create the mt19937 engine and initialize it with the random device as shown in the Boolean lectures.

3) Create a uniform int distribution of type integer and set it to generate values between the constants for smallest and largest values.

4) Create a boolean flag variable called continue game, set it to true.

5) Create the main while loop of the game, and leave the condition as the continue game variable

6) Inside the loop, generate a random number and store it in a variable

7) Declare and initialize a variable for number of guesses, set it to 0

8) Prompt the user for a number as show in the example, you must use the constants to display the output for the numbers, do not use literals in the string

9) Get the initial guess from the user and store it in a variable called guess.

10) Create a Boolean value, is guess correct, and set it to determine if the guess is correct

11) Create another while loop that will loop while the guess is not correct

12) Inside this loop increment the number of guesses (choose the appropriate increment type)

13) Create a string variable, hint, and use the Ternary operator to either store “Lower” if the guess is higher than the random number, or “Higher” otherwise.

14) Display the Hint, and prompt the user again to enter another guess

15) Update the is correct guess variable.

16) Outside the innermost loop, display the Number of guesses it took

17) Prompt the user if they wish to play again and update the continue game Boolean flag.

18) Outside the outermost loop, display a message Thanking the player.

19) Look at the output

Test Run: Your code should look exactly as the one below:

Guess a number between 1 and 100: 50

Hint: Higher

Guess a number between 1 and 100: 75

Hint: Higher

Guess a number between 1 and 100: 82

Hint: Higher

Guess a number between 1 and 100: 90

Hint: Higher

Guess a number between 1 and 100: 95

Hint: Higher

Guess a number between 1 and 100: 99

Hint: Lower

Guess a number between 1 and 100: 97

Number of guesses: 6

Do you want to play again (y/n) ? n

Thank you for playing.

In: Computer Science

Design, implement, and fully test a Python3 function that converts a number to words (words_from_number(number: int))....

Design, implement, and fully test a Python3 function that converts a number to words (words_from_number(number: int)). It should expect to be passed a natural number (such as 12345) and return the corresponding words (i.e., “twelve thousand three hundred forty-five”). Since Python integers can grow arbitrarily large, your code should be flexible, handling at least 20 digits (realistically, it’s just as easy up to 30 digits). Spell everything correctly, and use correct punctuation (hyphens for forty-five and thirty-seven, no commas or plurals). You may only use built-in Python functions, not any modules or third-party libraries!

IMPORTANT NOTE: please use/def: words_from_number(number:int). I've had a lot of chegg answers change it to something else when I didn't ask for that, thank you.

In: Computer Science

Write in C++ Example Enter number of miles travelled 12340 Enter number of hours in trip...

Write in C++

Example

Enter number of miles travelled

12340

Enter number of hours in trip

460

file.txt

Miles: 12340

Hours: 460

MPH: 26.83

Question:

Write a program that does the following things:

1 ) Ask the user for number of miles travelled (should be in getData function and number of hours in trip (should be in getData function)

[Note: Use reference parameters to have access to these values in main]

2 ) Calculate the miles per hour(MPH) for the trip (should be in main)

3 ) write the miles, hours and MPH to a text file (should be in writeFile function)

[Note: Use reference parameter for writer]

Here are the functions you need       

Function name | Parameters                       | Return Type   

getData |  miles, hours   | void

writeFile | writer, miles, hours, MPH | void


In: Computer Science

We performed a linear regression analysis between number of times on phone per drive and number...

We performed a linear regression analysis between number of times on phone per drive and number of near accidents. The equation is Y= 0.320 + 0.943X, where Y is the number of times on phone per drive and X is the number of near accidents. calculate the p-value and give a conclusion.

number of times on phone per dr near accidents
0 0
0 1
1 1
2 1
3 1
1 2
2 2
3 2
4 2
2 3
3 3
4 3
2 4
3 4
4 4
5 4
6 4
3 5
4 5
5 5
6 5
4 6
5 6
7 6
8 7
9 7

In: Math

Create a Guess the Number game. Python randomly chooses a secret four-digit number (with no repeating...

Create a Guess the Number game.

  • Python randomly chooses a secret four-digit number (with no repeating digits) and asks the user to guess it.
  • The user has up to ten attempts to guess the number. After each guess, Python gives the user two clues (until the user either guesses the number correctly or runs out of attempts):
    • The number of digit(s) in the user’s guess that is (are) both correct and in the right position.
    • The number of digit(s) in the user’s guess that is (are) correct but in the wrong position.
      • For example, say the secret number is 0123.
        • If the user’s guess is 4567, the clues will be:
          • Right digit and position: 0
          • Right digit but wrong position: 0
        • If the user’s guess is 1023, the clues will be:
          • Right digit and position: 2
          • Right digit but wrong position: 2
  • If the user guesses the correct number within his/her ten attempts, the game will finish.
  • If the user fails to guess the correct number within his/her ten attempts, the number will be shown and the game will finish.
  • When the game finishes (i.e., whether the user guesses the correct number or fails to do so in ten attempts), Python asks the user whether he/she wants to continue playing.
    • If the user enters “Y” he/she will play another round. If the user enters “N” the game will end
  • PLEASE USE LOW-LEVEL PYTHON LANGUAGE SUCH AS WHILE LOOP OR IF ELSE ARGUMENTS, TRY NOT TO MAKE IT TOO ADVANCED

In: Computer Science

I'm generating a random number every 10 second; In arraylist I'm Storing and Updating the number...

I'm generating a random number every 10 second; In arraylist I'm Storing and Updating the number every 10 second when I generate new number. However, my goal to call the update number from arraylist in another class main method. I would apperciate any help.

//this is the class I'm generating a random number every 10 second and Storing and Updating the number in arraylist.

package com.singltondesignpattern;

import java.util.ArrayList;

import java.util.Random;

import java.util.concurrent.Executors;

import java.util.concurrent.ScheduledExecutorService;

import java.util.concurrent.TimeUnit;

public class EverySecond {

public static int genrand() {

Random number =new Random();

int rand=number.nextInt(1000);

return rand;

}

public static void getrand(int rand) {   

ArrayList <Integer> randomstorage = new ArrayList<Integer>();

randomstorage.add(rand);

System.out.println("Array value "+randomstorage);

}

public static void main(String[] args) throws Exception {

Runnable helloRunnable = new Runnable() {

public void run() {

int CurrentNum=genrand(); //create a random number

System.out.println("generate number ==== "+CurrentNum);

getrand(CurrentNum); //update it in array list

}

};

ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);

executor.scheduleAtFixedRate(helloRunnable, 0, 10, TimeUnit.SECONDS);

   }

}

//this is the class I want to get the update number from the arraylist

public class getTheUpdate {

public static void main(String[] args) throws Exception {

EverySecond everySecond = new EverySecond();

everySecond.getrand(0);

}

}

In: Computer Science

13. The class bankAccount stores a bank customer’s account number and balance. Suppose that account number...

13. The class bankAccount stores a bank customer’s account number and balance. Suppose that account number is of type int, and balance is of type double. This class provides the following operations: set the account number, retrieve the account number, retrieve the balance, deposit and withdraw money, and print account information.

b. The class  checkingAccount from the class bankAccount (designed in part a). This class inherits members to store the account number and the balance from the base class. A customer with a checking account typically receives interest, maintains a minimum balance, and pays service charges if the balance falls below the minimum balance. This class provides the following operations: set interest rate, retrieve interest rate, set minimum balance, retrieve minimum balance, set service charges, retrieve service charges, post interest, verify if the balance is less than the minimum balance, write a check, withdraw (override the method of the base class), and print account information.

c. Yours for definition and implementation :

Every bank offers a savings account. Derive the class savingsAccount from the class bankAccount (designed in part a). This class inherits members to store the account number and the balance from the base class. A customer with a savings account typically receives interest, makes deposits, and withdraws money. In addition to the operations inherited from the base class, this class should provide the following operations: set interest rate, retrieve interest rate, post interest, withdraw (override the method of the base class), and print account information. Add appropriate constructors.

d. Write a program to test your classes designed in parts c.

the program that needs to be edited is below thanks someone help these are the files I was given have to make changes

//Class bankAccount

#ifndef H_bankAccount
#define H_bankAccount

class bankAccount
{
public:
   void setAccountNumber(int acct);
   int getAccountNumber() const;
   double getBalance() const;
   void withdraw(double amount);
   void deposit(double amount);
   void print() const;
   bankAccount(int acctNumber = -1, double bal = 0);

protected:
   int accountNumber;
   double balance;
};

#endif

//Class checkingAccount

#ifndef H_checkingAccount
#define H_checkingAccount

#include "bankAccount.h"

const double DEFAULT_INTEREST_RATE_CHECKING = 0.04;
const double DEFAULT_MIN_BALANCE = 500.00;
const double DEFAULT_SERVICE_CHARGE = 20;

class checkingAccount : public bankAccount
{
public:
   double getMinimumBalance() const;
   void setMinimumBalance(double minBalance);
   double getInterestRate() const;
   void setInterestRate(double intRate);
   double getServiceCharge() const;
   void setServiceCharge(double intRate);
   void postInterest();
   bool verifyMinimumumBalance(double amount);
   void writeCheck(double amount);
   void withdraw(double amount);
   void print() const;

   checkingAccount(int acctNumber, double bal,
       double minBal = DEFAULT_MIN_BALANCE,
       double intRate = DEFAULT_INTEREST_RATE_CHECKING,
       double servC = DEFAULT_SERVICE_CHARGE);

protected:
   double interestRate;
   double minimumBalance;
   double serviceCharge;
};

#endif

//Implementation file bankAccountImp.cpp

#include <iostream>
#include <iomanip>
#include "bankAccount.h"

using namespace std;

bankAccount::bankAccount(int acctNumber, double bal)
{
   accountNumber = acctNumber;
   balance = bal;
}

void bankAccount::setAccountNumber(int acct)
{
   accountNumber = acct;
}

int bankAccount::getAccountNumber() const
{
   return accountNumber;
}

double bankAccount::getBalance() const
{
   return balance;
}

void bankAccount::withdraw(double amount)
{
   balance = balance - amount;
}

void bankAccount::deposit(double amount)
{
   balance = balance + amount;
}

void bankAccount::print() const
{
   cout << fixed << setprecision(2);
   cout << accountNumber << " balance : $"
       << balance << endl;
}

//Implementation file checkingAccountImp.cpp

#include <iostream>
#include <iomanip>
#include "checkingAccount.h"

using namespace std;

checkingAccount::checkingAccount(int acctNumber, double bal,
   double minBal, double intRate, double servC)
   : bankAccount(acctNumber, bal)
{
   interestRate = intRate;
   minimumBalance = minBal;
   serviceCharge = servC;
}

double checkingAccount::getMinimumBalance() const
{
   return minimumBalance;
}

void checkingAccount::setMinimumBalance(double minBalance)
{
   minimumBalance = minBalance;
}

double checkingAccount::getInterestRate() const
{
   return interestRate;
}

void checkingAccount::setInterestRate(double intRate)
{
   interestRate = intRate;
}

double checkingAccount::getServiceCharge() const
{
   return serviceCharge;
}

void checkingAccount::setServiceCharge(double servC)
{
   serviceCharge = servC;
}

void checkingAccount::postInterest()
{
   balance = balance + balance * interestRate;
}

bool checkingAccount::verifyMinimumumBalance(double amount)
{
   return (balance - amount >= minimumBalance);
}

void checkingAccount::writeCheck(double amount)
{
   withdraw(amount);
}

void checkingAccount::withdraw(double amount)
{
   if (balance - amount < 0)
       cout << "Not enough money in the account." << endl;
   else if (balance - amount < minimumBalance)
   {
       if (balance - amount - serviceCharge < minimumBalance)
       {
           cout << "After this transaction, the balanace will be "
               << "below the minimum balance." << endl
               << "However account does not have enough money "
               << "to process the transaction and apply service charge." << endl
               << "Transaction denied!" << endl;
       }
       else
       {
           cout << "After this transaction, the balanace will be "
               << "below the minimum balance." << endl
               << "Service charges will apply." << endl;

           balance = balance - amount - serviceCharge;
       }
   }
   else
       balance = balance - amount;
}

void checkingAccount::print() const
{
   cout << fixed << setprecision(2);
   cout << "Interest Checking ACCT#:\t" << getAccountNumber()
       << "\tBalance: $" << getBalance() << endl;
}


#include <iostream>
#include <iomanip>
//#include "savingsAccount.h"
#include "checkingAccount.h"

using namespace std;

int main()
{
   int accountNumber = 1000;

   checkingAccount jackAccount(accountNumber++, 1000);
   checkingAccount lisaAccount(accountNumber++, 450);
   //savingsAccount samirAccount(accountNumber++, 9300);
   //savingsAccount ritaAccount(accountNumber++, 32);

   jackAccount.deposit(1000);
   lisaAccount.deposit(2300);
   //samirAccount.deposit(800);
   //ritaAccount.deposit(500);

   jackAccount.postInterest();
   lisaAccount.postInterest();
   //samirAccount.postInterest();
   //ritaAccount.postInterest();

   cout << "***********************************" << endl;
   jackAccount.print();
   lisaAccount.print();
   //samirAccount.print();
   //ritaAccount.print();
   cout << "***********************************" << endl << endl;

   jackAccount.writeCheck(250);
   lisaAccount.writeCheck(350);
   //samirAccount.withdraw(120);
   //ritaAccount.withdraw(290);

   cout << "********After withdrawals ***************" << endl;
   jackAccount.print();
   lisaAccount.print();
   //samirAccount.print();
   //ritaAccount.print();
   cout << "***********************************" << endl << endl;

   return 0;
}

In: Computer Science