Questions
1) Find the maximum and minimum values of the function y = 13x3 + 13x2 −...

1) Find the maximum and minimum values of the function y = 13x3 + 13x2 − 13x on the interval [−2, 2].

2) Find the minimum and maximum values of the function f(x) = 4 sin(x) cos(x) + 8 on the interval [0, pi/2].

3)  Find the maximum and minimum values of the function y = 5 tan(x) − 10x on the interval [0, 1]

4) Find the maximum and minimum values of the function f(x) =ln(x)/x  on the interval [1,4]

5)  Find the maximum and minimum values of the function y = |x − 16| on the interval [0, 17] by comparing values at the critical points and endpoints.

In: Math

For each problem, write an R code to compute each probability. (a)   Binomial Distribution: X ~...

For each problem, write an R code to compute each probability.

(a)   Binomial Distribution: X ~ Bin(10, 0.7)

    (i)            P(X = 2)

    (ii)           P(X < 2)

    (iii)          P(X > 2)

    (iv)          P(1 < X < 7)

(b) Normal Distribution: X ~ N(0, 4). Note that variance is 4 and, hence, the standard deviation is 2.

    (i)             P(X < 3)

    (ii)           P(X > 3)

    (iii)          P(1 < X < 3)

(c) Choose either (a) or (b) and interpret the results in a real-life scenario. Make sure to define X and interpret each probability.

In: Statistics and Probability

A researcher conducted an ANOVA (alpha = .05) between 4 groups (G1, G2, G3, G4), with...

A researcher conducted an ANOVA (alpha = .05) between 4 groups (G1, G2, G3, G4), with 11 people in each group. The MSBetween was 5.62 and the MSWithin was 2, leading to an F test statistic of 2.81.

Answer the following:

1) What were the hypotheses in statistical notation (2 points)?

2) What is the critical value (1 point)?

3) Make a decision regarding whether to reject H0 and what that means with regard to the group means (3 points).

4) What specifically do the MSBetween and MSWithin represent when the null hypothesis is true and when the null hypothesis is false (2 points)?

In: Math

Here are the returns on two stocks. Digital Cheese Executive Fruit January +14 +7 February −3...

Here are the returns on two stocks.

Digital Cheese Executive Fruit

January +14 +7

February −3 +1

March +5 +4

April +7 +12

May −4 +2

June +3 +7

July −2 −3

August −8 −2

Required: a-1. Calculate the variance and standard deviation of each stock. a-2. Which stock is riskier if held on its own? b. Now calculate the returns in each month of a portfolio that invests an equal amount each month in the two stocks. c. Is the variance more or less than halfway between the variance of the two individual stocks?

In: Finance

What happens to the pressure of a gas when T is halved and volume is doubled...

What happens to the pressure of a gas when T is halved and volume is doubled

1.It is ¼ of its initial value

2.It is 4 times its initial value

3.It is ½ of its initial value

4.It is 2 times its initial value

5.It is ¾ of the initial value

6.It remains the same.

Please show work

In: Chemistry

The purpose of this lab is to manipulate an array of integers. The assignment is to...

The purpose of this lab is to manipulate an array of integers. The assignment is to write a program that: 1. Declares an array of integers of size equal to constant int SIZE = 10. 2. Implements the following methods:  A method that displays a menu. The menu should be displayed after each completed menu selection.  A method that prompts the user to initialize the array. The entire array does not need to be initialized. The user may enter only as many (or as few) values as they would like in the array. The user will enter a negative value to indicate no more to be added. Hint: This implies that the number of elements in the array does not necessarily have to be the same as the maximum size of the array.  A method that displays the contents of the array. Only elements currently contained in the array should be horizontally displayed.  A method that displays the minimum, maximum, sum and average of all the elements currently contained in the array.  A method that accepts a number and determines how many times (if any) that number appears as an element in the array.  A method that allows the user to add a number to the end of the array.  A method that allows you to insert a specified number at a specified index within the currently filled portion of the array. Hint: In order to accomplish this, the method must first check to see if there is room in the array to accept a new number. If the array is currently full (e.g. number of elements equals the maximum size of the array) then the user has to first delete an element from the array. Think carefully about what an insert into the array implies. The physical size of the array cannot change, therefore what must happen if a value is to be inserted somewhere in the middle of the array without losing any of the existing elements.  A method that removes an element at a specified index in the array. Hint: As with the insert method, the physical size of the array cannot change, therefore how could we simulate an element of the array being deleted? CSCI 125 Array Manipulation Prof. Kadri Page 2 of 4 Sample run: Menu only displayed once here. Your program should display the menu after each completed menu selection. 1. Initialize Array 2. Display Array 3. Add element to the end 4. Add an element at a specific index 5. Remove an element at specific index 6. Show min, max, sum and average 7. Search 8. Exit 1. Initialize Array Enter integer values to fill the array -ve value to stop: 1 2 3 4 5 6 8 -9 2. Display Array 1 2 3 4 5 6 8 6. Show min, max, sum and average Min=1 Max=8 Sum=29 Average=4.14 7. Search Enter number to search for: 2 2 occurs 1 time. 5. Remove an element at specific index Enter index between 0 and 6 7 Invalid index Enter index between 0 and 6 1 2. Display Array 1 3 4 5 6 8 4. Add an element at a specific index Enter index between 0 and 5 6 Invalid index Enter index between 0 and 5 3 Enter number to insert 9 CSCI 125 Array Manipulation Prof. Kadri Page 3 of 4 2. Display Array 1 3 4 9 5 6 8 1. Initialize Array Enter integer values to fill the array -ve value to stop: 1 2 3 4 5 6 7 8 9 10 11 -9 Array is full. One or more numbers could not be inserted 2. Display Array 1 2 3 4 5 6 7 8 9 10 3. Add element to the end Array is full. 8. Exit Goodby

