A transformer with rated power of 250 kVA and a secondary
voltage of 230/400 V, 50 Hz, delivers energy to the following
loads:
- 1 three-phase engine of nominal power 30 kW, 93% efficiency and
power factor 0.9
- 90 lightning systems of 250 W each, rated voltage 230 V, and
cos(phi)=0.6 (i), connected in a balanced manner
Consider a direct sequence and a reference of voltages
V1=V∠0º
Find:
a) The true, reactive and apparent power provided by the
transformer
b) The effective value of the current in each load
c) The phasors of the line currents provided by the
transformer
d) The equivalent single phase circuit of the load
e) The reactive power and capacity (in wye and delta
configurations) of a battery of capacitors so that we obtain a
global power factor of 0.95 (i)
f) The new apparent power provided by the transformer after
correcting the power factor
g) The effective value of the line currents if the transformer
works at a power factor of 0.7 (i) in a balanced manner
h) The effective value of the line currents if the transformer
works at a power factor of 1 in a balanced manner
In: Electrical Engineering
|
Name |
Callable |
Sub-Product Type |
Coupon |
Maturity |
Ratings |
Last Sale |
|||
|
Moody's® |
S&P |
Price |
Yield |
||||||
|
V |
Yes |
Corporate Bond |
3.150 |
12/14/2025 |
Aa3 |
AA- |
106.061 |
2.040 |
|
|
V |
Yes |
Corporate Bond |
4.150 |
12/14/2035 |
Aa3 |
AA- |
119.011 |
2.652 |
|
In: Finance
A marketing survey looked at the preferences of hot drink size
among 1275 random
customers of a coffee shop chain. The survey was also interested in
whether the customer’s gender
affects their preference. The results of the survey were used to
estimate the probabilities in this joint
probability distribution:
Tall (T) Grande (G) Venti (V)
Female (F) 0.12 0.24 0.06
Male (M) 0.08 0.38 0.12
a) What is p (M, T), the joint probability that a customer in the
survey was both male and prefers tall
drinks?
b) What is p (F), the marginal probability that a customer in the
survey was female?
c) What is p(G), the marginal probability that a customer in the
survey prefers Grande drinks?
d) What is p (V | M), the conditional probability, given a customer
in the survey was male, that he prefers
venti drinks?
e) What is p (F | V), the conditional probability, given a customer
in the survey prefers venti drinks, that the customer was
female?
f) There are two random variables in this situation, drink size and
gender. Are they independent or dependent? Explain how you arrived
at the answer and show your calculations.
In: Computer Science
PROBLEM STATEMENT:
Using the list container from the STL, write a program that will
read the information from a file into a list
and then display the list to the screen. Add your name. Sort the
list by id. Print the list again
CODE:
Use the provided disneyin2.txt file.
Do not hard code the file name; get file name from user.
Use the struct below
struct student
{
char firstnm[20],
lastnm[20];
int id,
grade;
};
You are to create a list of data type student :
std::list<student> l;
The driver is to demonstrate that the above mentioned operations
are performed.
Overload the << and >> operators so you may easily
input and output a student.
disneyin2.txt
Hewey Duck 123 90
Daffy Duck 342 92
Wiley Coyote 432 89
Goofy Dog 654 95
Daisy Duck 145 92
Sylvester PuddyCat 775 86
Tweety Bird 221 87
Mickey Mouse 666 66
list.t
#ifndef LIST_T_
#define LIST_T_
template <class BaseData>
List <BaseData>::List()
{
previous = 0;
currentNode = 0;
head = 0;
numNodes = 0;
currentPos = 0;
}
template <class BaseData>
List <BaseData>::List(List<BaseData> &init)
{
if (this == &init) return;
ListNode *newList, *current, *newNode;
current = init.head;
newList = 0;
head = 0;
while (current)
{
newNode = new ListNode;
newNode->listData = current->listData;
newNode->link = 0;
if (newList)
{
newList->link = newNode;
newList = newList->link;
}
else newList = newNode;
if (current == init.head)
head = newNode;
current = current->link;
}
numNodes = init.numNodes;
currentPos = 0;
previous = 0;
currentNode = 0;
}
template <class BaseData>
void List <BaseData>::insertBefore(const BaseData
&item)
{
ListNode *p;
p = new ListNode;
p->listData = item;
if (numNodes)
{
if (head == currentNode) head = p;
p->link = currentNode;
if (previous) previous ->link = p;
++numNodes;
currentNode = p;
}
else
{
head = p;
p->link = 0;
previous = 0;
++numNodes;
currentNode = p;
}
}
template <class BaseData>
BaseData * List<BaseData>::examine()
{
BaseData *temp;
if (currentNode)
{
temp = new BaseData;
*temp = currentNode->listData;
return (temp);
}
else
return 0;
}
template <class BaseData>
List <BaseData>::~List()
{
destroy();
}
template <class BaseData>
void List<BaseData>::destroy()
{
ListNode *temp;
currentNode = head;
while (currentNode)
{
temp = currentNode;
currentNode = currentNode->link;
delete temp;
}
previous = 0;
currentNode = 0;
head = 0;
numNodes = 0;
currentPos = 0;
}
template <class BaseData>
void List <BaseData>::first()
{
if (numNodes)
{
previous = 0;
currentNode = head;
currentPos = 1;
}
else
currentPos = 0;
}
template <class BaseData>
void List <BaseData>::last()
{
while (currentNode->link)
{
previous = currentNode;
currentNode = currentNode->link;
}
currentPos = numNodes;
}
template <class BaseData>
void List<BaseData>::makeCurrent (int position)
{
if (( position < 1) || (position > numNodes))
cout << "invalid position: "<< endl;
else
{
first();
for (int i = 1; i < position; i++)
{
previous = currentNode;
currentNode = currentNode->link;
}
currentPos = position;
}
}
template <class BaseData>
void List<BaseData>::prev()
{
int tempCurrPos = currentPos;
if (currentPos > 1)
{
ListNode *temp = previous;
first();
if (currentNode == temp)
{
previous = 0;
currentNode = temp;
}
else
{
while (currentNode->link != temp)
currentNode = currentNode->link;
previous = currentNode;
currentNode = temp;
}
currentPos = tempCurrPos -1;
}
else
{
cout << "walking over front of list";
currentPos = 0;
}
}
template <class BaseData>
void List<BaseData>::next()
{
if (currentNode->link)
{
previous = currentNode;
currentNode = currentNode->link;
currentPos++;
}
else
{
cout << "walking over end of list";
currentPos = 0;
}
}
template <class BaseData>
int List<BaseData>::current()
{
return (currentPos);
}
template <class BaseData>
int List<BaseData>::count()
{
return (numNodes);
}
template <class BaseData>
void List<BaseData>::insertAfter(const BaseData
&item)
{
ListNode *p;
p = new ListNode;
p->listData = item;
if (numNodes)
{
p->link = currentNode->link;
currentNode->link = p;
++numNodes;
previous = currentNode;
currentNode = p;
currentPos++;
}
else
{
head = p;
p->link = 0;
previous = 0;
++numNodes;
currentNode = p;
currentPos++;
}
}
template <class BaseData>
void List<BaseData>::remove()
{
ListNode *p, *temp;
p = currentNode;
if (numNodes) //there are nodes
{if (previous) //this is not the first node in the
list
{ //any other node in list but first
previous->link = currentNode->link;
if (currentNode->link != 0)
currentNode = currentNode->link;
else //deleting last node in list
{
currentPos--;
currentNode = previous;
temp = head;
if (temp == currentNode)
previous = 0;
else
{
while (temp->link != currentNode && temp)
temp = temp->link;
previous = temp;
}
}
delete p;
--numNodes;
}
else
{ //delete first node in list
head = head->link;
delete p;
currentNode = head;
--numNodes;
//if first and last node in list
if (!numNodes) currentPos = 0;
}
}
else cout << "empty list" << endl;
}
template <class BaseData>
void List<BaseData>::replace(BaseData &item)
{
if (currentNode)
currentNode->listData = item;
}
template <class BaseData>
List<BaseData>& List<BaseData>:: operator =
(List<BaseData> &init)
{
if (this == &init) return *this;
ListNode *temp, *newList, *current, *newNode;
currentNode = head;
while (currentNode) //delete existing left side list
{
temp = currentNode;
currentNode = currentNode->link;
delete temp;
}
current = init.head;
newList = 0;
while (current) //copy list
{ newNode = new ListNode;
newNode->listData = current->listData;
newNode->link = 0;
if (newList)
{
newList->link = newNode;
newList = newList->link;
}
else newList = newNode;
if (current == init.head)
head = newNode;
current = current->link;
}
numNodes = init.numNodes;
currentPos = 0;
previous = 0;
currentNode = 0;
return *this;
}
#endif
list.h
#ifndef LIST_H_
#define LIST_H_
#include <iostream>
#include <string>
using std::cout;
using std::endl;
using namespace std;
template <class BaseData>
class List
{
protected:
struct ListNode
{
public:
BaseData listData;
ListNode* link;
};
public:
List();
List(List& init);
~List();
void first();
void last();
void makeCurrent(int position);
void prev();
void next();
int current();
int count();
void insertBefore(const BaseData& item);
void insertAfter(const BaseData& item);
void remove();
void replace(BaseData& item);
BaseData* examine();
List<BaseData>& operator = (List<BaseData>&
source);
void destroy();
protected:
ListNode* head, * currentNode, * previous;
int numNodes;
int currentPos;
};
#include "list.t"
#endif
In: Computer Science
RESEARCH PROJECT
Jenkins has a one-third capital and profits interest in Maverick General Partnership. On January 1, year 1, Maverick has $120,000 of general debt obligations and Jenkins has a $50,000 tax basis (including his share of Maverick’s debt) in his partnership interest. During the year, Maverick incurred a $30,000 nonrecourse debt that is not secured by real estate. Because Maverick is a rental real estate partnership, Jenkins is deemed to be a passive participant in Maverick. His share of the Maverick losses for year 1 is $75,000. Jenkins is not involved in any other passive activities, and this is the first year he has been allocated losses from Maverick.
a) Determine how much of the Maverick loss Jenkins will currently be able to deduct on his tax return for year 1, and list the losses suspended due to tax-basis, at-risk, and passive activity loss limitations.
b) If Jenkins sells his interest on January 1, year 2, what happens to his suspended losses from year 1?
(Hint: See Internal Revenue Code Section 706(c)(2)(A), Regulation section 1.704-1(d)(1), Proposed Regulation Section 1.465-66(a) and Sennett v. Commissioner 80 TC 825 (1983).)
In: Accounting
Marshall has a one-third capital and profits interest in the Blue Stone General Partnership. On January 1, year 1, Blue Stone has $120,000 of general debt obligations and Marshall has a $50,000 tax basis (including his share of Blue Stone’s debt) in his partnership interest. During the year, Blue Stone incurred a $30,000 nonrecourse debt that is not secured by real estate. Because Blue Stone is a rental real estate partnership, Marshall is deemed to be a passive participant in Blue Stone. His share of the Blue Stone losses for year 1 is $75,000. Marshall is not involved in any other passive activities, and this is the first year he has been allocated losses from Blue Stone.
Determine how much of the Blue Stone loss Marshall will currently be able to deduct on his tax return for year 1, and list the losses suspended due to tax-basis, at-risk, and passive activity loss limitations.
If Marshall sells his interest on January 1, year 2, what happens to his suspended losses from year 1?
Research aids: See §706(c)(2)(A), Reg. §1.704-1(d)(1). Prop. Reg. §1.465-66(a), and Sennett v. Commissioner, 80 T.C. 825 (1983).
In: Accounting
This function will be given a list of strings and a character. You must remove all occurrences of the character from each string in the list. The function should return the list of strings with the character removed.
Signature:
public static ArrayList<String> removeChar(String pattern, ArrayList<String> list)
In: Computer Science
Create a Binary Search Tree using the list below:
List : Victor, Ralph, Leo, Mya, Eric, Elizabeth, Hester, Damian, Willis, Collin, Keira, Marci, Ashlie, Ressie
List out the tree created by the add order of the list using post-order traversal.
In: Computer Science
Add a copy constructor for the linked list implementation below:
----------------------------------------------------------------------------------------------------------------------------------------------------
// list.cpp file
#include <string>
#include "list.h"
using namespace std;
Node::Node(string element)
{
data = element;
previous = nullptr;
next = nullptr;
}
List::List()
{
first = nullptr;
last = nullptr;
}
List::List(const List& rhs) // Copy constructor -
homework
{
// Your code here
}
void List::push_back(string element)
{
Node* new_node = new Node(element);
if (last == nullptr) // List is empty
{
first = new_node;
last = new_node;
}
else
{
new_node->previous = last;
last->next = new_node;
last = new_node;
}
}
void List::insert(Iterator iter, string element)
{
if (iter.position == nullptr)
{
push_back(element);
return;
}
Node* after = iter.position;
Node* before = after->previous;
Node* new_node = new Node(element);
new_node->previous = before;
new_node->next = after;
after->previous = new_node;
if (before == nullptr) // Insert at beginning
{
first = new_node;
}
else
{
before->next = new_node;
}
}
Iterator List::erase(Iterator iter)
{
Node* remove = iter.position;
Node* before = remove->previous;
Node* after = remove->next;
if (remove == first)
{
first = after;
}
else
{
before->next = after;
}
if (remove == last)
{
last = before;
}
else
{
after->previous = before;
}
delete remove;
Iterator r;
r.position = after;
r.container = this;
return r;
}
Iterator List::begin()
{
Iterator iter;
iter.position = first;
iter.container = this;
return iter;
}
Iterator List::end()
{
Iterator iter;
iter.position = nullptr;
iter.container = this;
return iter;
}
Iterator::Iterator()
{
position = nullptr;
container = nullptr;
}
string Iterator::get() const
{
return position->data;
}
void Iterator::next()
{
position = position->next;
}
void Iterator::previous()
{
if (position == nullptr)
{
position = container->last;
}
else
{
position = position->previous;
}
}
bool Iterator::equals(Iterator other) const
{
return position == other.position;
}
----------------------------------------------------------------------------------------------------------------------------------------------------------------
Use the following header file, and test program (not to be modified) to verify that the copy constructor works correctly:
----------------------------------------------------------------------------------------------------------------------------------------------------------------
// list.h file
#ifndef LIST_H
#define LIST_H
#include <string>
using namespace std;
class List;
class Iterator;
//template <typename T>
class Node
{
public:
/**
Constructs a node with a given data value.
@param element the data to store in this node
*/
Node(string element); // Node(T element)
// Node(T data, Node<T>* n, Node<T>* n);
private:
string data; // T data;
Node* previous;
Node* next;
friend class List;
friend class Iterator;
};
class List
{
public:
/**
Constructs an empty list.
*/
List();
List(const List& rhs); // Homework
/*
Appends an element to the list.
@param element the value to append
*/
void push_back(string element);
/**
Inserts an element into the list.
@param iter the position before which to insert
@param element the value to insert
*/
void insert(Iterator iter, string element);
/**
Removes an element from the list.
@param iter the position to remove
@return an iterator pointing to the element after the
erased element
*/
Iterator erase(Iterator iter);
/**
Gets the beginning position of the list.
@return an iterator pointing to the beginning of the list
*/
Iterator begin();
/**
Gets the past-the-end position of the list.
@return an iterator pointing past the end of the list
*/
Iterator end();
private:
Node* first;
Node* last;
friend class Iterator;
};
class Iterator
{
public:
/**
Constructs an iterator that does not point into any list.
*/
Iterator();
/**
Looks up the value at a position.
@return the value of the node to which the iterator points
*/
string get() const;
/**
Advances the iterator to the next node.
*/
void next();
/**
Moves the iterator to the previous node.
*/
void previous();
/**
Compares two iterators.
@param other the iterator to compare with this iterator
@return true if this iterator and other are equal
*/
bool equals(Iterator other) const;
private:
Node* position;
List* container;
friend class List;
};
#endif
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
// list_test .cpp file
#include <string>
#include <iostream>
#include "list.h"
using namespace std;
int main()
{
List names;
names.push_back("Tom");
names.push_back("Diana");
names.push_back("Harry");
names.push_back("Juliet");
// Add a value in fourth place
Iterator pos = names.begin();
pos.next();
pos.next();
pos.next();
names.insert(pos, "Romeo");
// Remove the value in second place
pos = names.begin();
pos.next();
names.erase(pos);
List names_copy(names); //Copy constructor -
homework
names_copy.push_back("Shakespeare");
// Verify that Shakespeare was inserted.
cout << "Printing new list" << endl;
for (pos = names_copy.begin(); !pos.equals(names.end());
pos.next())
{
cout << pos.get() << endl; //
}
cout << "Printing original list " << endl;
for (pos = names.begin(); !pos.equals(names.end());
pos.next())
{
cout << pos.get() << endl;
}
return 0;
}
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Thank you for your time and help!
In: Computer Science
Could you check/edit my code?
Design and implement your own linked list class to hold a sorted list of integers in ascending order. The class should have member function for inserting an item in the list, deleting an item from the list, and searching the list for an item. Note: the search function should return the position of the item in the list (first item at position 0) and -1 if not found. In addition, it should member functions to display the list, check if the list is empty, and return the length of the list. Be sure to have a class constructor, a class destructor, and a copy constructor for deep copy. Demonstrate your class with a driver program (be sure to include the following cases: insertion at the beginning, end, and inside the list, deletion of first item, last item, and an item inside, searching for an existing/non-existing item, and modifying a list that was initialized to an existing list).
#ifndef LIST_H
#define LINKEDLIST_H
template <class T>
class ListNode
{
public:
//Node value
T value;
//Pointer to the next node
ListNode<T> *next;
//Constructor
ListNode(T nodeValue)
{
value = nodeValue
next =
nullptr;
}
};
//LinkedList class
template <class T>
class LinkedList
{
private:
//List head pointer
ListNode<T> *head;
public:
//Constructor
LinkedList()
{
head = nullptr;
}
//Destructor
~LinkedList();
//Linked list operations
void appendNode(T);
void insertNode(T);
void deleteNode(T);
void displayList() const;
};
template <class T>
void LinkedList<T>::appendNode(T newValue)
{
//To point to a new node
ListNode<T> *newNode;
//To move through the list
ListNode<T> *nodePtr;
//Allocate a new node and store new Value there.
newNode = new ListNode<T>(newValue);
if (!head)
head = newNode;
else
{
//Initialize nodePtr to head of
list.
nodePtr = head;
//Find the last node in the
list
while (nodePtr->next)
nodePtr =
nodePtr->next;
//Insert newNode as the last
node.
nodePtr->next = newNode;
}
}
template <class T>
void LinkedList<T>::displayList() const
{
//To move through the list
ListNode<T> *nodePtr;
//Position nodePtr at the head of the list.
nodePtr = head;
//Traverse the list
while (nodePtr)
{
//Value of this node
cout << nodePtr->value
<< endl;
//Move to the next node.
nodePtr = nodePtr->next;
}
}
template <class T>
void LinkedList<T>::insertNode(T newValue)
{
ListNode<T> *newNode;
//traverse the list
ListNode<T> *nodePtr;
ListNode<T> *previousNode = nullptr;
newNode = new ListNode<T>(newValue);
if (!head)
{
head = newNode;
newNode->next = nullptr;
}
else
{
nodePtr = head;
previousNode = nullptr;
//Skip all nodes whose value is
less than newValue.
while (nodePtr != nullptr
&& nodePtr && nodePtr->value <
newValue)
{
previousNode =
nodePtr;
nodePtr =
nodePtr->next;
}
//If the new node is to be the 1st
in the list, then insert it before all other nodes
if (previousNode == nullptr)
{
head =
newNode;
newNode->next
= nodePtr;
}
else {
previousNode->next = newNode;
newNode->next
= nodePtr;
}
}
}
template <class T>
void LinkedList<T>::deleteNode(T searchValue)
{
//To traverse the list
ListNode<T> *nodePtr;
//To point to the previous node
ListNode<T> *previousNode;
//There is no need to do anything if the list is
empty
if (!head)
return;
//Determine if the first node is one
if (head->value == searchValue)
{
nodePtr = head->next;
delete head;
head = nodePtr;
}
else
{
//Initialize nodePtr to head of
list
nodePtr = head;
//Skip all nodes whose value
member is not equal to num
while (nodePtr != nullptr
&& nodePtr->value != searchValue)
{
previousNode =
nodePtr;
nodePtr =
nodePtr->next;
}
//If nodePtr is not at the end of
the list, link the
//previous node ot the node after
nodePtr, then delete nodePtr.
if (nodePtr)
{
previousNode->next = nodePtr->next;
delete
nodePtr;
}
}
}
//Destructor
//This function will delete every node on the list
template <class T>
LinkedList<T>::~LinkedList()
ListNode<T> *nodePtr;
ListNode<T> *nextNode;
//Position nodePtr at the head of the list.
nodePtr = head;
//While nodePtr is not at the end of teh list...
while (nodePtr != nullptr)
{
//Save a pointer to the next node.
nextNode = nodePtr->next;
delete nodePtr;
nodePtr = nextNode;
}
}
#endif
In: Computer Science