Sargent Corporation bought equipment on January 1, 2013. The equipment cost $180,000 and
had an expected salvage value of $30,000. The life of the equipment was estimated to be 6 years.
The book value of the equipment at the beginning of the third year using straight-line
depreciation would be . C $180,000. $150,000. $130,000. $50,000.
Solution
As per the information provided, Sargent Corporation bought an equipment on Jan 1, 2013 for
$180000 with 6 years life and salvage value of $30000.
Therefore, depreciation expense every year as per Straight line method would be:-
Equipment cost = $180000
LESS:- Salvage value = $30000
Amount on which depriciation is to be charged =$150000
Now, depreciation as per straight line method = $150000 / 6 years
= $25000 every year
Now, book value of Equipment at the beginning of third year is:-
Equipment cost = $180000
LESS :- Depreciation for first and second year = $25000 x 2 years = $50000
Therefore, book value at begginning of third year =$130000
Hence, as per the problem \"Option C\" is correct with book value of $130000..
Template LinkedList;I am using templates to make some linkedLists.pdf
1. Template LinkedList;
I am using templates to make some linkedLists
Here is the Data and next pointer class:
and here is my header where i do the implementations, aswell as an explanation as to what the
functions should do
Can anybody please help me with the implementations so i can get a better understanding?
Thankyou very much in advance!
(If possible please answer from a computer :D) 1 #pragma once 1 3 template typename T 4 E
class Node public 7 I ode( T(), Node
Solution
LLToolkit.h
#ifndef LLTOOLKIT_H_
#define LLTOOLKIT_H_
#include
#include "Node.h"
using namespace std;
template
class LLToolkit
{
public:
// Precondition: headPtr points to the head of a list
// Postcondition: Info has been inserted at the head of the list, and headPtr is updated
void headInsert(Node*& headPtr, T data)
{
headPtr = new Node(data, headPtr);
}
// Precondition: headPtr points to the head of a list with at least 1 element
// Postcondition: The head element has been removed and headPtr is updated to point to the
new
// head element
void headRemove(Node*& headPtr)
{
if (headPtr != NULL)
2. {
Node* condemned = headPtr;
headPtr = headPtr->next;
delete condemned;
}
}
// Precondition: prevPtr points to Node just before insertion point
// Postcondition: A new Node with data=info has been inserted into the list after prevPtr
void insert(Node*& prevPtr, T data)
{
if (prevPtr == NULL) return;
Node* next = prevPtr->next;
prevPtr->next = new Node(data, next);
}
// Precondition: prevPtr points to Node just before Node to remove
// Postcondition: The Node after prevPtr has been removed from the list
void remove(Node*& prevPtr)
{
if (prevPtr == NULL) return;
if (prevPtr->next == NULL) return;
Node* condemned = prevPtr->next;
prevPtr->next = condemned->next;
delete prevPtr->next;
}
// Precondition: sourcePtr is the head pointer of a linked list.
// Postcondition: A pointer to a copy of the linked list is returned. The original list is
// unaltered.
Node* copy(Node* sourcePtr)
{
Node* headPtr = NULL; // Head pointer for new list
Node* tailPtr = NULL;
// Handle the case of the empty list.
if (sourcePtr == NULL) return headPtr;
3. // Make the head LLNode for the newly created list, and put data in it.
headInsert(headPtr, sourcePtr->info);
tailPtr = headPtr;
// Copy the rest of the nodes one at a time, adding at the tail of new list.
sourcePtr = sourcePtr->next;
while (sourcePtr != NULL)
{
insert(tailPtr, sourcePtr->info);
tailPtr = tailPtr->next;
sourcePtr = sourcePtr->next;
}
return headPtr;
}
// Precondition: headPtr is the head pointer of a linked list.
// Postcondition: All nodes of the list have been deleted, and the headPtr is NULL.
void clear(Node* headPtr)
{
while (headPtr != NULL)
{
Node* prevPtr = headPtr;
headPtr = headPtr->next;
delete prevPtr;
}
return headPtr;
}
// Precondition: headPtr is the head pointer of a linked list.
// Postcondition: The data item of each Node in the list has been printed to the screen in an
// easily readable way, e.g. 3 - 4 - 7 -/
void print(Node* headPtr)
{
while (headPtr != NULL)
{
cout << headPtr->info << endl;
headPtr = headPtr->next;
}
}
4. // Precondition: headPtr is the head pointer of a linked list.
// Postcondition: headPtr points to the start of a list that is reversed with respect to the
// original list
void reverse(Node*& headPtr)
{
Node* tempPtr = NULL; // Head pointer for new list
// Handle the case of the empty list.
if (headPtr == NULL)
{
cout << "Can't reverse an empty list" << endl;
return;
}
// Copy the rest of the nodes one at a time, adding at the tail of new list.
while (headPtr != NULL)
{
headInsert(tempPtr, headPtr->info);
headPtr = headPtr->next;
}
headPtr = tempPtr;
}
// Precondition: splitPtr points to the node before the split point
// Postcondition: A pointer is returned that points to the first node after splitPtr. The
// original list ends at the node pointed to by splitPtr
Node* split(Node* splitPtr)
{
Node* newHeadPtr = splitPtr->next;
splitPtr->next = NULL;
return newHeadPtr;
}
// Precondition: values points to an array of at least size n
// Postcondition: A pointer is returned that points to the head of a list in which the nodes
// contains values from the array values
Node* build(int* values, size_t n)
{
Node* headPtr = NULL; // Head pointer for new list
Node* tailPtr = NULL;
5. // Make the head LLNode for the newly created list, and put data in it.
headInsert(headPtr, values[0]);
tailPtr = headPtr;
for (int i = 1; i < n; i++)
{
insert(tailPtr, values[i]);
tailPtr = tailPtr->next;
}
return headPtr;
}
// Precondition: head1 and head2 each point to the head of linked lists
// Postcondition: head1 points to a list containing head1-lists' elements followed by head2-
lists
// element.
void join(Node* head1, Node* head2)
{
Node *tailPtr;
//krer en lkke for at finde sidste plads
//i head1 s listerne kan sttes sammen.
while (head1 != NULL)
{
tailPtr = head1;
head1 = head1->next;
}
//TailPtr bliver nu brugt til at stte de lister sammen
tailPtr->next = head2;
}
// Precondition: head points to the head of a linked list
// Postcondition: The list is rotated left by once - if it was 1-2-3-4, it is now 2-3-4-1
void rotateLeft(Node*& headPtr)
{
Node *tailPtr;
Node *tempPtr = headPtr;
//krer en lkke for at finde sidste vrdi i listen
while (tempPtr != NULL)
{
6. tailPtr = tempPtr;
tempPtr = tempPtr->next;
}
insert(tailPtr, headPtr->info);
headPtr = headPtr->next;
}
// Precondition: head points to the head of a linked list
// Postcondition: The list is rotated right once - if it was 1-2-3-4, it is now 4-1-2-3
void rotateRight(Node*& head)
{
Node *tailPtr;
Node *tempPtr = head;
//en while lkke til at finde den sidste vrdi i den linkede liste
while (tempPtr->next != NULL)
{
tailPtr = tempPtr;
tempPtr = tempPtr->next;
}
headInsert(head, tempPtr->info);
tailPtr->next = NULL;
delete tempPtr;
}
};
#endif // LLTOOLKIT_H_
Node.h
#ifndef NODE_H_
#define NODE_H_
#include
template
class Node
{
public:
Node(const T& i = T(), Node* n = NULL)
: info(i), next(n)