import java.util.Scanner;
public class ArrayMenu
{
    static int count;
    static Scanner kb = new Scanner(System.in);
    
    public static void main()
    {
        int item=0;
        int[] numArray=new int[100];
        count=0;
        
        
        while (item !=8)
        {
            menu();
            item=kb.nextInt();
            if (item==1)
                initializeArray(numArray);
            else if (item==2)
                printArray(numArray);
        }
        
        System.out.println("Goodby!");
        
    }

    public static void menu()
    {
        System.out.println("1. Initialize Array");
        System.out.println("2. Display Array");
        System.out.println("3. Add element to the end");
        System.out.println("4. Add an element at a specific index");
        System.out.println("5. Remove an element at specific index");
        System.out.println("6. Show min, max, sum and average");
        System.out.println("7. Search");
        System.out.println("8. Exit");
        System.out.print(": ");
    }
    
    public static void initializeArray(int[] arr)
    {
        count=0;
        int num;
        System.out.print("Enter integer values to fill the array -vevalue to stop: ");
        do
        {
            num = kb.nextInt();
            if (num >=0)
            {
                arr[count]=num;
                count++;
            }
        } while (num > 0);
        
    }
    public static void printArray(int[] arr)
    {
        for (int i=0; i< count; i++)
            System.out.print(arr[i]+" ");
        System.out.println();
    }

  }

CODING LANGAUGE JAVA

In: Computer Science

C++. How do I reverse this encryption? Here is the question: "A company that wants to...

C++. How do I reverse this encryption? Here is the question:

"A company that wants to send data over the Internet has asked you to write a program that will encrypt it so that it may be transmitted more securely. All the data is transmitted as four-digit integers. Your program should read a four-digit integer in main() entered by the user and encrypt it as follows: 1. Replace each digit with the result of adding 7 to the digit and getting the remainder after dividing the new value by 10. Then swap the first digit with the third, and swap the second digit with the fourth. Then display the encrypted integer. 2. After encryption, program will ask inputs an encrypted four-digit integer and decrypts it (by reversing the encryption scheme) to form the original number and return the decrypted number."

I have everything done except the reversal of the encryption. I do not know how to reverse getting the remainder of the numbers by being divided by 10.

Here is my code:

#include

using namespace std;

int main()
{
   int array[5] = { '0' };
   int i = 1, temp = 0, temp2 = 0,x=1,j=1;

       // loop has user input 4 digits
       for (i = 1; i < 5; i++) {
           cout << "Enter a number: ";
           cin >> array[i];
       }

       //encrypting begins
       //each digit is added by 7 and divided by 10
       cout << endl;
       array[1]+7;
       cout << array[1] % 10;
       cout << endl;
       array[2] + 7;
       cout << array[2]%10;
       cout << endl;
       array[3] + 7;
       cout << array[3]%10;
       cout << endl;
       array[4] + 7;
       cout << array[4]%10;
       cout << endl;


       //array positions are swapped

       temp = array[1];
       array[1] = array[3];
       array[3] = temp;

       //test of the switch
       cout << "New first "<< array[1] << endl << "new third " << array[3];

       temp = array[2];
       array[2] = array[4];
       array[4] = temp;
       cout << endl;
       //print out encryption

       for (x = 1; x < 5; x++) {
           cout << array[x];

       }

}

In: Computer Science

Problem 1 A project involves the following activities, their predecessors, and the times (in weeks) associated...

Problem 1

A project involves the following activities, their predecessors, and the times (in weeks) associated with each activity.

Activity

Immediate Predecessor

Optimistic (a)

Most Likely (m)

Pessimistic (b)

A

--

1

2

3

B

--

2

3

4

C

--

3

4

5

D

A

4

5

12

E

B

1

3

5

