Questions
EMU ELECTRONICS Emu electronics is an electronics manufacturer located in Box Hill, Victoria. The company’s managing...

EMU ELECTRONICS

Emu electronics is an electronics manufacturer located in Box Hill, Victoria. The company’s managing director is Shelly Chan, who inherited the company from the father. The company originally repaired radios and other household appliances when it was founded more than 50 years ago. Over the years. The company has expanded, and it is now a reputable manufacturer of various specialty electronics items. Robert McCanless, a recent MBA graduate, has been hired by the company in the finance department.     

One of the major revenue-producing items manufactured by Emu electronics is a smart phone. Emu electronics currently has a smart phone model on the market and sales have been excellent. The smart phone is a unique item in that it comes in a variety of colours and is pre-programmed to play Jimmy Barne’s music. However, as with any electronic item, technology changes rapidly, and the current smart phone has limited features in comparison with newer models. Emu electronics has spent $1 200 000 developing a prototype for a new smart phone that has all the features of the existing one, but adds new features, such as Wifi tethering. The company has spent a further $250 000 for a marketing study to determine the expected sales figures for the new smart phones.

   Emu electronics production manager has produced estimates of the costs associated with manufacture of the new smart phone. Variable costs are estimated at $210 per unit and fixed costs for the operation are expected to run at $5.3 million per year. The estimated sales volume is 64 000 units in the year 1; 106 000 units in the year 2; 87 000 units in the year 3; 78 000 units in Year 4; and 54 000 units in the final year. The unit price of the smart phone will be $515. The necessary manufacturing equipment can be purchased for $38.5 million and will be depreciated for tax purposes over a seven-year life (straight-line to zero). It is believed the value of the manufacturing equipment in five years’ time will be $5.8 million.

    Net working capital for the smart phones will be 20% of sales and will have to be purchased at the end of the year. The cost of the raw materials is reflected in the variable unit cost. Changes in NWC will first occur at the end of Year 1 based on the first years’ sales. Emu electronics has a 30% corporate tax rate and a 12% required return.

    Shelly has asked Robert to prepare a report that answers the following questions.

Questions

1. What is the payback period of the project?

2. What is the profitability index of the project?

3. What is the IRR of the project?

4. What is the NPV of the project?

5. How sensitive is the NPV to changes in the price of the smart phone?

6. How sensitive is the NPV to changes in the quantity sold?

7. Should Emu electronics produce the new smart phone?

8. Suppose Emu electronics loses sales on other models because of the introduction of the new model. How would this affect your analysis?

In: Finance

MIni Case EMU Electronics Emu Electronics manufacturer located in Box Hill, Victoria. The company's managing director...

MIni Case

EMU Electronics

Emu Electronics manufacturer located in Box Hill, Victoria. The company's managing director is Shelly Chan, who inherited the company from her father. The company originally repaired radios and other household appliances when it was founded more than 50 years ago. Over the years, the company has expanded, and it is now a reputable manufacturer of various specialty electronic items. Robert McCanless, a recent MBA graduate, has been hired by the company in the finanace department.

One of the major revenue-producing items manufactured by Emu Electronics is a smart phone. Emu Electronics currently has one smart phone model on the market and sales have been excellent. The smart phone is a unique item in that it comes in a variety of colours and is pre-programmed to play Jimmy Barnes music. However, as with any electronic item, technology changes rapidly, and the current smart phone has limited features in comparison with newer models. Emu Electronics has spent $1200000 developing a prototype for a new smart phone that has all the features of the existing one, but adds features, such as Wifi tethering. The company has spent a further $250000 for a marketing study to determine the expected sales figures for the new smart phone.

Emu Electronics' production manager has produced estimates of the costs associated with manufacture of the new smart phone. Variable costs are estimated at $210 per unit and fixed costs for the operation are expected to run at $5.3 million per year. The estimated sales is 64000 units in Year 1; 106000 units in Year 2; 87000 units in Year 3; 78000 units in Year 4 and 54000 units in the final year. The unit price of the new smart phone will be $515. The necessary manufacturing equipment in five years time will be $5.8 million.

Net working capital for the smart phones will be 20% of sales and will have to be purchased at the end of the year. The cost of the raw materials is reflected in the variable unit cost. Changes in NWC will first occur at the end of Year ! based on the first year's sales. Emu Electronics has a 30% corporate tax rate and a 12 % required return.

Shelly has asked Robert to prepare a report that answers the following questions:

1. What is the payback period of the project?

2. What is the profitability index of the project?

3. What is the IRR of the project?

4. What is the NPV of the project?

5. How sensitive is the NPV to changes in the price of the new smart phone?

6. How sensitive is the NPV to changes in the quantity sold?

7. Should Emu Electronics produce the smart phone?

8. Suppose Emu Electronics loses sales on other models because of the introduction of the new model. How would this affect your analysis?

In: Finance

RAK, Inc., has no debt outstanding and a total market value of $150,000. Earnings before interest...

RAK, Inc., has no debt outstanding and a total market value of $150,000. Earnings before interest and taxes, EBIT, are projected to be $26,000 if economic conditions are normal. If there is strong expansion in the economy, then EBIT will be 12 percent higher. If there is a recession, then EBIT will be 20 percent lower. RAK is considering a $90,000 debt issue with an interest rate of 6 percent. The proceeds will be used to repurchase shares of stock. There are currently 10,000 shares outstanding. Ignore taxes for questions a and b. Assume the company has a market-to-book ratio of 1.0.

  

a-1

