Questions
It has been postulated that a student is more likely to smoke marijuana if both parents...

It has been postulated that a student is more likely to smoke marijuana if both parents use alcohol and drugs. A paper published in Youth and Society (1979) reported that among 570 students whose parents use alcohol and drugs, 320 regularly smoke marijuana.

a. Is there any evidence that a student is more likely to smoke marijuana if both parents use alcohol and drugs?

b. Joann is planning for a new study on this problem. Suppose no prior information is available, what is the minimum sample size required such that the length of the 92.32% confidence interval for the true proportion of students smoke marijuana if both parents use alcohol and drugs is at most 0.075?

In: Math

"Imagine that you are the director of student affairs at a small liberal arts college in...

"Imagine that you are the director of student affairs at a small liberal arts college in the Midwest. During a staff meeting, the president of the college shares a number of complaints. The complaints allege that many LGBT students encounter prejudice and discrimination both on campus and among townspeople. The students feel that these problems are college-wide and need to be addressed by the president and her staff as well as by community leaders.

The president asks you to create an action plan. She feels that the college needs to open the lines of communication and encourage inclusive, honest dialogue on this issue.

Develop a summary of what you propose. Include the rationale behind your action plan."

In: Operations Management

An educational researcher wishes to know if there is a difference in academic performance for college...

An educational researcher wishes to know if there is a difference in academic performance for college freshmen that live on campus and those that commute. Data was collected from 267 students. Can we conclude that freshman housing location and academic performance are related? Location Average Below Average Above Average Total On campus 89 29 27 145 Off campus 36 43 43 122 Total 125 72 70 267 Copy Data Step 2 of 8 : Find the expected value for the number of students that live on campus and have academic performance that is average. Round your answer to one decimal place.

In: Math

.data A: .space 80 # create integer array with 20 elements ( A[20] ) size_prompt: .asciiz...

.data

A:                              .space 80       # create integer array with 20 elements ( A[20] )
size_prompt:            .asciiz         "Enter array size [between 1 and 20]: "
array_prompt:           .asciiz         "A["
sorted_array_prompt:    .asciiz         "Sorted A["
close_bracket:          .asciiz         "] = "
search_prompt:          .asciiz "Enter search value: "
not_found:                      .asciiz " not in sorted A"
newline:                        .asciiz         "\n"    

.text

main:   
        # ----------------------------------------------------------------------------------
        # Do not modify
        la $s0, A                       # store address of array A in $s0
  
        add $s1, $0, $0                 # create variable "size" ($s1) and set to 0
        add $s2, $0, $0                 # create search variable "v" ($s2) and set to 0
        add $t0, $0, $0                 # create variable "i" ($t0) and set to 0

        addi $v0, $0, 4                 # system call (4) to print string
        la $a0, size_prompt             # put string memory address in register $a0
        syscall                         # print string
  
        addi $v0, $0, 5                 # system call (5) to get integer from user and store in register $v0
        syscall                         # get user input for variable "size"
        add $s1, $0, $v0                # copy to register $s1, b/c we'll reuse $v0
  
prompt_loop:
        # ----------------------------------------------------------------------------------
        slt $t1, $t0, $s1               # if( i < size ) $t1 = 1 (true), else $t1 = 0 (false)
        beq $t1, $0, end_prompt_loop     
        sll $t2, $t0, 2                 # multiply i * 4 (4-byte word offset)
                                
        addi $v0, $0, 4                 # print "A["
        la $a0, array_prompt                    
        syscall  
                                        
        addi $v0, $0, 1                 # print value of i (in base-10)
        add $a0, $0, $t0                        
        syscall 
                                        
        addi $v0, $0, 4                 # print "] = "
        la $a0, close_bracket           
        syscall                                 
        
        addi $v0, $0, 5                 # get input from user and store in $v0
        syscall                         
        
        add $t3, $s0, $t2               # A[i] = address of A + ( i * 4 )
        sw $v0, 0($t3)                  # A[i] = $v0 
        addi $t0, $t0, 1                # i = i + 1
                
        j prompt_loop                   # jump to beginning of loop
        # ----------------------------------------------------------------------------------    