F

B

3

4

11

G

C

5

6

13

H

D, E

8

9

10

I

F, G

4

5

6

J

H, I

1

1

1

a.   Draw a complete network for the above.

b.   Determine the critical path and list all the activities that are on the critical path. What is the expected project completion time?

c.   and Develop the detailed activity schedule for the project (provide a table giving ES, EF, LS, LF, and Slack).

d.   What is the probability that the project will be finished in 21 weeks or less?

e.   What is the probability that the project will take between 19 to 21 weeks to be completed?

f.    If activity F is delayed and takes 10 weeks to complete, would the project completion time be any different? If yes, what would be the critical path and the expected completion time?

In: Operations Management

Out of the 4 issues in collaborative design, which do you think presents the most risk for a company? Why?

Out of the 4 issues in collaborative design, which do you think presents the most risk for a company? Why?

4 issues include:

1. update issues

2. data translation and repair issues

3. internet security and legitimacy issues

4. speed issues

In: Operations Management

hi i need to do a C++ program. You are going to practice the use of...

hi i need to do a C++ program.

You are going to practice the use of array by implementing the interface of Shuttle Puzzle.
Here is an example of how you play the Shuttle Puzzle.
Say that you start with a board with 7 holes and there are 3 black and 3 white marbles on the board in this configuration:
W W W . B B B
The dot (.) represents the empty hole withouth any marble.
The objective of the game is to switch the positions of the black and white marbles, i.e. the puzzle with former configuration should end when the board becomes:
B B B . W W W
You have only two types of moves. You can either

  • slide a marble 1 space (into the empty position), or
    For example, to slide the white (W) marble at index 2: W W W . B B BW W . W B B B
  • jump a marble over 1 and only 1 marble of the opposite color (again, into the empty position).
    For example, to jump the black (B) marble at index 4: W W . W B B BW W B W . B B

You CANNOT jump marbles over more than 1 position, and you CANNOT backtrack your moves (B can only be moved to left, and W can only be moved to right).
In this lab, we are implementing the basic version of the game with 1 empty hole only in between the black and white marbles.

Tasks

You need to use array to implement the interface of shuttle puzzle.

  • Your program should get 2 integers from the player which represent the number of white marbles (num_W) and black marbles (num_B) respectively.
  • The input of every move is an int (position) and a char (operation). You should move the marble at the position with the operation. The direction of this move depends on the color of the marble.
  • If the input position is -1, your program should print "Exit." and then the program ends and exits.
  • While the puzzle solver (player) playing with your program, your program should identify forbidden move, and print "Error!" to warn the puzzle solver.
  • When the puzzle is solved, your program should print "Congratulations!" and exit.

In our test cases, we assume that

  • num_W + num_B < 100, num_W > 0 and num_B > 0
  • the position (index) will be always in the range of [0, num_W + num_B]
  • the operation can only be 'J' (jump) or 'S' (slide)

You can start from skeleton. The skeleton has already divde the tasks into several functions. Feel free to start from scratch and write your own code as long as it implements the game.

For a puzzle with 2 white marbles and 2 black marbles:

Num of white and black marbles: 2 2
[01234]
WW.BB
Index (-1 to exit): 0
'J' or 'S': J
Error!
Index (-1 to exit): 1
'J' or 'S': S
[01234]
W.WBB
Index (-1 to exit): 3
'J' or 'S': J
[01234]
WBW.B
Index (-1 to exit): 4
'J' or 'S': S
[01234]
WBWB.
Index (-1 to exit): 2
'J' or 'S': J
[01234]
WB.BW
Index (-1 to exit): 0
'J' or 'S': J
[01234]
.BWBW
Index (-1 to exit): 1
'J' or 'S': S
[01234]
B.WBW
Index (-1 to exit): 3
'J' or 'S': J
[01234]
BBW.W
Index (-1 to exit): 2
'J' or 'S': S
[01234]
BB.WW
Congratulations!

For a puzzle with 2 white marbles and 3 black marbles:
>>>2 3
>>>3 S
>>>1 J
>>>0 S
>>>2 J
>>>4 J
>>>5 S
>>>3 J
>>>1 J
>>>2 S
>>>4 J
>>>3 S
<<<Congratulations!

'>>>' represents input and '<<<' represents output. We skip the ragular output in above case.

Your output should be exactly the same as the requirement.
You should NOT modify the output code in the skeleton, and you MUST clear all redundant ouput before submit.
You should submit merely 1 source code file.

Skeleton

#include <iostream>
using namespace std;

const int MAX_SIZE = 1000;

/*
 * (Given)
 * Print the current game board
 */
void print(const char board[], int valid_length)
{
    cout << " [";
    for (int i = 0; i < valid_length; ++i)
       cout << i;
    cout << "]" << endl;
    cout << "  ";
    for (int i = 0; i < valid_length; ++i)
       cout << board[i];
    cout << endl;
}