Calculate return on equity (ROE) under each of the three economic scenarios before any debt is issued. (Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

ROE
  Recession %  
  Normal %  
  Expansion %  

  

a-2

Calculate the percentage changes in ROE when the economy expands or enters a recession. (Negative amounts should be indicated by a minus sign. Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

% change in ROE
  Recession %  
  Expansion %  

  

Assume the firm goes through with the proposed recapitalization.

b-1

Calculate the return on equity (ROE) under each of the three economic scenarios. (Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

ROE
  Recession %  
  Normal %  
  Expansion %  

  

b-2

Calculate the percentage changes in ROE when the economy expands or enters a recession. (Negative amounts should be indicated by a minus sign. Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

% change in ROE
  Recession %  
  Expansion %  

  

Assume the firm has a tax rate of 35 percent.

  

c-1

Calculate return on equity (ROE) under each of the three economic scenarios before any debt is issued. (Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

ROE
  Recession %  
  Normal %  
  Expansion %  

  

c-2

Calculate the percentage changes in ROE when the economy expands or enters a recession. (Negative amounts should be indicated by a minus sign. Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

% change in ROE
  Recession %  
  Expansion %  

  

c-3

Calculate the return on equity (ROE) under each of the three economic scenarios assuming the firm goes through with the recapitalization. (Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

ROE
  Recession %  
  Normal %  
  Expansion %  

  

c-4

Given the recapitalization, calculate the percentage changes in ROE when the economy expands or enters a recession. (Negative amounts should be indicated by a minus sign. Round your answers to 2 decimal places. (e.g., 32.16))

  

% change in ROE
  Recession %  
  Expansion %

In: Finance

RAK, Inc., has no debt outstanding and a total market value of $140,000. Earnings before interest...

RAK, Inc., has no debt outstanding and a total market value of $140,000. Earnings before interest and taxes, EBIT, are projected to be $32,000 if economic conditions are normal. If there is strong expansion in the economy, then EBIT will be 12 percent higher. If there is a recession, then EBIT will be 30 percent lower. RAK is considering a $115,000 debt issue with an interest rate of 6 percent. The proceeds will be used to repurchase shares of stock. There are currently 7,000 shares outstanding. Ignore taxes for questions a and b. Assume the company has a market-to-book ratio of 1.0.

  

a-1

Calculate return on equity (ROE) under each of the three economic scenarios before any debt is issued. (Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

ROE
  Recession %  
  Normal %  
  Expansion %  

  

a-2

Calculate the percentage changes in ROE when the economy expands or enters a recession. (Negative amounts should be indicated by a minus sign. Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

% change in ROE
  Recession %  
  Expansion %  

  

Assume the firm goes through with the proposed recapitalization.
b-1

Calculate the return on equity (ROE) under each of the three economic scenarios. (Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

ROE
  Recession %  
  Normal %  
  Expansion %  

  

b-2

Calculate the percentage changes in ROE when the economy expands or enters a recession. (Negative amounts should be indicated by a minus sign. Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

% change in ROE
  Recession %  
  Expansion %  

  

Assume the firm has a tax rate of 35 percent.

  

c-1

Calculate return on equity (ROE) under each of the three economic scenarios before any debt is issued. (Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

ROE
  Recession %  
  Normal %  
  Expansion %  

  

c-2

Calculate the percentage changes in ROE when the economy expands or enters a recession. (Negative amounts should be indicated by a minus sign. Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

% change in ROE
  Recession %  
  Expansion %  

  

c-3

Calculate the return on equity (ROE) under each of the three economic scenarios assuming the firm goes through with the recapitalization. (Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

ROE
  Recession %  
  Normal %  
  Expansion %  

  

c-4

Given the recapitalization, calculate the percentage changes in ROE when the economy expands or enters a recession. (Negative amounts should be indicated by a minus sign. Round your answers to 2 decimal places. (e.g., 32.16))

  

% change in ROE
  Recession %  
  Expansion %

In: Finance

RAK, Inc., has no debt outstanding and a total market value of $250,000. Earnings before interest...

RAK, Inc., has no debt outstanding and a total market value of $250,000. Earnings before interest and taxes, EBIT, are projected to be $42,000 if economic conditions are normal. If there is strong expansion in the economy, then EBIT will be 18 percent higher. If there is a recession, then EBIT will be 30 percent lower. RAK is considering a $100,000 debt issue with an interest rate of 8 percent. The proceeds will be used to repurchase shares of stock. There are currently 10,000 shares outstanding. Ignore taxes for questions a and b. Assume the company has a market-to-book ratio of 1.0.

  

a-1

Calculate return on equity (ROE) under each of the three economic scenarios before any debt is issued. (Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

ROE
  Recession %  
  Normal %  
  Expansion %  

  

a-2

Calculate the percentage changes in ROE when the economy expands or enters a recession. (Negative amounts should be indicated by a minus sign. Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

% change in ROE
  Recession %  
  Expansion %  

  

Assume the firm goes through with the proposed recapitalization.
b-1

Calculate the return on equity (ROE) under each of the three economic scenarios. (Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

ROE
  Recession %  
  Normal %  
  Expansion %  

  

b-2

Calculate the percentage changes in ROE when the economy expands or enters a recession. (Negative amounts should be indicated by a minus sign. Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

% change in ROE
  Recession %  
  Expansion %  

  

Assume the firm has a tax rate of 35 percent.

  

c-1

Calculate return on equity (ROE) under each of the three economic scenarios before any debt is issued. (Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

ROE
  Recession %  
  Normal %  
  Expansion %  

  

c-2

Calculate the percentage changes in ROE when the economy expands or enters a recession. (Negative amounts should be indicated by a minus sign. Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

% change in ROE
  Recession %  
  Expansion %  

  

c-3

Calculate the return on equity (ROE) under each of the three economic scenarios assuming the firm goes through with the recapitalization. (Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

ROE
  Recession %  
  Normal %  
  Expansion %  

  

c-4

Given the recapitalization, calculate the percentage changes in ROE when the economy expands or enters a recession. (Negative amounts should be indicated by a minus sign. Round your answers to 2 decimal places. (e.g., 32.16))

  

% change in ROE
  Recession %  
  Expansion %  

In: Finance

a. An increase in the price level in an economy will _____.​ a ​shift the aggregate...

a. An increase in the price level in an economy will _____.​

a

​shift the aggregate expenditure line downward, and result in a greater real GDP

b

shift the aggregate expenditure line upward, and result in a greater real GDP​

c

shift the aggregate expenditure line downward​, and result in a lower real GDP

d

​shift the aggregate expenditure line upward, and result in a lower real GDP​

e

shift the aggregate demand curve toward the aggregate supply curve

b. A decrease in the price level in an economy will _____.​

a

shift the aggregate demand curve toward the aggregate supply curve

b

​shift the aggregate expenditure line downward, and result in a greater real GDP

c

shift the aggregate expenditure line upward, and result in a greater real GDP​

d

shift the aggregate expenditure line downward​, and result in a lower real GDP

e

​shift the aggregate expenditure line upward, and result in a lower real GDP​

c. An aggregate demand curve is created by getting different points from :​

a

​shifting the 45-degree line to new real GDP

b

letting changes in autonomous spending shift the AE line.​

c

letting changes in the price level shift the AE line to a new real GDP.​

d

letting changes in the level of income shift the AE line to a new real GDP.​

e

letting changes in real GDP shift the AE line.

d. The aggregate demand curve of an economy illustrates the :​

a

the inverse relationship between the price level and real GDP​ quantity demanded

b

the relationship between price level and interest rates.​

c

​the relationship between real income levels and nominal income levels.

d

​the positive relationship between the price level and real GDP demanded

e

​the relationship between income levels and real gross domestic product (GDP).

e. If the consumption spending (C) in an economy increases at a given price level, _____.​

a

the aggregate expenditure curve shifts upward and the aggregate demand curve shifts to the left​

b

the aggregate expenditure line shifts upward and the aggregate demand curve shifts to the right​

c

​the aggregate expenditure line shifts upward and the economy moves upward along the aggregate demand curve

d

the aggregate expenditure line shifts downward and the economy moves upward along the aggregate demand curve​

e

the aggregate expenditure line shifts downward and the aggregate demand curve shifts to the left

f. If the consumption spending (C) in an economy decreases at a given price level, _____.​

a

​the aggregate expenditure line shifts upward and the economy moves upward along the aggregate demand curve

b

the aggregate expenditure line shifts upward and the aggregate demand curve shifts to the right​

c

the aggregate expenditure curve shifts upward and the aggregate demand curve shifts to the left​

d

the aggregate expenditure line shifts downward and the economy moves upward along the aggregate demand curve​

e

the aggregate expenditure line shifts downward and the aggregate demand curve shifts to the left

In: Economics

RAK, Inc., has no debt outstanding and a total market value of $240,000. Earnings before interest...

RAK, Inc., has no debt outstanding and a total market value of $240,000. Earnings before interest and taxes, EBIT, are projected to be $36,000 if economic conditions are normal. If there is strong expansion in the economy, then EBIT will be 20 percent higher. If there is a recession, then EBIT will be 25 percent lower. RAK is considering a $155,000 debt issue with an interest rate of 6 percent. The proceeds will be used to repurchase shares of stock. There are currently 6,000 shares outstanding. Ignore taxes for questions a and b. Assume the company has a market-to-book ratio of 1.0.

  

a-1

Calculate return on equity (ROE) under each of the three economic scenarios before any debt is issued. (Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

ROE
  Recession %  
  Normal %  
  Expansion %  

  

a-2

Calculate the percentage changes in ROE when the economy expands or enters a recession. (Negative amounts should be indicated by a minus sign. Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

% change in ROE
  Recession %  
  Expansion %  

  

Assume the firm goes through with the proposed recapitalization.
b-1

Calculate the return on equity (ROE) under each of the three economic scenarios. (Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

ROE
  Recession %  
  Normal %  
  Expansion %  

  

b-2

Calculate the percentage changes in ROE when the economy expands or enters a recession. (Negative amounts should be indicated by a minus sign. Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

% change in ROE
  Recession %  
  Expansion %  

  

Assume the firm has a tax rate of 35 percent.

  

c-1

Calculate return on equity (ROE) under each of the three economic scenarios before any debt is issued. (Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

ROE
  Recession %  
  Normal %  
  Expansion %  

  

c-2

Calculate the percentage changes in ROE when the economy expands or enters a recession. (Negative amounts should be indicated by a minus sign. Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

% change in ROE
  Recession %  
  Expansion %  

  

c-3

Calculate the return on equity (ROE) under each of the three economic scenarios assuming the firm goes through with the recapitalization. (Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

ROE
  Recession %  
  Normal %  
  Expansion %  

  

c-4

Given the recapitalization, calculate the percentage changes in ROE when the economy expands or enters a recession. (Negative amounts should be indicated by a minus sign. Round your answers to 2 decimal places. (e.g., 32.16))

  

% change in ROE
  Recession %  
  Expansion %  

In: Finance

RAK, Inc., has no debt outstanding and a total market value of $150,000. Earnings before interest...

RAK, Inc., has no debt outstanding and a total market value of $150,000. Earnings before interest and taxes, EBIT, are projected to be $28,000 if economic conditions are normal. If there is strong expansion in the economy, then EBIT will be 20 percent higher. If there is a recession, then EBIT will be 25 percent lower. RAK is considering a $60,000 debt issue with an interest rate of 7 percent. The proceeds will be used to repurchase shares of stock. There are currently 10,000 shares outstanding. Ignore taxes for questions a and b. Assume the company has a market-to-book ratio of 1.0.

  

a-1

Calculate return on equity (ROE) under each of the three economic scenarios before any debt is issued. (Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

ROE
  Recession %  
  Normal %  
  Expansion %  

  

a-2

Calculate the percentage changes in ROE when the economy expands or enters a recession. (Negative amounts should be indicated by a minus sign. Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

% change in ROE
  Recession %  
  Expansion %  

  

Assume the firm goes through with the proposed recapitalization.
b-1

Calculate the return on equity (ROE) under each of the three economic scenarios. (Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

ROE
  Recession %  
  Normal %  
  Expansion %  

  

b-2

Calculate the percentage changes in ROE when the economy expands or enters a recession. (Negative amounts should be indicated by a minus sign. Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

% change in ROE
  Recession %  
  Expansion %  

  

Assume the firm has a tax rate of 35 percent.

  

c-1

Calculate return on equity (ROE) under each of the three economic scenarios before any debt is issued. (Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

ROE
  Recession %  
  Normal %  
  Expansion %  

  

c-2

Calculate the percentage changes in ROE when the economy expands or enters a recession. (Negative amounts should be indicated by a minus sign. Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

% change in ROE
  Recession %  
  Expansion %  

  

c-3

Calculate the return on equity (ROE) under each of the three economic scenarios assuming the firm goes through with the recapitalization. (Do not round intermediate calculations. Enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

  

ROE
  Recession %  
  Normal %  
  Expansion %  

  

c-4

Given the recapitalization, calculate the percentage changes in ROE when the economy expands or enters a recession. (Negative amounts should be indicated by a minus sign. Round your answers to 2 decimal places. (e.g., 32.16))

  

% change in ROE
  Recession %  
  Expansion %  

In: Finance

Kaelea, Inc., has no debt outstanding and a total market value of $82,000. Earnings before interest...

Kaelea, Inc., has no debt outstanding and a total market value of $82,000. Earnings before interest and taxes, EBIT, are projected to be $8,500 if economic conditions are normal. If there is strong expansion in the economy, then EBIT will be 20 percent higher. If there is a recession, then EBIT will be 25 percent lower. The company is considering a $28,200 debt issue with an interest rate of 7 percent. The proceeds will be used to repurchase shares of stock. There are currently 4,100 shares outstanding. Assume the company has a market-to-book ratio of 1.0.

a. Calculate return on equity, ROE, under each of the three economic scenarios before any debt is issued, assuming no taxes. (Do not round intermediate calculations and enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

ROE
Recession 7.7 %
Normal 10.37 %
Expansion 12.44 %

b. Calculate the percentage changes in ROE when the economy expands or enters a recession, assuming no taxes. (A negative answer should be indicated by a minus sign. Do not round intermediate calculations and enter your answers as a percent rounded to the nearest whole number, e.g., 32.)

%?ROE
Recession -25 %
Expansion 20 %

Assume the firm goes through with the proposed recapitalization and no taxes.

c. Calculate return on equity, ROE, under each of the three economic scenarios after the recapitalization. (Do not round intermediate calculations and enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

d. Calculate the percentage changes in ROE for economic expansion and recession. (A negative answer should be indicated by a minus sign. Do not round intermediate calculations and enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

Assume the firm has a tax rate of 40 percent.

e. Calculate return on equity, ROE, under each of the three economic scenarios before any debt is issued. Also, calculate the percentage changes in ROE for economic expansion and recession. (A negative answer should be indicated by a minus sign. Do not round intermediate calculations and enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

ROE
Recession 4.66 %
Normal 6.22 %
Expansion 7.46 %
%?ROE
Recession -25 %
Expansion 20 %

f. Calculate return on equity, ROE, under each of the three economic scenarios after the recapitalization. Also, calculate the percentage changes in ROE for economic expansion and recession, assuming the firm goes through with the proposed recapitalization. (A negative answer should be indicated by a minus sign. Do not round intermediate calculations and enter your answers as a percent rounded to 2 decimal places, e.g., 32.16.)

I was able to calculate some of the answers that I filled in above. They have already been varified by connect so I only need help with parts c,d, and f

Thanks.

In: Finance

What is wrong with my add and remove method (in bold) under the SongList that it...

What is wrong with my add and remove method (in bold) under the SongList that it is creating a NullPointerException?

public class Song
{
// instance variables
private String m_artist;
private String m_title;
private Song m_link;

// constructor
public Song(String artist, String title)
{
m_artist = artist;
m_title = title;
m_link = null;
}

// getters and setters
public void setArtist(String artist)
{
m_artist = artist;
}

public String getArtist()
{
return m_artist;
}

public void setTitle(String title)
{
m_title = title;
}

public String getTitle()
{
return m_title;
}
  
public void setLink(Song link)
{
m_link = link;
}

public Song getLink()
{
return m_link;
}
}

-------------------------------------------------------------------

public class SongList
{
// instance variables
private Song m_last;
private int m_numElements;

// constructor
// Do not make any changes to this method!
public SongList()
{
m_last = null;
m_numElements = 0;
}

// check whether the list is empty
// Do not make any changes to this method!
boolean isEmpty()
{
if (m_last == null)
return true;
else
return false;
}

// return the size of the list (# of Song nodes)
// Do not make any changes to this method!
public int size()
{
return m_numElements;
}

// add a new Song to the circular linked list with the given artist and
// title, keeping the list sorted by *song title*.
public void add(String artist, String title)
{
// TODO: implement this method
  
Song newNode = new Song(artist, title);


if(m_last == null)
{
m_last = newNode;
m_numElements++;
return;
}

Song previous = null;
Song current = m_last;



while (current != null)
{
//System.out.println(current.getTitle() + " comparedTo " + title + ": " + (current.getTitle()).compareTo(title));
int compareToResult = (current.getTitle()).compareTo(title);

if (compareToResult < 0)
{
previous = current;
current = current.getLink();
//m_numElements++;


}

else
break;


}

if (previous == null)
{
newNode.setLink(m_last);
m_last = newNode;
m_numElements++;
}

else
{
previous.setLink(newNode);
newNode.setLink(current);
m_numElements++;
}   
}


// remove a Song associated with the given artist and title from the list,
// keeping the list sorted by *song title*.
public boolean remove(String artist, String title)
{
  
Song previous = null;
Song current = m_last;
boolean match = false;
  
while (current != null)
{
int compareToTitle = (current.getTitle()).compareToIgnoreCase(title);
int compareToArtist = (current.getArtist()).compareToIgnoreCase(artist);

if (compareToTitle < 0 && compareToArtist < 0)
{
previous = current;
current = current.getLink();
}
else if (compareToTitle == 0 && compareToArtist == 0)
{
match = true;
current = current.getLink();
  
  
if (previous == null)
m_last = current;
else
previous.setLink(current);
}
else
return match;
}
  
//return match;
return true;

}
  


  
// return a string representation of the list
// Do not make any changes to this method!
public String toString()
{   
String listContent = "";
Song current = m_last;
  
if (m_last != null)


do
{
current = current.getLink();
listContent += " [" + current.getArtist() + " - " + current.getTitle() + "]\n";

} while (current != m_last);

return listContent;
}
}

-------------------------------------------------------------------------------------------------------------------

In: Computer Science