end_prompt_loop:

        addi $v0, $0, 4                 # print "Enter search value: "
        la $a0, search_prompt                   
        syscall 
        
        addi $v0, $0, 5                 # system call (5) to get integer from user and store in register $v0
        syscall                         # get user input for variable "v"
        add $s2, $0, $v0                # copy to register $s2, b/c we'll reuse $v0

        # ----------------------------------------------------------------------------------
        # TODO: PART 1
        #       Translate C code into MIPS (bubble sort)
        #       The above code has already created array A and A[0] to A[size-1] have been 
        #       entered by the user. After the bubble sort has been completed, the values im
        #       A are sorted in increasing order, i.e. A[0] holds the smallest value and 
        #       A[size -1] holds the largest value.
        #       
        #       int t = 0;
        #       
        #       for ( int i=0; i<size-1; i++ ) {
        #               for ( int j=0; j<size-1-i; j++ ) {
        #                       if ( A[j] > A[j+1] ) {
        #                               t = A[j+1];
        #                               A[j+1] = A[j];
        #                               A[j] = t;
        #                       }
        #               }
        #       }
        #                       
        # ----------------------------------------------------------------------------------
        

        # ----------------------------------------------------------------------------------
        # TODO: PART 2
        #       Translate C code into MIPS (binary search)
        #       The array A has already been sorted by your code above int PART 1, where A[0] 
        #       holds the smallest value and A[size -1] holds the largest value, and v holds 
        #       the search value entered by the user
        #       
        #       int left = 0;
        #       int right = size - 1;
        #       int middle = 0;
        #       int element_index = -1;
        #
        #       while ( left <= right ) { 
      #
      #         middle = left + (right - left) / 2; 
        #
      #         if ( A[middle] == v) {
      #                         element_index = middle;
      #                         break;
      #         }
      #
      #         if ( A[middle] < v ) 
      #                         left = middle + 1; 
      #         else
      #                         right = middle - 1; 
        #
        #       } 
        #
        #       if ( element_index < 0 ) 
        #               printf( "%d not in sorted A\n", v );
        #       else 
        #               printf( "Sorted A[%d] = %d\n", element_index, v );
        #                       
        # ----------------------------------------------------------------------------------

        
# ----------------------------------------------------------------------------------
# Do not modify the exit
# ----------------------------------------------------------------------------------
exit:                     
  addi $v0, $0, 10                      # system call (10) exits the progra
  syscall                               # exit the program
  

In: Computer Science

can someone fix the infinite loop, it's stupid question, I don't know why for add field...

can someone fix the infinite loop, it's stupid question, I don't know why for add field I get an infinite loop, but not for anything else

#include<iostream>
#include<string>
#include<vector>
using namespace std;

int n, n2;
int n3;
int id; int m;
char keno[50]; int x;
struct entity
{
   string random_words{};

   string title{};
   char keno[50]{};
   int y_tho{};
   int random_numbers{};
   int ID{};
   int id{};
   int I_hate_this{};
   int x{};
   int m{};
};

int main()
{
   cout << "Generic database creation program.";
   //vector to store employee data
   vector< struct entity* > v;

   entity e;

   //loop to take continuous data from user
   while (1)
   {
       cout << "What would you like to do next?\n" << "1. Add entity\n" << "2. Edit entity\n" << "3. Remove entity\n" << "4. Print entity info\n" << "5. Stop the program\n" << ">> ";

       cin >> n;

       int ID, id, pos;
       struct entity* entity = new struct entity();

       switch (n)
       {
       case 1:
           //Please start with 0 in console, I don't know how to automatically assign them
           cin >> entity->ID;
           cout << "The new entity with ID " << entity->ID << " has been added to the database.\n";

           v.push_back(entity); //Learned to use v.push_back from discord chat, not my own idea
           break;

       case 2:

           cout << "Please enter ID of the entity to edit: ";
           cin >> ID;

           cout << "Editing entity (ID " << ID << " )... ";

           pos = -1;
           for (size_t i = 0; i < v.size(); i++)
           {
               if (v[i]->ID == ID)
               {
                   pos = i;
               }
           }
           while (1)
           {

               cout << "What would you like to do next\n";
               cout << "1. Add field\n";
              cout << "2. Edit field\n";
               cout << "3. Remove field\n";
           cout << "4. Go back to main menu\n";

           cin >> m;
           switch (m)
           {

               while (1)
               {
           case 1:

                   cout << "Adding field to entity ( ID " << ID << ") named: >>"; cin.get(e.keno, 50);
                   cout << "Select type : 0 - characters, 1 - integer, 2 - float, 3 - boolean: >>" ;                     

                   if (x == 0)
                   {
                       getline(cin, entity->random_words);
                       v.push_back(entity);
                   }

                   else if (x == 1)
                   {
                       cin >> entity->y_tho;
                       v.push_back(entity);
                   }

                   else if (x == 2)
                   {
                       cin >> entity->random_numbers;
                       v.push_back(entity);
                   }

                   else
                   {
                       getline(cin, entity->random_words);
                       v.push_back(entity);
                   }
                   break;


                   case 2:
                   cout << "Please enter ID of the field to edit: ";
                   cin >> ID;

                   cout << "Editing entity (ID " << ID << " )... ";

                   pos = -1;
                   for (size_t i = 0; i < v.size(); i++)
                   {
                   if (v[i]->ID == ID)
                       {
                           pos = i;
                       }
                   }
                       break;

                   case 3:

                   cout << " Please provide field ID you want to remove: >> ";
                   cin >> ID;
                   pos = -1;
                   for (size_t i = 0; i < v.size(); i++)
                   {
                       if (v[i]->ID == ID)
                       {
                           pos = i;
                       }
                   }
                   v.erase(v.begin() + ID);
                   break;

                   case 4: {
                       break; }
                     

               }
                   break;
           }
             
           }

             
          
           v.push_back(entity); //Learned to use v.push_back from discord chat, not my own idea
           break;

       case 3:

           cout << " Please provide entity ID: >> ";
           cin >> ID;
           pos = -1;
           for (size_t i = 0; i < v.size(); i++) {
               if (v[i]->ID == ID) {
                   pos = i;
               }
           }
           v.erase(v.begin() + ID);
           break;

       case 4:

           cout << " Please provide entity ID: >> ";
           cin >> ID;
           //search for that employee in our database
           pos = -1;
           for (size_t i = 0; i < v.size(); i++) {
               if (v[i]->ID == ID) {
                   ID = i;
               }
           }
           cout << "Entity ID " << ID << " has" << ID << " fields";
           cout << "[Field " << ID << v[ID]->title;
           break;

       case 5:

           return 0;

       }

      
   }
}

