Question

In: Computer Science

Using rscript Let us assume that the credit rating of a company determines yield to maturity...

Using rscript

Let us assume that the credit rating of a company determines yield to maturity (YTM) of the bond. This leaves you now with three different YTM: 2% for AAA, 4% for AA, 8% for others. You want to run the following commends. If the credit rating is AAA, print “YTM of the bond is 2%.” If the credit rating is AA, print “YTM of the bond is 4%.” If the credit rating is neither AAA nor AA, print “YTM of the bond is 8%.” Somebody already wrote the following code for you, and you have to complete the next lines. bond.rating <- "A" a) To run the commends above, use if....else statement. b) To run the commends above, use if....else if statement.

Solutions

Expert Solution

PLEASE GIVE THUMBS UP, THANKS

a) CODE WITH OUTPUT SAMPLE :

Code:

bond.rating <- "A"
if (bond.rating =="AAA"){
print("YTM of the bond is 2%.")
}else {
if (bond.rating =="AA"){
print("YTM of the bond is 4%.")
}else{
print("YTM of the bond is 8%.");
}
}

b)

code:

bond.rating <- "A"
if (bond.rating =="AAA"){
print("YTM of the bond is 2%.")
}else if (bond.rating =="AA"){
print("YTM of the bond is 4%.")
}else{
print("YTM of the bond is 8%.");
}




Related Solutions

A bond's credit rating provides a guide to its price. Assume Aaa bonds yield 4.1% and...
A bond's credit rating provides a guide to its price. Assume Aaa bonds yield 4.1% and Baa bonds yield 5.1%. Assume a 10% five-year bond with annual coupons and a face value of $1,000. (Do not round intermediate calculations. Round your answers to 2 decimal places.) a. What is the bond's price if it is rated as Aaa? Bond price            $ b. What is the bond's price if it is rated as Baa? Bond price            $
A bond's credit rating provides a guide to its price. Assume Aaa bonds yield 3.9% and...
A bond's credit rating provides a guide to its price. Assume Aaa bonds yield 3.9% and Baa bonds yield 4.9%. Assume a 10% five-year bond with annual coupons and a face value of $1,000. (Do not round intermediate calculations. Round your answers to 2 decimal places.) a. What is the bond's price if it is rated as Aaa? b. What is the bond's price if it is rated as Baa?
A. Sebastian checks Daniel’s credit rating and determines that he will qualify for a 6% auto...
A. Sebastian checks Daniel’s credit rating and determines that he will qualify for a 6% auto loan, and they agree that his trade-in is worth $6,000. The cost of the car is $22,000. If he is planning to finance the loan for 5 years, how much does he have to pay every month? B. Repeat for if he is planning to finance the loan for 3 years.
The yield to maturity for 10-year bonds is as follows for four different bond rating categories....
The yield to maturity for 10-year bonds is as follows for four different bond rating categories. Use Appendix B and Appendix D for an approximate answer but calculate your final answer using the formula and financial calculator methods. Aaa 8.60% Aa1 8.80% Aa2 9.00% Aa3 10.00% The bonds of Falter Corporation were rated as Aa1 and issued at par a few weeks ago. The bonds have just been downgraded to Aa3. Determine the new price of the bonds, assuming a...
Calculate an approximation of the yield to maturity (using thecurrent yield) of a20-year coupon...
Calculate an approximation of the yield to maturity (using the current yield) of a20-year coupon bond with face value of 10,000$ and coupon rate of 5% per year;assume that its price today is 3,000$.
How many types of Credit Market Instruments? Explain . Discuss the yield to maturity on a...
How many types of Credit Market Instruments? Explain . Discuss the yield to maturity on a sample loan with example?
Assume you own a bond with a 5% coupon, a 6% yield-to-maturity, 5 years to maturity,...
Assume you own a bond with a 5% coupon, a 6% yield-to-maturity, 5 years to maturity, and a $1,000 par value. It is currently priced at $957.35. If the yield-to-maturity increases to 8.0%, what is the price of the bond? Select one: a. $1,043.76 b. $878.33 c. $1,000 d. $1,087.52
Interpreting Relations among Bond Price, Coupon, Yield, and Credit Rating The following appeared on Yahoo! Finance...
Interpreting Relations among Bond Price, Coupon, Yield, and Credit Rating The following appeared on Yahoo! Finance (finance.yahoo.com) regarding outstanding bonds issued by Citigroup Inc. Price Coupon (%) Maturity Yield to Maturity (%) Fitch Ratings 129.87 6.65 2028 3.725 A 114.41 4.950 2043 4.095 A Questions: A) Discuss the relation among the coupon, rate, price, and yield for the bond maturing in 2028. B) Compare the yields on the two books. Why are the yields different when the credit ratings are...
The going yield-to-maturity on a 30 year US Treasury bond is about 1.4% (as of last...
The going yield-to-maturity on a 30 year US Treasury bond is about 1.4% (as of last Friday). Does this mean that an investor who buys this bond today will earn a rate of return of 1.4% % with certainty? Explain in detail
Let us assume that there are two visitors, A and B, in an amusement park. The...
Let us assume that there are two visitors, A and B, in an amusement park. The demand curve for the visitors facing the amusement park are as follows. PA= 5 – 2QA PB= 2.5 – 0.5QB Marginal cost (MC) to serve each visitor is equal to $1. a. If the amusement park decides to set the price using two-part tariff, given the demand curve P=6 – 2.5Q and MC =$1, how much is the equilibrium P and Q b. Calculate...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT