Gomez runs a small pottery firm. He hires one helper at $11,500 per year, pays annual rent of
$7,000 for his shop, and spends $22,500 per year on materials. He has $40,000 of his own funds
invested in equipment (pottery wheels, kilns, and so forth) that could earn him $6,500 per year if
alternatively invested. He has been offered $22,000 per year to work as a potter for a competitor.
He estimates his entrepreneurial talents are worth $4,500 per year (input cost for organizing
resources). Total annual revenue from pottery sales is $80,000. Calculate the accounting profit
and the economic profit for Gomez’s pottery firm.
Accounting Profit = $
Economic Profit = $
Solution
Let me first tell you what it is, so that you understand better -
In calculating economic profit, opportunity costs are deducted from revenues earned.
Opportunity costs are the alternative returns foregone by using the chosen inputs. As a result,
you can have a significant accounting profit with little to no economic profit.
For example, say you invest $100,000 to start a business, and in that year you earn $120,000 in
profits. Your accounting profit would be $20,000. However, say that same year you could have
earned an income of $45,000 had you been employed. Therefore, you have an economic loss of
$25,000 (120,000 - 100,000 - 45,000).Per AnnumHelper Salary11,500Shop Rent7000material
cost22500Gomez funds40000Alternate Investment income6,500Gomez goodwill
talent4500Annual Sales Revenue80000Annual Salary as potter22000Total Salary when working
as Potter22000+6500 = 28,500Total CostHelper Salary11,500Shop Rent7000Material
cost22500Gomez entrepreneurial talent450045,500Annual Sales Revenue80000Accounting
profit80,000 -45,500 = 34,500Economic Profit=34,500 -28,500=6000.
Here is what I got so far, I dont know how to write union, interse.pdf
1. Here is what I got so far, I don't know how to write union, intersection, and minus. Please
complete this code in Java.
do not use iterator
public class IntArraySet extends IntSet
{
private int[ ] data;
private int manyItems;
public IntArraySet( )
{
final int INITIAL_CAPACITY = 10;
manyItems = 0;
data = new int[INITIAL_CAPACITY];
}
public IntArraySet(int initialCapacity)
{
if (initialCapacity < 0)
throw new IllegalArgumentException
("initialCapacity is negative: " + initialCapacity);
data = new int[initialCapacity];
manyItems = 0;
}
public void ensureCapacity(int minimumCapacity)
{
int[ ] biggerArray;
if (data.length < minimumCapacity)
{
biggerArray = new int[minimumCapacity];
System.arraycopy(data, 0, biggerArray, 0, manyItems);
data = biggerArray;
}
}
public int getCapacity( )
{
return data.length;
2. }
public void trimToSize( )
{
int[ ] trimmedArray;
if (data.length != manyItems)
{
trimmedArray = new int[manyItems];
System.arraycopy(data, 0, trimmedArray, 0, manyItems);
data = trimmedArray;
}
}
public void add(int... elements)
{
if (manyItems + elements.length > data.length)
{ // Ensure twice as much space as we need.
ensureCapacity((manyItems + elements.length)*2);
}
for (int element : elements)
{
if ( ! this.contains(element) )
{
data[manyItems] = element;
manyItems++;
}
}
}
public void add(IntSet set2)
{
int[] arr = set2.toArray();
for( int element: arr)
{
if ( ! this.contains(element) )
{
this.add(element);
3. }
}
}
public void subtract(IntSet set2)
{
int[] arr = set2.toArray();
for (int element : arr)
{
if (this.contains(element) )
{
this.remove(element);
}
}
}
public void keepCommonElements(IntSet set2)
{
if (set2 != null)
{
int [] arr = set2. toArray();
for (int element: arr)
{
if(! this. contains(element))
{
this.remove(element);
}
}
}
}
public boolean contains(int target)
{
for (int n : data)
4. {
if( target == n)
{
return true;
}
}
return false;
}
public boolean remove(int target)
{
int index; // The location of target in the data array.
for (index = 0; (index < manyItems) && (target != data[index]); index++)
// No work is needed in the body of this for-loop.
;
if (index == manyItems)
// The target was not found, so nothing is removed.
return false;
else
{ // The target was found at data[index].
// So reduce manyItems by 1 and copy the last element onto data[index].
manyItems--;
data[index] = data[manyItems];
return true;
}
}
/**
* Determine the number of elements in this set.
* @return
* the number of elements in this set
*/
public int size( )
{
return manyItems;
5. }
/**
* Create a new set that contains all the elements from this set and the other set.
* @param set2
* the second set in the union
* @precondition
* set2 is not null, and
* getCapacity( ) + set2.getCapacity( ) <= Integer.MAX_VALUE.
* @return
* the union of this set and set2
* @exception NullPointerException
* Indicates that the argument is null.
* @exception OutOfMemoryError
* Indicates insufficient memory for the new set.
* @note
* An attempt to create a set with a capacity beyond
* Integer.MAX_VALUE will cause an arithmetic overflow
* that will cause the set to fail. Such large collections should use
* a different set implementation.
*/
public IntSet union(IntSet set2)
{
}
/**
* Create a new set that contains all the elements that are in both this set and the other set.
* @param set2
* the second set in the intersection
* @precondition
* set2 is not null
* @postcondition
6. * the returned set is smaller than either this set or set2
* @return
* the intersection of this set and set2
* @exception NullPointerException
* Indicates that the argument is null.
* @exception OutOfMemoryError
* Indicates insufficient memory for the new set.
*/
public IntSet intersection(IntSet set2)
{
// If set2 is null, then a NullPointerException is thrown.
}
/**
* Create a new set that contains all the elements from this set except those from the other set.
* @param set2
* the second set in the subtraction
* @precondition
* set2 is not null
* @postcondition
* the returned set is smaller than this set
* @return
* the subtraction of set2 from this set
* @exception NullPointerException
* Indicates that the argument is null.
* @exception OutOfMemoryError
* Indicates insufficient memory for the new set.
*/
public IntSet minus(IntSet set2)
{
}
7. public int[] toArray()
{
int[] arr = new int[this.size()]; //initialize the int array to store the set elements
for (int element : arr)
{
arr[element]= this.manyItems;
}
return arr; //return the int array
}
public String toString()
{
String result = "{";
for (int i = 0; i< this.size(); i++)
{
result +=" " + data[i];
//Add a comma after all but the last item
if (i < this.size()-1)
result += ",";
}
result += "}";
return result;
}
}//IntArraySet
Solution
The following are the methods for union, intersection and minus
public IntSet union(IntSet set2)
{
List array=new ArrayList();
for(int num:set2)
{
array.add(num);
}
for(int num:this)
8. {
array.add(num);
}
return array;
}
public IntSet intersection(IntSet set2)
{
// If set2 is null, then a NullPointerException is thrown.
int size=set2.size()+this.size();
List array=new ArrayList(size);
for(int num:set2)
{
if(this.contains(num))
{
array.add(num);
}
}
return array;
}
public IntSet minus(IntSet set2)
{
ArrayList array=new ArrayList();
array.add(this);
array.removeAll(set2);
return array;
}