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
A professor at a local university designed an experiment to see if someone could identify the color of a candy based on taste alone. Students were blindfolded and then given a red-colored or yellow-colored candy to chew. (Half the students were assigned to receive the red candy and half to receive the yellow candy. The students could not see what color candy they were given.) After chewing, the students were asked to guess the color of the candy based on the flavor. Of the
122122
students who participated in the study,
7878
correctly identified the color of the candy. The results are shown in the accompanying technology printout. Complete parts a through c below.
LOADING...
Click the icon to view the technology printout.
a. If there is no relationship between color and
candy flavor, what proportion of the population of students
would correctly identify the color?
The proportion would be
0.50.5.
(Type an integer or a decimal.)
b. Specify the null and alternative hypotheses for testing whether color and flavor are related. Choose the correct hypotheses below.
A.
Upper H 0 : p equals 0.50 vs. Upper H Subscript a Baseline : p greater than 0.50H0: p=0.50 vs. Ha: p>0.50
B.
Upper H 0 : p equals 0.50 vs. Upper H Subscript a Baseline : p less than 0.50H0: p=0.50 vs. Ha: p<0.50
C.
Upper H 0 : p not equals 0.50 vs. Upper H Subscript a Baseline : p equals 0.50H0: p≠0.50 vs. Ha: p=0.50
Your answer is not correct.
D.
Upper H 0 : p less than 0.50 vs. Upper H Subscript a Baseline : p equals 0.50H0: p<0.50 vs. Ha: p=0.50
E.
Upper H 0 : p equals 0.50 vs. Upper H Subscript a Baseline : p not equals 0.50H0: p=0.50 vs. Ha: p≠0.50
This is the correct answer.
F.
Upper H 0 : p greater than 0.50 vs. Upper H Subscript a Baseline : p equals 0.50H0: p>0.50 vs. Ha: p=0.50
c.
Carry out the test and give the appropriate conclusion at
alphaαequals=0.010.01.
Use the p-value of the test, shown on the accompanying technology printout, to make your decision.
The p-value is
0.0020.002.
(Type an integer or a decimal.)
Make the appropriate conclusion using
alphaαequals=0.010.01.
A.
RejectReject
the null hypothesis, because the p-value is
not less thannot less than
alphaα.
There is
insufficientinsufficient
evidence to conclude that color and flavor are related.
B.
Do not rejectDo not reject
the null hypothesis, because the p-value is not
not less thannot less than
alpha
In: Statistics and Probability
Complete the program to read in values from a text file. The values will be the scores on several assignments by the students in a class. Each row of values represents a specific student's scores. Each column represents the scores of all students on a specific assignment. So a specific value is a specific student's score on a specific assignment. The first two values in the text file will give the number of students (number of rows) and the number of assignments (number of columns), respectively.
For example, if the file contains:
3
4
9 6 10 5
2 2 0 0
10 10 9 10
then it represents the scores for 3 students on 4 assignments as follows:
| Assignment 1 | Assignment 2 | Assignment 3 | Assignment 4 | |
| Student 1 | 9 | 6 | 10 | 5 |
| Student 2 | 2 | 2 | 0 | 0 |
| Student 3 | 10 | 10 | 9 | 10 |
The program should:
1) Read in the first two values to get the number of students and number of assignments. Create a two-dimensional array of integers to store all the scores using these dimensions.
2) Read in all the scores into the 2-D array.
3) Print the whole array, row by row on separate lines, using Arrays.toString() on each row of the array
3) Print the average of the scores on each assignment. For example, if the data is given in the above example, the output would be:
Array of scores:
[9, 6, 10, 5]
[2, 2, 0, 0]
[10, 10, 9, 10]
Average score of each assignment:
Assignment #1 Average = 7.0
Assignment #2 Average = 6.0
Assignment #3 Average = 6.333333333333333
Assignment #4 Average = 5.0
Starter Code:
import java.util.Scanner;
import java.io.File; //needed to open the file
import java.io.FileNotFoundException; //needed to declare possible
error when opening file
import java.util.Arrays; //for the Arrays.toString() method
public class Scores {
public static void main(String[] args) throws FileNotFoundException
{
//create a Scanner to get input from the keyboard to ask the user
for the file name
Scanner keyboard = new Scanner(System.in);
System.out.println("What is the name of the file containing the
scores?");
//create another Scanner to read from the file
String fileName = keyboard.nextLine();
Scanner fileScan = new Scanner(new File(fileName));
//TODO: read in the values for the number of students and number of
assignments using the Scanner on the file
//TODO: create a 2-D to store all the scores and read them all in
using the Scanner on the file
System.out.println("Array of scores:");
//TODO: print the entire array, row by row, using
Arrays.toString()
System.out.println("Average score of each assignment:");
//TODO: compute and print the average on each assignment
In: Computer Science
In: Computer Science
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:
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 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:
// 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
I'm getting an error for this code? it won't compile
import java.util.*;
import java.io.*;
public class Qup3 implements xxxxxlist {// implements
interface
// xxxxxlnk class variables
// head is a pointer to beginning of rlinked
list
private node head;
// no. of elements in the list
// private int count;
// xxxxxlnk class constructor
Qup3() {
head = null;
count = 0;
} // end Dersop3 class constructor
PrintStream prt = System.out;
// class node
private class node {
// class node variables
int data;
node rlink;
// class node constructor
node(int x) {
data = x;
rlink =
null;
} // class node constructor
} // end class node
// isEmpty() returns true if list is empty, false
otherwise.
public boolean isEmpty() {
return (count == 0);
} // end isEmpty
// length() returns number of list elements.
public int length() {
return count;
} // end length
// insert x at position p, for successful
insertion:
// list should not be full and 1 <= p <=
count+1
public int insert(int x, int p) {
int i;
prt.printf("\n Insert %4d at
position %2d:", x, p);
if (p < 1 || p > ( count + 1)
) {
return 0;
}
node tmp = new node(x);
// p == 1 Inserts x to front of
list,
// is a special case where head
changes
if (p == 1) {
tmp.rlink =
head;
head =
tmp;
} else {// traverse the list till
element before p
node current =
head;
// Find node
before p
for (i = 2; i
< p; i++, current = current.rlink)
; // end for
// insert node
after cur node
tmp.rlink =
current.rlink;
current.rlink =
tmp;
}
count++;
return 1; // successful
insertion
} // end insert
// delete x at position p, for successful
deletion:
// list should not be empty and 1 <= p <=
count
public int delete(int p) {
prt.printf("\n Delete element at
position %2d:", p);
if (isEmpty() || p < 1 || p >
length())
return 0; //
invalid deletion
int count = length();
node tmp = head;
// p == 1 deletes front of
list.
// This is a special case where
head changes
if (p == 1) { // Delete Front of
List
head =
head.rlink;
tmp.rlink =
null;
} else { // Find
node before p
node current =
head;
for (int i = 2;
i < p; i++, current = current.rlink; ) ;// end for
// Delete node
after current node
tmp =
current.rlink;
current.rlink =
tmp.rlink;
tmp.rlink =
null; // delete tmp;
}
count--;
return 1; // successful
deletion
} // end delete
// sequential serach for x in the list
// if successful return position of x in the
// list otherwise return 0;
public int searchx(int x) {
prt.printf("\n search for %4d:",
x);
// complete the rest
//.........
return 0;
} // end searchx
// print list elements formatted
public void printlist() {
prt.print("\n List contents:
");
for (node current = head; current
!= null; current = current.rlink)
prt.printf("%4d,
", current.data);
// end for
} // end printlist
public static void main(String args[]) throws
Exception {
int j, m, k, p, x, s;
try {
// open input
file
Scanner inf =
new Scanner(System.in);
// Create a List
of type Integer of size n
Qup3 lst = new
Qup3();
// read no.
of elements to insert
m =
inf.nextInt();
System.out.printf("\n\tInsert %2d elements in the list.", m);
for (j = 1; j
<= m; j++) {
x = inf.nextInt(); // read x
p = inf.nextInt(); // read position
s = lst.insert(x, p); // insert x at position
p
if (s == 1)
System.out.printf("
Successful insertion.");
else
System.out.printf(" %2d is
invalid position for insertion.", p);
} // end
for
lst.printlist();
// print linked list elements
// read no. of
elements to search in the list
m =
inf.nextInt();
System.out.printf("\n\tSearch for %d elements in the list.",
m);
for (j = 1; j
<= m; j++) {
x = inf.nextInt(); // read x
p = lst.searchx(x); // search for x
if (p > 0)
System.out.printf(" found at
position %d.", p);
else
System.out.printf(" is not
found.");
} // end
for
// read no. of positions to delete from
list
m =
inf.nextInt();
System.out.printf("\n\tDelete %d elements from list.", m);
for (j = 1; j
<= m; j++) {
p = inf.nextInt(); // read position
s = lst.delete(p); // delete position p
if (s == 1)
System.out.printf("
Successful deletion.");
else
System.out.printf(" %2d is
invalid position for deletion.", p);
} // end
for
lst.printlist();
// print array elements
inf.close(); //
close input file
} catch (Exception e) {
System.out.print("\nException " + e + "\n");
}
System.out.print("\tAuthor: G. Dastghaibyfard \tDate:
" +
java.time.LocalDate.now());} // end main
} // end class xxxxxlnk
In: Computer Science
Programming Project 3
Home Sales
Program Behavior
This program will analyze real estate sales data stored in an input file. Each run of the program should analyze one file of data. The name of the input file should be read from the user.
Here is a sample run of the program as seen in the console window. User input is shown in blue:
Let's analyze those sales!
Enter the name of the file to process? sales.txt
Number of sales: 6
Total: 2176970
Average: 362828
Largest sale: Joseph Miller 610300
Smallest sale: Franklin Smith 199200
Now go sell some more houses!
Your program should conform to the prompts and behavior displayed above. Include blank lines in the output as shown.
Each line of the data file analyzed will contain the buyer's last name, the buyer's first name, and the sale price, in that order and separated by spaces. You can assume that the data file requested will exist and be in the proper format.
The data file analyzed in that example contains this data:
Cochran Daniel 274000
Smith Franklin 199200
Espinoza Miguel 252000
Miller Joseph 610300
Green Cynthia 482370
Nguyen Eric 359100
You can download that sample data file here to test your program, but your program should process any data file with a similar structure. The input file may be of any length and have any filename. You should test your program with at least one other data file that you make.
Note that the average is printed as an integer, truncating any fractional part.
Your program should include the following functions:
read_data - This function should accept a string parameter representing the input file name to process and return a list containing the data from the file. Each element in the list should itself be a list representing one sale. Each element should contain the first name, last name, and purchase price in that order (note that the first and last names are switched compared to the input file). For the example given above, the list returned by the read_data function would be:
[['Daniel', 'Cochran', 274000], ['Franklin', 'Smith', 199200], ['Miguel', 'Espinoza', 252000], ['Joseph', 'Miller', 610300], ['Cynthia', 'Green', 482370], ['Eric', 'Nguyen', 359100]]
Use a with statement and for statement to process the input file as described in the textbook.
compute_sum - This function should accept the list of sales (produced by the read_data function) as a parameter, and return a sum of all sales represented in the list.
compute_avg - This function should accept the list of sales as a parameter and return the average of all sales represented in the list. Call the compute_sum function to help with this process.
get_largest_sale - This function should accept the list of sales as a parameter and return the entry in the list with the largest sale price. For the example above, the return value would be ['Joseph', 'Miller', 610300].
get_smallest_sale - Like get_largest_sale, but returns the entry with the smallest sale price. For the example above, the return value would be ['Franklin', 'Smith', 199200].
Do NOT attempt to use the built-in functions sum, min, or max in your program. Given the structure of the data, they are not helpful in this situation.
main - This function represents the main program, which reads the file name to process from the user and, with the assistance of the other functions, produces all output. For this project, do not print output in any function other than main.
Other than the definitions of the functions described above, the only code in the module should be the following, at the end of the file:
if __name__ == '__main__':
main()
That if statement keeps your program from being run when it is initially imported into the Web-CAT test environment. But your program will run as normal in Thonny. Note that there are two underscore characters before and after name and main.
Include an appropriate docstring comment below each function header describing the function.
Do NOT use techniques or code libraries that have not been covered in this course.
Include additional hashtag comments to your program as needed to explain specific processing.
A Word about List Access
A list that contains lists as elements operates the same way that any other lists do. Just remember that each element is itself a list. Here's a list containing three elements. Each element is a list containing integers as elements:
my_list = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]
So my_list[0] is the list [1, 2, 3, 4] and my_list[2] is [9, 10, 11, 12].
Since my_list[2] is a list, you could use an index to get to a particular value. For instance, my_list[2][1] is the integer value 10 (the second value in the third list in my_list).
In this project, the sales list is a list of lists. When needed, you can access a particular value (first name, last name, or sales price) from a particular element in the sales list.
In: Computer Science
Long Integer Addition
For this assignment you are to write a class that supports the addition of extra long integers, by using linked-lists. Longer than what is supported by Java's built-in data type, called long.
Your program will take in two strings, consisting of only digits, covert each of them to a linked-list that represents an integer version on that string. Then it will create a third linked-list that represents the sum of both of the linked lists. Lastly, it will print out the result of the sum.
Conceptual Example
For the string: "12", create a list:
head->1->2->null
For the string: "34", create a list:
head->3->4->null
Add the two lists to create a third list:
head->4->6->null
print the resulting linked list as "46"
Where "->" represents a link.
Keep in mind that the conceptual example above is conceptual. It does suggest a certain implementation. However as you read on you will see that you have several options for implementing your solution. You need not use the suggested implementation above.
For this class you are to implement a minimum of three methods. They are:
A method called makeSDList() that takes in a string, consisting only of digits, as an argument, and creates and returns a linked-link representation of the argument string.
The method has the following header:
SDList makeSDList(String s) { }
where s is a string, and SDList is the class name of the linked list.
A method called addLists() that takes takes two lists, adds them together, and creates and returns a list that represents the sum of both argument lists.
The method has the following header:
SDList addLists(SDList c) { }
wherec linked-list of type SDList .
A method called displayList() that takes takes a list, prints the value of each digit of the list.
The method has the following header:
void displayList() { }
Programming Notes
Programming Rules:
Submission Rules:
1. Submit only one Homework5.java file for all test cases. The starter file is names Homework5a.java so you will need rename the file before you begin submitting your solution.
2. Anything submitted to Mimir is considered to be officially submitted to me and is considered to be 100% your work. Even if it is not your last planned submission.
3. Any extra testing code that you wrote and used to do your own testing should be deleted from the file that gets used in the final grading. I emphasize the word deleted. Commenting out code is not sufficient and not considered deleted. It must be completely removed. English comments written to explain your code are perfectly fine.
STARTER CODE
import java.util.Scanner; // Import the Scanner class
public class Homework5a {
public static void main(String[] args) {
SDList x, y, z;
String a, b;
Scanner input = new Scanner(System.in); // Create a Scanner object
System.out.print("A: ");
a = input.nextLine();
x = makeSDList(a); // convert first string to a linked list
x.displayList(); // call function that displays list x
System.out.print("B: ");
b = input.nextLine();
y = makeSDList(b); // convert second string to a linked list
y.displayList(); // call function that displays list z
z = x.addLists(y); // add lists x & y and store result in list y
System.out.print("A+B: ");
z.displayList(); // call function that displays list z
}
public static SDList makeSDList(String s) {
// put your solution here
return null;
}
}
class SDList {
// put your solution here
public SDList addLists(SDList c) {
// put your solution here
return null; //replace if necessary
}
public void displayList() {
// put your solution here
}
}
In: Computer Science
Program Behavior
This program will analyze real estate sales data stored in an input file. Each run of the program should analyze one file of data. The name of the input file should be read from the user.
Here is a sample run of the program as seen in the console window. User input is shown in blue:
Let's analyze those sales!
Enter the name of the file to process? sales.txt
Number of sales: 6
Total: 2176970
Average: 362828
Largest sale: Joseph Miller 610300
Smallest sale: Franklin Smith 199200
Now go sell some more houses!
Your program should conform to the prompts and behavior displayed above. Include blank lines in the output as shown.
Each line of the data file analyzed will contain the buyer's last name, the buyer's first name, and the sale price, in that order and separated by spaces. You can assume that the data file requested will exist and be in the proper format.
The data file analyzed in that example contains this data:
Cochran Daniel 274000
Smith Franklin 199200
Espinoza Miguel 252000
Miller Joseph 610300
Green Cynthia 482370
Nguyen Eric 359100
You can download that sample data file here https://drive.google.com/file/d/1bkW8HAvPtU5lmFAbLAJQfOLS5bFEBwf6/view?usp=sharing to test your program, but your program should process any data file with a similar structure. The input file may be of any length and have any filename. You should test your program with at least one other data file that you make.
Note that the average is printed as an integer, truncating any fractional part.
Your program should include the following functions:
read_data - This function should accept a string parameter representing the input file name to process and return a list containing the data from the file. Each element in the list should itself be a list representing one sale. Each element should contain the first name, last name, and purchase price in that order (note that the first and last names are switched compared to the input file). For the example given above, the list returned by the read_data function would be:
[['Daniel', 'Cochran', 274000], ['Franklin', 'Smith', 199200], ['Miguel', 'Espinoza', 252000], ['Joseph', 'Miller', 610300], ['Cynthia', 'Green', 482370], ['Eric', 'Nguyen', 359100]]
Use a with statement and for statement to process the input file as described in the textbook.
compute_sum - This function should accept the list of sales (produced by the read_data function) as a parameter, and return a sum of all sales represented in the list.
compute_avg - This function should accept the list of sales as a parameter and return the average of all sales represented in the list. Call the compute_sum function to help with this process.
get_largest_sale - This function should accept the list of sales as a parameter and return the entry in the list with the largest sale price. For the example above, the return value would be ['Joseph', 'Miller', 610300].
get_smallest_sale - Like get_largest_sale, but returns the entry with the smallest sale price. For the example above, the return value would be ['Franklin', 'Smith', 199200].
Do NOT attempt to use the built-in functions sum, min, or max in your program. Given the structure of the data, they are not helpful in this situation.
main - This function represents the main program, which reads the file name to process from the user and, with the assistance of the other functions, produces all output. For this project, do not print output in any function other than main.
Other than the definitions of the functions described above, the only code in the module should be the following, at the end of the file:
if __name__ == '__main__':
main()
That if statement keeps your program from being run when it is initially imported into the Web-CAT test environment. But your program will run as normal in Thonny. Note that there are two underscore characters before and after name and main.
Include an appropriate docstring comment below each function header describing the function.
Do NOT use techniques or code libraries that have not been covered in this course.
Include additional hashtag comments to your program as needed to explain specific processing.
A Word about List Access
A list that contains lists as elements operates the same way that any other lists do. Just remember that each element is itself a list. Here's a list containing three elements. Each element is a list containing integers as elements:
my_list = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]
So my_list[0] is the list [1, 2, 3, 4] and my_list[2] is [9, 10, 11, 12].
Since my_list[2] is a list, you could use an index to get to a particular value. For instance, my_list[2][1] is the integer value 10 (the second value in the third list in my_list).
In this project, the sales list is a list of lists. When needed, you can access a particular value (first name, last name, or sales price) from a particular element in the sales list.
In: Computer Science