use c++

In: Computer Science

The local driver's license office has asked you to design a program that grades the written...

The local driver's license office has asked you to design a program that grades the written portion of the driver's license exam. The exam has 20 multiple choice questions. Here are the correct answers:

B
D
A
A
C
A
B
A
C
D
B
C
D
A
D
C
C
B
D
A
Your program should store these correct answers in an list. (Store each question's correct answer in an element of a String list). The program should ask the user to enter the student's answers for each questions, which should be stored in another list. After the student's answers have been entered, the program should display a message indicating whether the student passed or failed the exam. (A student must correctly answer 15 of the 20 questions to pass the exam). The program should also display the total number of correctly answered questions, the total number of incorrectly answered questions, and a list showing the question numbers of the incorrectly answered questions.

Notes:

1. Python program

2. Your program needs three lists: the first list holds the correct answers, the second list holds the student's answers, and the third list holds the question numbers for those questions that are not answered correctly.

3. Input validation is required for student's answers: when the input is not A, B, C, or D, your program needs to display an error message and get another input. The input validation is done using a while loop.

4. After getting the student's answers, the program will compare the two lists. If a question is answered wrong, the question number of that question will be put into the third list.

In: Computer Science

The local driver's license office has asked you to design a program that grades the written...

The local driver's license office has asked you to design a program that grades the written portion of the driver's license test. The test has 20 multiple choice questions. Here are the correct answers:

  1. B
  2. D
  3. A
  4. A
  5. C
  6. A
  7. B
  8. A
  9. C
  10. D
  11. B
  12. C
  13. D
  14. A
  15. D
  16. C
  17. C
  18. B
  19. D
  20. A

Your program should store these correct answers in an list. (Store each question's correct answer in an element of a String list). The program should ask the user to enter the student's answers for each questions, which should be stored in another list. After the student's answers have been entered, the program should display a message indicating whether the student passed or failed the test. (A student must correctly answer 15 of the 20 questions to pass the test). The program should also display the total number of correctly answered questions, the total number of incorrectly answered questions, and a list showing the question numbers of the incorrectly answered questions.

Notes:

1. pseducode and Python program

2. Your program needs three lists: the first list holds the correct answers, the second list holds the student's answers, and the third list holds the question numbers for those questions that are not answered correctly.

3. Input validation is required for student's answers: when the input is not A, B, C, or D, your program needs to display an error message and get another input. The input validation is done using a while loop.

4. After getting the student's answers, the program will compare the two lists. If a question is answered wrong, the question number of that question will be put into the third list.

In: Computer Science

4.2 Lab: new and delete new is the operator used to dynamically allocate memory while the...

4.2 Lab: new and delete

new is the operator used to dynamically allocate memory while the program is running

delete is the operator used to release memory when it is no longer needed, so it could be used next time new is used

This lab gives you an example of using new and delete with an array of structures.

Your tasks are listed below:

  • review the existing code
  • finish writing the copyList()function

// Lab: new and delete
#include <iostream>
#include <string>
using namespace std;

struct Stu{
string name;
double gpa;
};

Stu *copyList(Stu list[], int n);
void printList(Stu *list, int n, string desc);

int main() {

Stu list[10] = {{"Tom", 3.5}, {"Bob", 2.9}, {"Ann", 3.2}, {"Dan", 3.1}, {"Zoe", 2.9}};
Stu *backup;
int n = 5;

printList(list, n, "Original");
backup = copyList(list, 5);
printList(list, n, "Backup");

// Release memory
delete [] backup;

return 0;
}
// This function dynamically allocates an array of n STU structures,
// copies data from list to the new array, one element at a time,
// and returns a pointer to the new array
Stu *copyList(Stu list[], int n)
{
Stu *backup;

/* write your code here */

return backup;
}

// This functions displays an array of structures
// Note: it doesn't matter if the array is
// statically allocated or dynamically allocated
void printList(Stu *anyList, int n, string desc)
{
cout << endl << desc << endl;
for (int i = 0; i < n; i++)
{
cout << anyList[i].name << " " << anyList[i].gpa << endl;
}
}

// please do not use any recursive functions or anything, this simply testing pointers

In: Computer Science

Data set for ages of students in stats class: 17, 18, 18, 18, 18, 18, 18,...

Data set for ages of students in stats class:

17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,19, 20, 20, 20, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 25, 25, 25, 26, 26, 27, 28, 28, 28, 28, 29, 29, 32, 36, 42

1) Find the standard deviation of the ages and use it to calculate a 95% confidence interval for the true mean age (be sure to use the correct degrees of freedom). Do the median and the mode fall into this range?

2) Someone once told me that the average age of PSU students is 26. Does this value fall within the confidence interval? If 26 is the true mean and σ=5, what is the probability that we would observe a sample mean in our sample (n=49) that is less than 24? Given these answers, would you agree that 26 is the true mean?

