In: Nursing
1. Jim and Donna Stoner contract to sell their house in Rochester, Michigan, to Clem and Clara Hovenkamp. Clara thinks that the decorative chandelier in the entryway is lovely and gives the house an immediate appeal. The chandelier was a gift from Donna’s mother, “to enhance the entryway” and provide “a touch of beauty” for Jim and Donna’s house. Clem and Clara assume that the chandelier will stay, and nothing specific is mentioned about the chandelier in the contract for sale. Clem and Clara are shocked when they move in and find the chandelier is gone. Have Jim and Donna breached their contract of sale?
2. Blaine Goodfellow rents a house from Associated Properties in Abilene, Texas. He is there for two years, and during that time he installs a ceiling fan, custom-builds a bookcase for an alcove on the main floor, and replaces the screening on the front and back doors, saving the old screening in the furnace room. When his lease expires, he leaves, and the bookcase remains behind. Blaine does, however, take the new screening after replacing it with the old screening, and he removes the ceiling fan and puts back the light. He causes no damage to Associated Properties’ house in doing any of this. Discuss who is the rightful owner of the screening, the bookcase, and the ceiling fan after the lease expires.
In: Economics
Code in Java
Given the LinkedList class that is shown below
Add the following methods:
| public class MyLinkedList { | |
| private String name; | |
| private MyLinkedList next; | |
| public MyLinkedList(String n) { | |
| this.name = n; | |
| } | |
| public void add(String n) { | |
| MyLinkedList i = this; | |
| while (i.next != null) { | |
| i = i.next; | |
| } | |
| i.next = new MyLinkedList(n); | |
| } | |
| public int length() { | |
| int ret_val = 1; | |
| MyLinkedList i = this; | |
| while (i.next != null) { | |
| i = i.next; | |
| ret_val++; | |
| } | |
| return ret_val; | |
| } | |
| public void print() { | |
| // ???? | |
| } | |
| public MyLinkedList itemAt(int index) { | |
| int counter = 1; | |
| MyLinkedList i = this; | |
| while (i.next != null && counter < index) { | |
| i = i.next; | |
| counter++; | |
| } | |
| return i; | |
| } | |
| public static void main(String[] args) { | |
| MyLinkedList student_list = new MyLinkedList("12"); | |
| student_list.add("7"); | |
| student_list.add("20"); | |
| student_list.add("40"); | |
| student_list.add("9"); | |
| System.out.println(student_list.length()); | |
| System.out.println(student_list.itemAt(3)); | |
| System.out.println(); | |
| } | |
| } |
In: Computer Science
Language: Java
Topic: Deques
Using the following variables/class:
public class ArrayDeque<T> {
/**
* The initial capacity of the ArrayDeque.
*
* DO NOT MODIFY THIS VARIABLE.
*/
public static final int INITIAL_CAPACITY = 11;
// Do not add new instance variables or modify existing
ones.
private T[] backingArray;
private int front;
private int size;
Q1: write a method called "public void
addLast(T data)" which adds an element to the back of a Deque. If
sufficient space is not available in the backing array, resize it
to double the current capacity. When resizing, copy elements to the
beginning of the new array and reset front to 0. Must be amortized
O(1).
* @param data the data to add to the back of the deque
* @throws java.lang.IllegalArgumentException if data is null
Q2: write a method called "public T removeFirst()" that removes and returns the first element of the deque. Do not grow or shrink the backing array. If the deque becomes empty as a result of this call, do not reset front to 0.Replace any spots that you remove from with null. Failure to do so can result in the loss of points. Must be in O(1) and:
* @return the data formerly located at the front of the
deque
* @throws java.util.NoSuchElementException if the deque is
empty
In: Computer Science
PYTHON-- how do i change these linkedlist methods into doublylinkedlist methods? A doublylinked list is the same as a linked list, except that each node has a reference to the node after it(next) and the node before it(prev).
#adds item to the head of list.
def add(self, item):
node = Node(item, self.head)
self.head = node
if self.size == 0:
self.tail = node
self.size += 1
#appends item to tail of list
def append(self, item):
node = Node(item)
tail = self.head
node.next = None
if self.size == 0:
node.prev = None
self.head = node
return
while tail.next is not None:
tail = tail.next
tail.next = node
node.prev = tail
self.size += 1
#removes the node at position pos. returns node's data
#make pop O(1)
def pop(self, pos=None):
current = self.head
previous = None
i = 0
while current != None and i != pos:
previous = current
current = current.next
i += 1
if current == self.tail:
previous.next = None
self.tail = previous
self.size -= 1
return current.data
elif prev is None:
if self.size == 1:
self.tail = None
self.head = current.next
self.size -= 1
return current.data
else:
previous.next = current.next
self.size -= 1
return current.dataIn: Computer Science
Using C++ Create a program that asks the user to input a string value and then outputs the string in the Pig Latin form.
- If the string begins with a vowel, add the string "-way" at the end of the string. For “eye”, it will be “eye-way”.
- If the string does not begin with a vowel, first add "-" at the end of the string. Then rotate the string one character at a time; that is, move the first character of the string to the end of the string until the first character of the string becomes a vowel. Then add the string "ay" at the end. For example, the Pig Latin form of the string "There" is "ere-Thay".
- Strings such as "by" contain no vowels. In cases like this, the letter y can be considered a vowel. So, for this program, the vowels are a, e, i, o, u, y, A, E, I, O, U, and Y. Therefore, the Pig Latin form of "by" is "y-bay".
- Strings such as "1234" contain no vowels. The pig Latin form of the string "1234" is "1234-way". That is, the pig Latin form of a string that has no vowels in it is the string followed by the string "-way". The program should store each character of a string into a linked list and use the rotate function, which removes the first item and puts it at the end of the linked list. The linked list should be implemented as a generic type.
In: Computer Science
Create two functions that you can use for a dictionary manager:
1. remove_item(dictionary,key): a function that removes the item with the supplied key from the dictionary, if it exits. If the input key doesn’t exist in the dictionary, print out a message saying that the new item has not been removed because there is no matching key in the dictionary. Your function should not produce a Python error if the item does not exist;
2. add_new_item(dictionary,key,value): a function that adds a new item to the dictionary (using the input key and value) if there is no existing item in the dictionary with the supplied key. If the input key already exists in the dictionary, print out a message saying that the new item has not been added because there is already a matching key in the dictionary. No Python error should be raised by this fuction if the key already exists.
Test out your functions by creating a dictionary with several items and then doing four (4) things:
removing an item that exist;
removing an item that doesn’t exist;
adding an item whose key doesn’t exist;
adding an item whose key does exist;
Print out the contents of the dictionary after each of these tests and include the output of running your code as a comment in your submission.
We use python for this course
In: Computer Science
To get full credit for this assignment you must:
(1) answer each question - make sure you answer every part of question
AND
(2) respond to at least 2 of your classmates posts
(NOTE: You should not just agree/ disagree with the post. You need to provide justified explanation
of your agreement/disagreement. Be respectful at all times.
Do NOT revise your post after reading other student posts.)
In your own words, answer all questions (4 points each):
In: Computer Science
Java queue linked list
/*
* Complete the enqueue(E val) method
* Complete the dequeue() method
* Complete the peek() method
* No other methods/variables should be added/modified
*/
public class A3Queue {
/*
* Grading:
* Correctly adds an item to the queue - 1pt
*/
public void enqueue(E val) {
/*
* Add a node to the list
*/
}
/*
* Grading:
* Correctly removes an item from the queue - 1pt
* Handles special cases - 0.5pt
*/
public E dequeue() {
/*
* Remove a node from the list and
return it
*/
return null;
}
/*
* Grading:
* Correctly shows an item from the queue - 1pt
* Handles special cases - 0.5pt
*/
public E peek() {
/*
* Show a node from the list
*/
return null;
}
private Node front, end;
private int length;
public A3Queue() {
front = end = null;
length = 0;
}
private class Node {
E value;
Node next, prev;
public Node(E v) {
value = v;
next = prev =
null;
}
}
}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
public class A3Driver {
public static void main(String[] args) {
A3Queue queue = new
A3Queue<>();
queue.enqueue(5);
queue.enqueue(20);
queue.enqueue(15);
System.out.println(queue.peek()+":5");
System.out.println(queue.dequeue()+":5");
queue.enqueue(25);
System.out.println(queue.dequeue()+":20");
System.out.println(queue.dequeue()+":15");
}
}
In: Computer Science
You will create a datafile with the following information: 70 80 90 55 25 62 45 34 76 105You will then write the program to read in the values from the datafile and as you read in each number, you will then evaluate it through an if statement for the weather of the day. For example, when you read in the value 70 from the datafile, you should print to the screen that the temperature is 70° and it is nice outside. After reading in all the values, you will determine which is the highest temperature and which is the lowest temperature. For example, your output will look like this:
The temperature for today is 70. It is nice outside.
The temperature for today is 80. It is getting warm outside.
The temperature for today is 90. It is hot outside.
The temperature for today is 55. It is cool outside.
The temperature for today is 25. It is really cold outside.
The temperature for today is 62. It is comfortable outside.
The temperature for today is 45. It ischilly outside.
The temperature for today is 34. It is cold outside.
The temperature for today is 76. It is nice outside.
The temperature for today is 105. It is really hot outside.
The high temperature for today is 105.
The low temperature for today is 25
Hints: You will need to create an if statement after you read your values in from the database to check the temperatures.
The ranges should be:
Above 100 –really hot
90-100 –hot
80-90 –getting warm
70-80 –nice
60-70 –comfortable
50-60 –cool
40-50 –chilly
30-40 –cold
20-30 –really cold
Below 20 –freezing
Notice that the number values such as 90 shows up in both selections. Instead of 90, one of them has to be 89 and so on. You will determine where the cutoffs are. Do not hard code the output information. Make sure you are running it through an if statement because my datafile will have different values than yours.
In: Computer Science