Write two classes, ToDoList and Driver
ToDoList should implement the following UML class diagram:
| ToDoList |
|---|
| -list:String[] -size:int |
| +ToDoList() +add(String item):void +remove(String item): boolean +toString():String |
add(String item) should add the item as the last element in the list, updating size.
remove(String item) should remove the
item and return true, or, if the
item was not in the list, return
false.
To remove the item, check every
list element from 0 to
size-1, and if that item is equal to the parameter
using s1.equalsIgnoreCase(s2), loop from
i+1 to size, assigning each
element the value of the following element in the list, so
list[j-1] = list[j]. The size of
the list will be one less.
toString() should return a numbered list, with a "\n" after each list item.
HW22 should run as in the sample run below. Use static methods as needed to input the choice and the list item.
1. add an item
2. remove an item
3. print the list
4. quit
Enter your choice: j
Enter a number: 6
1 through 4 only: 3
Empty list
1. add an item
2. remove an item
3. print the list
4. quit
Enter your choice: 1
Enter a list item and press enter: Mow the lawn
1. add an item
2. remove an item
3. print the list
4. quit
Enter your choice: 1
Enter a list item and press enter: Wash the car
1. add an item
2. remove an item
3. print the list
4. quit
Enter your choice: 1
Enter a list item and press enter: Clean the kitchen
1. add an item
2. remove an item
3. print the list
4. quit
Enter your choice: 3
1. Mow the lawn
2. Wash the car
3. Clean the kitchen
1. add an item
2. remove an item
3. print the list
4. quit
Enter your choice: 2
Enter a list item and press enter: clean the kitchen
clean the kitchen removed
1. add an item
2. remove an item
3. print the list
4. quit
Enter your choice: 3
1. Mow the lawn
2. Wash the car
1. add an item
2. remove an item
3. print the list
4. quit
Enter your choice: 2
Enter a list item and press enter: Write a program
Could not remove Write a program
1. add an item
2. remove an item
3. print the list
4. quit
Enter your choice: 4
add(String item) should add the item as the last element in the list, updating size.
remove(String item) should remove the item and return true, or, if the item was not in the list, return
In: Computer Science
Place the following translation termination events into the order of their occurrence:
1. The release factor signals the release the nascent peptide from the P site tRNA.
2. Dissociation of the mRNA and the last deacetylated tRNA occurs from the ribosomal subunits.
3. Recognition of the stop codon by a release factor that binds in the A site.
4. Translocation of the ribosome along the mRNA to place a stop codon in the A site.
A. 3, 4, 2,1 B. 1, 2, 3, 4 C.4, 3, 2, 1 D. 1,3, 4,2 E. 4, 3, 1,2
In: Biology
| 1 | 2 | 1 | 3 |
| 1 | -1 | 1 | 2 |
| 2 | 4 | 1 | 3 |
| 3 | 2 | 1 | -1 |
| 1 | 2 | 3 | -2 | -1 | 2 |
| 2 | -1 | 2 | 3 | 2 | -3 |
| 3 | 1 | 2 | -1 | 3 | -5 |
| 5 | 5 | 5 | -7 | 7 | -4 |
Determine the Kernel of matrix B.
Determine the Cokernel of matrix B.
Determine the row space of the Cokernel of B.
Determine the inverse of matrix A.
Perform LU (or PLU) factorization on matrix A and determine the L and U (and/or P) and E matrices.
Find the value of the four variables in matrix A using Cramer's rule.
Choose a row or column and use the elements to represent matrix A as a series of cofactors.
In: Math
2.14 (a) Construct a frequency distribution for the number of different residences occu-pied by graduating seniors during their college career, namely1, 4, 2, 3, 3, 1, 6, 7, 4, 3, 3, 9, 2, 4, 2, 2, 3, 2, 3, 4, 4, 2, 3, 3, 5
(b) What is the shape of this distribution?
In: Statistics and Probability
For each age, calculate the mean number of matings. Take the log of each mean and plot it by AGE. Include your plot.
What assumption can be assessed with this plot? Is there evidence of a quadratic trend on this plot? Explain.
| AGE | MATINGS |
| 27 | 0 |
| 28 | 1 |
| 28 | 1 |
| 28 | 1 |
| 28 | 3 |
| 29 | 0 |
| 29 | 0 |
| 29 | 0 |
| 29 | 2 |
| 29 | 2 |
| 29 | 2 |
| 30 | 1 |
| 32 | 2 |
| 33 | 4 |
| 33 | 3 |
| 33 | 3 |
| 33 | 3 |
| 33 | 2 |
| 34 | 1 |
| 34 | 1 |
| 34 | 2 |
| 34 | 3 |
| 36 | 5 |
| 36 | 6 |
| 37 | 1 |
| 37 | 1 |
| 37 | 6 |
| 38 | 2 |
| 39 | 1 |
| 41 | 3 |
| 42 | 4 |
| 43 | 0 |
| 43 | 2 |
| 43 | 3 |
| 43 | 4 |
| 43 | 9 |
| 44 | 3 |
| 45 | 5 |
| 47 | 7 |
| 48 | 2 |
| 52 | 9 |
In: Statistics and Probability
Employee Gender Years of Service. Years Undergraduate Study Graduate Degree? CPA? Age Group
1 F 17 4 N Y 5
2 F 6 2 N N 2
3 M 8 4 Y Y 3
4 F 8 4 Y N 3
5 M 16 4 Y Y 4
6 F 21 1 N Y 7
7 M 27 4 N N 7
8 F 7 4 Y Y 2
9 M 8 4 N N 3
10 M 23 2 N Y 5
11 F 9 4 Y Y 3
12 F 8 2 N N 2
13 F 8 4 Y N 2
14 M 26 4 N Y 6
15 F 9 4 N Y 2
16 F 9 2 N N 2
17 M 19 2 Y Y 4
18 M 5 4 N N 4
19 M 19 4 Y N 7
20 M 20 4 N N 6
21 F 14 4 Y Y 4
22 M 31 4 N N 7
23 F 10 0 N N 7
24 F 10 4 N Y 3
25 M 26 4 Y Y 6
26 M 28 4 N N 7
27 F 5 4 N Y 1
Age Group Age Range
1 21-25
2 26-30
3 31-35
4 36-40
5 41-45
6 46-50
7 51-55
8 56-60
9 over 60
In: Statistics and Probability
| rent | rooms | baths | sqrfoot | house | campusclose | pets | new |
| 875 | 1 | 1 | 655 | 0 | 0 | 0 | 0 |
| 1130 | 1 | 1 | 800 | 0 | 0 | 1 | 0 |
| 785 | 1 | 1 | 650 | 0 | 1 | 0 | 0 |
| 895 | 1 | 1 | 566 | 0 | 1 | 0 | 0 |
| 690 | 1 | 1 | 600 | 0 | 1 | 0 | 0 |
| 800 | 1 | 1 | 435 | 0 | 1 | 0 | 0 |
| 595 | 1 | 1 | 500 | 0 | 0 | 0 | 0 |
| 850 | 1 | 1 | 655 | 0 | 1 | 0 | 0 |
| 775 | 1 | 1 | 612 | 0 | 0 | 1 | 1 |
| 795 | 1 | 1 | 688 | 0 | 1 | 0 | 0 |
| 1050 | 1 | 1 | 700 | 0 | 1 | 1 | 0 |
| 870 | 1 | 1 | 655 | 0 | 1 | 0 | 0 |
| 1070 | 1 | 1 | 710 | 0 | 0 | 1 | 0 |
| 850 | 1 | 1 | 670 | 0 | 1 | 0 | 0 |
| 825 | 1 | 1 | 488 | 0 | 1 | 0 | 0 |
| 1300 | 2 | 1 | 781 | 1 | 1 | 1 | 0 |
| 1225 | 2 | 1 | 764 | 0 | 1 | 0 | 0 |
| 1300 | 2 | 1 | 800 | 1 | 0 | 0 | 0 |
| 1200 | 2 | 1 | 922 | 0 | 1 | 0 | 0 |
| 1345 | 2 | 1 | 856 | 0 | 0 | 1 | 1 |
| 1100 | 2 | 2 | 866 | 0 | 0 | 0 | 1 |
| 1350 | 2 | 2 | 1300 | 0 | 0 | 0 | 0 |
| 1450 | 2 | 1 | 700 | 0 | 1 | 1 | 1 |
| 1200 | 2 | 1 | 800 | 0 | 1 | 0 | 0 |
| 1195 | 2 | 1 | 795 | 0 | 1 | 0 | 0 |
| 1185 | 2 | 1 | 864 | 0 | 1 | 0 | 0 |
| 1100 | 2 | 1 | 1050 | 0 | 1 | 0 | 0 |
| 1125 | 2 | 2 | 986 | 0 | 0 | 1 | 1 |
| 1075 | 2 | 1 | 800 | 0 | 0 | 1 | 1 |
| 1210 | 2 | 2 | 890 | 0 | 1 | 0 | 0 |
| 1150 | 2 | 1 | 1200 | 0 | 0 | 1 | 0 |
| 1215 | 2 | 1 | 988 | 0 | 1 | 0 | 0 |
| 1270 | 2 | 1.5 | 995 | 0 | 1 | 0 | 0 |
| 995 | 2 | 1 | 864 | 0 | 1 | 0 | 0 |
| 1095 | 2 | 1 | 1050 | 0 | 0 | 0 | 0 |
| 995 | 2 | 1 | 800 | 0 | 1 | 0 | 0 |
| 1205 | 2 | 1 | 900 | 1 | 1 | 1 | 0 |
| 1560 | 3 | 2 | 1200 | 1 | 1 | 0 | 0 |
| 1800 | 3 | 2.5 | 1309 | 1 | 0 | 0 | 1 |
| 1740 | 3 | 1 | 1200 | 1 | 1 | 0 | 0 |
| 1795 | 3 | 2 | 1300 | 0 | 0 | 0 | 0 |
| 2067 | 3 | 4 | 1700 | 0 | 1 | 0 | 1 |
| 2695 | 3 | 2.5 | 1551 | 0 | 0 | 1 | 1 |
| 1815 | 3 | 2 | 1467 | 0 | 0 | 1 | 0 |
| 1900 | 3 | 2.5 | 1600 | 1 | 0 | 0 | 0 |
| 1395 | 3 | 2 | 1611 | 1 | 0 | 1 | 0 |
| 1194 | 3 | 1 | 1705 | 1 | 1 | 0 | 0 |
| 1699 | 3 | 3 | 1646 | 1 | 1 | 1 | 0 |
| 1700 | 3 | 2 | 1550 | 1 | 0 | 1 | 0 |
| 2700 | 4 | 3 | 2100 | 1 | 0 | 1 | 1 |
| 2956 | 4 | 4 | 1659 | 0 | 1 | 1 | 1 |
| 2400 | 4 | 2 | 2300 | 1 | 1 | 0 | 0 |
| 2250 | 4 | 2 | 1900 | 0 | 1 | 0 | 0 |
| 2099 | 4 | 4 | 2200 | 1 | 1 | 1 | 0 |
| 2720 | 4 | 3 | 2400 | 0 | 1 | 0 | 1 |
| 1700 | 4 | 1.5 | 1980 | 1 | 1 | 0 | 0 |
| 2200 | 4 | 1.5 | 2100 | 1 | 1 | 0 | 0 |
| 2600 | 5 | 1.5 | 3500 | 1 | 1 | 0 | 0 |
| 2600 | 5 | 2 | 1607 | 1 | 0 | 0 | 0 |
| 2300 | 5 | 2 | 2600 | 1 | 0 | 0 | 0 |
1.Remove the variable with highest p-value and re-fit the model. Only remove one variable at a time.
2. Continue removing variables one-by-one until all variables in the model have a p-value less than 0.05.
3. Consider whether any of the variables in your model are related to each other. Check this with the scatterplot matrix and\or by finding the correlation between the two explanatory variables. If r <= 0.80 then keep both variables in the model. This is your final model. However If r > 0.80, then one of the variables should be removed from the model. Re-fit two models, each model without one of the correlated variables. Select the model with the higher adjusted R-squared value.
a. (2 points) Provide a narrative for how you settled upon the final model. Example: “I first fit the full model and noticed the p-value for ____was very high. I dropped it from the model and refit the data, then I check the correlation between ___ and ___ to see if the relationship was too strong between the explanatory variables.”
b.(2 points) Provide the R output of your final model.
c. (2 points) State the least squares regression equation of your model.
d. (2 points) Compare the adjusted R- squared values from the full model to your final model. Is there much of a difference? What does this comparison tell us about the fit of two models?
In: Statistics and Probability
You will implement two algorithms to find the shortest path in a graph.
def prim(G,start_node): Takes a graph G and node to start at. Prims edges used in MST.
def kruskal(G): Takes a graph G and prints the edges in the MST in order found.
You may represent the graphs as adjacency matrix or list. You MAY NOT include any graph libraries.
The graph you are working on will be give in a file with the following format. The graph is undirected. That means if an edge from 2 to 1 is in the file, it may be used in both directions.
Note: You should store the weights as floats.
The program will have a text interface. First ask for the file name of the graph to work with. Then implement 4 text commands.
prim x - Runs Pim's Algorithm starting at node X. X must be an integer
kruskal - Runs Kruskal's algorithm
help - prints this list of commands
exit - Exits the program
On a bad command print out "Unknown Command"
You must implement this using only standard python3 libraries. You may not use any outside libraries. For example, open source graph libraries.
When printing an edge, always print the smaller vertex first then the larger vertex.
Example Execution Traces are provided below.
Welcome to Minimum Spanning Tree Finder
Give the file name graph is in:
input1.txt
Commands:
exit or ctrl-d - quits the program
help - prints this menu
prim integer_value - run's Prim's algorithm starting at node given
kruskal - runs Kruskal's algorithm
Enter command:
Bad Command Unknown Command
Enter command:
help
Commands:
exit or ctrl-d - quits the program
help - prints this menu
prim integer_value - run's Prim's algorithm starting at node given
kruskal - runs Kruskal's algorithm
Enter command:
prim 0
Running Prim's Algorithm Starting Node: 0
Added 2
Using Edge [0, 2, 1.0]
Added 5
Using Edge [2, 5, 4.0]
Added 3
Using Edge [3, 5, 2.0]
Added 1
Using Edge [1, 2, 7.0]
Added 4
Using Edge [1, 4, 3.0]
Enter command:
exit
Bye
The content of the files is shown below.
input1.txt
6 0 3 5 3 5 2 5 4 10 4 1 3 1 0 8 0 2 1 2 3 6 2 5 4 2 4 9 2 1 7
input2.txt
9 0 1 4 0 7 10 1 7 13 7 8 9 7 6 1 1 2 8 8 2 3 8 6 6 2 3 7 2 5 5 6 5 2 3 5 14 3 4 11 5 4 12
input3.txt
8 4 5 35 4 7 37 5 7 28 0 7 16 1 5 32 0 4 38 2 3 17 1 7 19 0 2 26 1 2 36 1 3 29 2 7 34 6 2 40 3 6 52 6 0 58 6 4 93
In: Computer Science
Here is the data Stat7_prob4.R :
y=c(18.90, 17, 20, 18.25, 20.07, 11.2, 22.12, 21.47, 34.70, 30.40, 16.50, 36.50, 21.50, 19.70, 20.30, 17.80, 14.39, 14.89, 17.80, 16.41, 23.54, 21.47, 16.59, 31.90, 29.40, 13.27, 23.90, 19.73, 13.90, 13.27, 13.77, 16.50)
x1=c(350, 350, 250, 351, 225, 440, 231, 262, 89.7, 96.9, 350, 85.3, 171, 258, 140, 302, 500, 440, 350, 318, 231, 360, 400, 96.9, 140, 460, 133.6, 318, 351, 351, 360, 350)
x2=c(4, 4, 1, 2, 1, 4, 2, 2, 2, 2, 4, 2, 2, 1, 2, 2, 4, 4, 4, 2, 2, 2, 4, 2, 2, 4, 2, 2, 2, 2, 4, 4)
Here is the question:
Please Use R software/studio and provide all the R code and R output, please. Please answers all the questions (a, b & c). Pay attention to everything in Bold please. Show all work!
The file Stat7_prob4.R contains data on the gasoline mileage performance of 32 different automobiles.
(a) Fit a simple linear regression model relating gasoline mileage (y) to engine displacement (x1) and carburetor (x2).
(b) Construct and interpret the partial regression plots for each predictor.
(c) Compute the studentized residuals and the R-student residuals for this model. What information is conveyed by these scaled residuals?
In: Statistics and Probability
|
Year 1 |
Year 2 |
|
|
red |
$1 each |
$2 each |
|
green |
$2 each |
$1 each |
In year 1 Abby buys 10 red apples and in Year 2 Abby buys 10 green apples.
Compute a CPI for apples for each year. Assume that year 1 is the base year in which the consumer basket is fixed. How does your index change from year 1 to year 2? (at least five sentences to explain)
Suppose Abby is happy eating red or green apples. How much has the true cost of living increased for Abby? (at least five sentences to explain)
In: Economics