3) Find the proportion of students who can legally drink alcohol in the State of Oregon (students who are 21 or over). Use this to find a 90% confidence interval for the true proportion of PSU students that can drink. If we wanted the margin of error to be less than .05, what is the minimum sample size that we would need?

4) Assume that student ages are normally distributed and that the mean and standard deviation of the sample are the true population values. Under this assumption, what would be the probability of that someone would be able to drink, to wit, find P(X>21)? Does this value fall within the confidence interval you found in problem 4?

5) Compute the 5-number summary and create a modified box-plot, using the inner-quartile range to identify any outliers.

6) Construct a histogram of the data (starting at 16.5, use a class width of 3). Is the data skewed? If so, is it skewed right or left? What factors in the population (such as a natural boundary) may be causing this? How does this affect problems 2 and 4?

7) Suppose we are trying to use this sample to infer something about the ages of all PSU students. Explain why this is not a truly random

sample and how it may be biased compared to the PSU student population at large. How does this affect problem 2?

8) Find a 95% confidence interval for the true standard deviation of ages.

In: Statistics and Probability

As you might expect, there has been a spirited discussion about which method is most effective...

As you might expect, there has been a spirited discussion about which method is most

effective in terms of the effectiveness of delivering course content, student and faculty

acceptance of different modes of instruction and the cost to the state of using different

delivery methods. As a result of this discussion, five questions have arisen that require

the use of statistics to answer them. They are:

1. Does student learning as indicated by average grades suffer if they are taught

using alternative modes of instruction: traditional in-class teaching, on-line

learning, or mixed on-line/in-class method?

2. Do students have a preference for which type of learning to which they are

exposed?

3. Is the acceptance of students of on-line methods independent of their majors?

4. Is the proportion of faculty members favoring on-line or mixed delivery the same

for all colleges within the university?

5. Does the average amount of additional instructor time required to deliver courses

on-line differ according to the type of courses?

It is suspected that the opinions of students regarding the preferred method of teaching may be dependent upon the college in which they are enrolled. For example, students enrolled the sciences or professional schools may feel that close personal interaction with their professors is essential while students enrolled in other colleges may prefer a more independent approach to their studies.

In order to determine if student’s opinions regarding the method of teaching are independent of the college in which their major is housed, a survey of 330 students gathered data on their opinions regarding the shift to on-line studies and the colleges of their majors. The data are presented below in the Table. Use hypothesis testing to determine if the data indicates that Student Opinions are independent of College Major.

Physical Sciences Education Nursing Business and Technology Arts and Humanities TOTALS
Favor In-Class 11 30 14 20 55 130
Favor On-Line 20 29 9 27 33 118
Favor Mixed 19 21 7 13 22 82
TOTALS: 50 80 30 60 110 330

Please provide a statistical analysis. You are required to submit the following information:

1.) The null and alternative hypotheses being tested.

2.) The Critical test statistic (F or Chi-Square) from the appropriate table. If it required using the Tukey- Kramer method, show the Q score from the table AND the critical value that you used to make your decisions. Also, specify which mean or means are not equal.

3.) The calculated value that you arrived at and the p-Value.

4.) Your decision, reject or do not reject.

PLEASE INCLUDE: A separate part of the answer must be a memo that answers each of the 5 questions at the top and explains why you answered as you did using the results of your statistical testing.

In: Statistics and Probability