b. Generate three ligation reactions with 1:1, 2:1 and 3:1 molar ratios of the insert and the vector DNA. Your ligation should include all components in a 30 µL reaction. Keep the vector amount fixed at 60 ng per ligation reaction. You are provided with 10 x ligase buffer and DNA ligase (0.5 U/µL) to set up your ligations.
In: Biology
1. A double-ended queue, or deque, is a data structure consisting of a list of items on which the following operations are defined:
addToBack(x): insert item x on the back end of the queue
addToFront(x): insert item x on the front end of the queue
getBack(): returns the element on the back end of the queue
getFront(): returns the element on the front end of the queue
removeBack(): remove the back item from the queue
removeFront(): remove the front item from the queue
Write routines to support the deque that take O(1) time per operation. Use a doubly linked list implementation.
|
Node |
|
-int info -Node next -Node prev |
|
+Node() +int getInfo() +Node getNext() +Node getPrev() +void setInfo(int i) +void setNext(Node n) +void setPrev(Node p) |
UML class diagram:
|
Deque |
|
-int count -Node back -Node front |
|
+Deque() +void addToBack(int x) +void addToFront(int x) +DequeItem getBack() +DequeItem getFront() +boolean isEmpty() +boolean removeBack() +boolean removeFront() +String toString() |
|
DequeItem |
|
+boolean valid +int item |
|
+DequeItem() +DequeItem(boolean v, int i) |
|
Main |
|
+static void main(String[] args) +Main() |
testset.txt
IS_EMPTY
ADD_TO_BACK 1
IS_EMPTY
ADD_TO_BACK 2
ADD_TO_BACK 3
GET_BACK
GET_FRONT
ADD_TO_FRONT 4
ADD_TO_FRONT 5
ADD_TO_FRONT 6
ADD_TO_BACK 7
GET_BACK
GET_FRONT
REMOVE_FRONT
REMOVE_BACK
GET_FRONT
GET_BACK
ADD_TO_BACK 8
ADD_TO_BACK 9
ADD_TO_FRONT 10
ADD_TO_BACK 11
ADD_TO_BACK 12
ADD_TO_BACK 0
REMOVE_BACK
REMOVE_BACK
ADD_TO_BACK 0
REMOVE_FRONT
REMOVE_FRONT
REMOVE_FRONT
REMOVE_FRONT
REMOVE_FRONT
REMOVE_FRONT
REMOVE_FRONT
REMOVE_FRONT
REMOVE_FRONT
REMOVE_FRONT
REMOVE_FRONT
Deque.java
public class Deque
{
/**
* Default constructor. Sets this object as an empty deque.
*
*/
public Deque()
{
front = new Node();
back = new Node();
front.setNext(back);
back.setPrev(front);
count = 0;
}
/**
* Adds new element to the back end of the deque. The method takes O(1)
* time.
*
* @param x new element to be added to the deque.
*/
public void addToBack(int x)
{
//TO IMPLEMENT
}
/**
* Adds new element to the front end of the deque. The method takes O(1)
* time.
*
* @param x new element to be added to the deque.
*/
public void addToFront(int x)
{
//TO IMPLEMENT
}
/**
* Retrieves element on the back end of the deque. The method takes O(1)
* time.
*
* @return operation is successful: valid = true and item = element on the
* back end; operation is unsuccessful (i.e. empty deque): valid = false and
* item = dummy value
*/
public DequeItem getBack()
{
return new DequeItem(); //DUMMY CODE; TO IMPLEMENT
}
/**
* Retrieves element on the front end of the deque. The method takes O(1)
* time.
*
* @return operation is successful: valid = true and item = element on the
* front end; operation is unsuccessful (i.e. empty deque): valid = false and
* item = dummy value
*/
public DequeItem getFront()
{
return new DequeItem(); //DUMMY CODE; TO IMPLEMENT
}
/**
* Determines if deque is empty. The method takes O(1) time.
*
* @return true if deque contains no elements, false otherwise.
*/
public boolean isEmpty()
{
return false; //DUMMY CODE; TO IMPLEMENT
}
/**
* Removes element on the back end of the deque. The method takes O(1) time.
*
* @return false if removal cannot be performed (i.e. the deque is empty),
* true otherwise
*/
public boolean removeBack()
{
return false; //DUMMY CODE; TO IMPLEMENT
}
/**
* Removes element on the front end of the deque. The method takes O(1)
* time.
*
* @return false if removal cannot be performed (i.e. the deque is empty),
* true otherwise
*/
public boolean removeFront()
{
return false; //DUMMY CODE; TO IMPLEMENT
}
/**
* Constructs a String description of the deque.
*
* @return String containing the deque elements.
*/
public String toString()
{
String str = "";
Node current = front.getNext();
for (int i = 0; i < count - 1; i++)
{
str += current.getInfo() + ", ";
current = current.getNext();
}
if (count != 0)
return "Deque: [" + str + back.getPrev().getInfo() + "]";
else
return "Deque: []";
}
private int count; //number of elements in the deque
private Node back; //points to the item in the back
private Node front; //points to the item in the front
}
DequeItem.java
public class DequeItem
{
/**
* Default constructor. Sets this object to a invalid deaue item.
*
*/
public DequeItem()
{
valid = false;
item = 0;
}
/**
* Parameterized constructor.
*
* @param v value of the "valid" component of this object
* @param i value of the "item" component of this object
*/
public DequeItem(boolean v, int i)
{
valid = v;
item = i;
}
public boolean valid; //true if "item" is a valid element, false otherwise
public int item; //deque element
}
Main.java
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
/**
* Tester class.
*/
public class Main
{
public static void main(String[] args)
{
new Main();
}
/**
* Tester method.
*/
public Main()
{
Deque deque = new Deque();
File file = new File("assignment 2 test set.txt");
try
{
Scanner in = new Scanner(file);
String operation;
int item = 0;
int entryNumber = 0;
while (in.hasNextLine())
{
entryNumber++;
operation = in.next();
if (operation.equals("ADD_TO_BACK") || operation.equals("ADD_TO_FRONT"))
{
item = in.nextInt();
System.out.println("\n" + operation + " " + item);
}
else
System.out.println("\n" + operation);
DequeItem result;
switch (operation)
{
case "ADD_TO_BACK":
deque.addToBack(item);
System.out.println(deque);
break;
case "ADD_TO_FRONT":
deque.addToFront(item);
System.out.println(deque);
break;
case "GET_BACK":
result = deque.getBack();
if (result.valid)
System.out.println("Back item: " + result.item);
else
System.out.println("Cannot retrieve value, deque is empty!");
break;
case "GET_FRONT":
result = deque.getFront();
if (result.valid)
System.out.println("Front item: " + result.item);
else
System.out.println("Cannot retrieve value, deque is empty!");
break;
case "IS_EMPTY":
System.out.println(deque.isEmpty());
break;
case "REMOVE_BACK":
if (deque.removeBack())
System.out.println(deque);
else
System.out.println("Cannot remove, deque is empty!");
break;
case "REMOVE_FRONT":
if (deque.removeFront())
System.out.println(deque);
else
System.out.println("Cannot remove, deque is empty!");
break;
default:
System.out.println("Operation \"" + operation + "\" unknown at line " + entryNumber);
System.exit(1);
}
}
} catch (FileNotFoundException e)
{
System.out.println("File not found!");
System.exit(1);
}
}
}
Node.java
/**
* Implements the node of a doubly linked list of integers.
*/
public class Node
{
private int info;
private Node next;
private Node prev;
public Node()
{
//TO IMPLEMENT
}
public int getInfo()
{
return -1; //DUMMY CODE; TO IMPLEMENT
}
public Node getNext()
{
return null; //DUMMY CODE; TO IMPLEMENT
}
public Node getPrev()
{
return null; //DUMMY CODE; TO IMPLEMENT
}
public void setInfo(int i)
{
//TO IMPLEMENT
}
public void setNext(Node n)
{
//TO IMPLEMENT
}
public void setPrev(Node p)
{
//TO IMPLEMENT
}
}
Output
run:
IS_EMPTY true
ADD_TO_BACK 1 Deque: [1]
IS_EMPTY false
ADD_TO_BACK 2 Deque: [1, 2]
ADD_TO_BACK 3 Deque: [1, 2, 3]
GET_BACK Back item: 3
GET_FRONT Front item: 1
ADD_TO_FRONT 4 Deque: [4, 1, 2, 3]
ADD_TO_FRONT 5 Deque: [5, 4, 1, 2, 3]
ADD_TO_FRONT 6 Deque: [6, 5, 4, 1, 2, 3]
ADD_TO_BACK 7 Deque: [6, 5, 4, 1, 2, 3, 7]
GET_BACK Back item: 7
GET_FRONT Front item: 6
REMOVE_FRONT Deque: [5, 4, 1, 2, 3, 7]
REMOVE_BACK Deque: [5, 4, 1, 2, 3]
GET_FRONT Front item: 5
GET_BACK Back item: 3
ADD_TO_BACK 8 Deque: [5, 4, 1, 2, 3, 8]
ADD_TO_BACK 9 Deque: [5, 4, 1, 2, 3, 8, 9]
ADD_TO_FRONT 10 Deque: [10, 5, 4, 1, 2, 3, 8, 9]
ADD_TO_BACK 11 Deque: [10, 5, 4, 1, 2, 3, 8, 9, 11]
ADD_TO_BACK 12 Deque: [10, 5, 4, 1, 2, 3, 8, 9, 11, 12]
ADD_TO_BACK 0 Deque: [10, 5, 4, 1, 2, 3, 8, 9, 11, 12, 0]
REMOVE_BACK Deque: [10, 5, 4, 1, 2, 3, 8, 9, 11, 12]
REMOVE_BACK Deque: [10, 5, 4, 1, 2, 3, 8, 9, 11]
ADD_TO_BACK 0 Deque: [10, 5, 4, 1, 2, 3, 8, 9, 11, 0]
REMOVE_FRONT Deque: [5, 4, 1, 2, 3, 8, 9, 11, 0]
REMOVE_FRONT Deque: [4, 1, 2, 3, 8, 9, 11, 0]
REMOVE_FRONT Deque: [1, 2, 3, 8, 9, 11, 0]
REMOVE_FRONT Deque: [2, 3, 8, 9, 11, 0]
REMOVE_FRONT Deque: [3, 8, 9, 11, 0]
REMOVE_FRONT Deque: [8, 9, 11, 0]
REMOVE_FRONT Deque: [9, 11, 0]
REMOVE_FRONT Deque: [11, 0]
REMOVE_FRONT Deque: [0]
REMOVE_FRONT Deque: []
REMOVE_FRONT Cannot remove, deque is empty! BUILD SUCCESSFUL (total time: 0 seconds)
In: Computer Science
Using the Payback Method and NPV
The Scenario:You work in the product development department of an athletic apparel company. Your company has decided to add a new product and is choosing between a polo tee, yoga pants, or running shoes. You have been asked to evaluate the financial profitability of each option. You have estimated that the company has $2,000,000 to invest in the project, and each product has the potential to bring in an estimated $3,000,000 of future cash flows, although the timing of the cash flows varies per product.Additionally, two of the products would use equipment that could be sold at the end of the project cycle. In order to pay for the project, the company will have to finance at a 6% interest rate. Present value discount factors are listed as follows:
|
Years |
PV of 1 at 6% |
PV of an Annuity at 6% |
|
1 |
0.94340 |
0.94340 |
|
2 |
0.89000 |
1.83339 |
|
3 |
0.83962 |
2.67301 |
|
4 |
0.79209 |
3.46511 |
|
5 |
0.74726 |
4.21236 |
Formulas:
|
Requirements1.)Calculate the profitability of each project using
Option 1: Polo Shirts
|
Future Net Cash Flows |
|
|
Year 1 |
$600,000 |
|
Year 2 |
$600,000 |
|
Year 3 |
$600,000 |
|
Year 4 |
$600,000 |
|
Year 5 |
$600,000 |
|
Today’s Cash Outflows |
|
|
Initial investment |
$2,000,000 |
2.) Calculate the NPV of polo shirts.
Option 2: Yoga Pants
|
Future Net Cash Flows |
|
|
Year 1 |
$750,000 |
|
Year 2 |
$750,000 |
|
Year 3 |
$750,000 |
|
Year 4 |
$750,000 |
|
Salvage Value of Equipment Year 4 |
$50,000 |
|
Today’s Cash Outflows |
|
|
Initial investment |
$2,000,000 |
3.) Calculate the payback period of yoga pants.
|
Year |
Annual Net Cash Flow |
Cumulative Net Cash Flows |
|
1 |
||
|
2 |
||
|
3 |
||
|
4 |
4.)Calculate the NPV of yoga pants.
NOTES: The company will receive the same $ cash flows for years 1-3. Use the PV of an annuity discount factor for this part of the calculation. In the 4th year there is an additional cash flow (the salvage value).
Option 3: Running Shoes
|
Future Net Cash Flows |
|
|
Year 1 |
$700,000 |
|
Year 2 |
$800,000 |
|
Year 3 |
$800,000 |
|
Year 4 |
$700,000 |
|
Salvage Value of Equipment Year 4 |
$50,000 |
|
Today’s Cash Outflows |
|
|
Initial investment |
$2,000,000 |
|
Year |
Annual Net Cash Flow |
Cumulative Net Cash Flows |
|
1 |
||
|
2 |
||
|
3 |
||
|
4 |
6.) Calculate the NPV of running shoes.
NOTES: Notice that every year the company will receive a different cash flow (Calculate the individual PV of each future cash flow and add them together).
Pause and Reflect:
2. If given the opportunity to choose between a higher NPV or a lower payback period, which would you choose and why?
3. Based on the information above, our company chooses to make _____________________
4. How did having a salvage value (such as with the yoga pants and running shoes) affect your payback and NPV calculations?
5. List two things that you learned from participating in this activity.
In: Accounting
Using samples of 190 credit card statements, an auditor found
the following:
Use Table-A.
| Sample | 1 | 2 | 3 | 4 |
| Number with errors | 5 | 3 | 5 | 12 |
a. Determine the fraction defective in each sample.
(Round your answers to 4 decimal
places.)
| Sample | Fraction defective |
| 1 | .0263 .0263 Correct |
| 2 | .0158 .0158 Correct |
| 3 | .0263 .0263 Correct |
| 4 | .0632 .0632 Correct |
b.If the true fraction defective for this process is
unknown, what is your estimate of it? (Round your answer to
1 decimal place. Omit the "%" sign in your response.)
Estimate 3.3 3.3 Correct %
c. What is your estimate of the mean and standard
deviation of the sampling distribution of fractions defective for
samples of this size? (Round your intermediate calculations
and final answers to 4 decimal places.)
| Mean | .0329 .0329 Correct |
| Standard deviation | .0180 .0180 Incorrect |
d.What control limits would give an alpha risk of .03 for
this process? (Round your intermediate calculations to 4
decimal places. Round your "z" value to 2 decimal
places and other answers to 4 decimal places.)
z = 2.17, ____ to ____
e.What alpha risk would control limits of .0470
and .0188 provide? (Round your intermediate calculations to
4 decimal places. Round your "z" value to 2
decimal places and "alpha risk" value to 4 decimal
places.)
z = alpha risk =
In: Accounting
The Bradley Corporation produces a product with the following costs as of July 1, 20X1:
| Material | $4 per unit |
| Labor | 4 per unit |
| Overhead | 2 per unit |
Beginning inventory at these costs on July 1 was 3,500 units.
From July 1 to December 1, 20X1, Bradley produced 13,000 units.
These units had a material cost of $4, labor of $6, and overhead of
$4 per unit. Bradley uses LIFO inventory accounting.
a. Assuming that Bradley sold 15,000 units during the last six months of the year at $19 each, what is its gross profit?
b. What is the value of ending inventory?
In: Finance
In: Computer Science
This exercise is to be solved using program R.
Information about worms that inhabit various conditions was obtained (Worms.txt). Suppose that the mean of Worm.density is 5, then you want to conduct a statistical test. (H0: mu=5 vs H1: mu≠5)
Show the code and Rhistory.
| Field.Name | Area | Slope | Vegetation | Soil.pH | Damp | Worm.density |
|---|---|---|---|---|---|---|
| Nashs.Field | 3.6 | 11 | Grassland | 4.1 | F | 4 |
| Silwood.Bottom | 5.1 | 2 | Arable | 5.2 | F | 7 |
| Nursery.Field | 2.8 | 3 | Grassland | 4.3 | F | 2 |
| Rush.Meadow | 2.4 | 5 | Meadow | 4.9 | T | 5 |
| Gunness.Thicket | 3.8 | 0 | Scrub | 4.2 | F | 6 |
| Oak.Mead | 3.1 | 2 | Grassland | 3.9 | F | 2 |
| Church.Field | 3.5 | 3 | Grassland | 4.2 | F | 3 |
| Ashurst | 2.1 | 0 | Arable | 4.8 | F | 4 |
| The.Orchard | 1.9 | 0 | Orchard | 5.7 | F | 9 |
| Rookery.Slope | 1.5 | 4 | Grassland | 5 | T | 7 |
| Garden.Wood | 2.9 | 10 | Scrub | 5.2 | F | 8 |
| North.Gravel | 3.3 | 1 | Grassland | 4.1 | F | 1 |
| South.Gravel | 3.7 | 2 | Grassland | 4 | F | 2 |
| Observatory.Ridge | 1.8 | 6 | Grassland | 3.8 | F | 0 |
| Pond.Field | 4.1 | 0 | Meadow | 5 | T | 6 |
| Water.Meadow | 3.9 | 0 | Meadow | 4.9 | T | 8 |
| Cheapside | 2.2 | 8 | Scrub | 4.7 | T | 4 |
| Pound.Hill | 4.4 | 2 | Arable | 4.5 | F | 5 |
| Gravel.Pit | 2.9 | 1 | Grassland | 3.5 | F | 1 |
| Farm.Wood | 0.8 | 10 | Scrub | 5.1 | T | 3 |
In: Statistics and Probability
Use the following statements to answer the question below:
1. Two firms experiencing exactly the same economic events could report different net income while both correctly following generally accepted accounting principles.
2. Only finance and accounting professionals need to understand accounting principles.
3. Cash flow is what matters to a firm and its investors; therefore, the statement of cash flows is the only financial statement that investors need consider.
4. The book value of a firm’s equity is an accurate representation of fair value.
5. Financial statements present a complete and accurate portrayal of firm performance.
Which of the above statements are true?
In: Finance
Below is a table for the present value of $1 at compound
interest.
| Year | 6% | 10% | 12% |
| 1 | 0.943 | 0.909 | 0.893 |
| 2 | 0.890 | 0.826 | 0.797 |
| 3 | 0.840 | 0.751 | 0.712 |
| 4 | 0.792 | 0.683 | 0.636 |
| 5 | 0.747 | 0.621 | 0.567 |
Below is a table for the present value of an annuity of $1 at
compound interest.
| Year | 6% | 10% | 12% |
| 1 | 0.943 | 0.909 | 0.893 |
| 2 | 1.833 | 1.736 | 1.690 |
| 3 | 2.673 | 2.487 | 2.402 |
| 4 | 3.465 | 3.170 | 3.037 |
| 5 | 4.212 | 3.791 | 3.605 |
Using the tables above, if an investment is made now for $20,000
that will generate a cash inflow of $7,000 a year for the next 4
years, what would be the present value of the investment cash
inflows, assuming an earnings rate of 12%?
In: Accounting
In: Finance