/*
 * Initialize the game board with white (W) marbles on the left and 
 * black (B) marbles on the right, and a gap in between
 * Returns the length of the puzzle, i.e. num_W + 1 + num_B
 */
int initialize(char board[], int num_W, int num_B)
{
    // TODO
}

/*
 * Jump a marble over 1 and only 1 marble of the opposite color into the empty position.
 * You CANNOT jump marbles over more than 1 position, and 
 * you CANNOT backtrack your moves (B can only be moved to left, and W can only be moved to right).
 *
 * Returns true if the jump is valid
 * otherwise, returns false
 */
bool jump(char board[], int length, int index)
{
    // TODO
}

/*
 * Slide a marble 1 space (into the empty position)
 * you CANNOT backtrack your moves (B can only be moved to left, and W can only be moved to right).
 *
 * Returns true if the slide is valid
 * otherwise, returns false
*/
bool slide(char board[], int length, int index)
{
    // TODO
}

/* 
 * Returns true if all black marbles are on the left and white marbles are on the right
 * otherwise, returns false 
 */
bool game_finished(const char board[], int num_W, int num_B)
{
    // TODO
}

int main()
{
    char board[MAX_SIZE] = {};
    int num_W, num_B;

    // Get the number of white (W) & black (B) marbles
    cout << "Num of white and black marbles: ";
    cin >> num_W >> num_B;

    // Initialize the board 
    int length = initialize(board, num_W, num_B);
    print(board, length);

    // Continue while not all marbles are switched
    while(!game_finished(board, num_W, num_B))
    {
        // Get the index (position) for the move (operation), -1 means give up the game
        int index;
        cout << "Index (-1 to exit): ";
        cin >> index;
        if(index == -1)
        {
            cout << "Exit." << endl;
            break;
        }

        // Get the operation, 'J' for jump or 'S' for slide
        char op;
        cout << "'J' or 'S': ";
        cin >> op;
        bool res = false;
        switch (op)
        {
        case 'J':
            res = jump(board, length, index);
            break;
        case 'S':
            res = slide(board, length, index);
            break;
        }
        if(!res)
            cout << "Error!" << endl;
        else 
            print(board, length);
    }

    if(game_finished(board, num_W, num_B))
    {
        cout << "Congratulations!" << endl;
    }

    return 0;
}

Test cases for students

We skip the regular output in the following cases.

Input:
2 2 3 S 1 J 0 S 2 J 4 J 3 S 1 J 2 S
Expected ouput:
Congratulations!

Input:
2 2 0 J 1 S 3 J 4 S 3 S 2 J 0 J 1 S 3 J 2 S
Expected ouput:
Error!
Error!
Congratulations!

Input:
2 2 0 J 1 S 3 J 4 S 3 S -1
Expected ouput:
Error!
Error!
Exit.

Input:
3 3 4 S 2 J 1 S 3 J 5 J 6 S 4 J 2 J 0 J 1 S 3 J 5 J 4 S 2 J 3 S
Expected ouput:
Congratulations!

Input:
4 4 5 S 3 J 2 S 4 J 6 J 7 S 5 J 3 J 1 J 0 S 2 J 4 J 6 J 8 J 7 S 5 J 3 J 1 J 2 S 4 J 6 J 5 S 3 J 4 S
Expected ouput:
Congratulations!

Input:
10 11 11 S 9 J 8 S 10 J 12 J 13 S 11 J 9 J 7 J 6 S 8 J 10 J 12 J 14 J 15 S 13 J 11 J 9 J 7 J 5 J 4 S 6 J 8 J 10 J 12 J 14 J 16 J 17 S 15 J 13 J 11 J 9 J 7 J 5 J 3 J 2 S 4 J 6 J 8 J 10 J 12 J 14 J 16 J 18 J 19 S 17 J 15 J 13 J 11 J 9 J 7 J 5 J 3 J 1 J 0 S 2 J 4 J 6 J 8 J 10 J 12 J 14 J 16 J 18 J 20 J 21 S 19 J 17 J 15 J 13 J 11 J 9 J 7 J 5 J 3 J 1 J 2 S 4 J 6 J 8 J 10 J 12 J 14 J 16 J 18 J 20 J 19 S 17 J 15 J 13 J 11 J 9 J 7 J 5 J 3 J 4 S 6 J 8 J 10 J 12 J 14 J 16 J 18 J 17 S 15 J 13 J 11 J 9 J 7 J 5 J 6 S 8 J 10 J 12 J 14 J 16 J 15 S 13 J 11 J 9 J 7 J 8 S 10 J 12 J 14 J 13 S 11 J 9 J 10 S 12 J 11 S
Expected ouput:
Congratulations!

In: Computer Science