Reference no: EM13263752
Write a program that generates all the factors of a number entered by the user. For instance, the number 12 has the factors 2 * 2 * 3. This program has the following requirements:
A. The user must enter a positive integer. If the user enters something else, your program should output an error message and let the user enter a new value. Use a do/while loop to make sure the user input is successful.
B. The factors must be output in increasing order. The lowest factor your program should report is 2.
C. Your program should output 4 factors per line, each factor in a field of 10 characters. (Hint: the number of factors output determines when to output endl!)
D. You will need a while loop to report the factors. Here are some helpful hints:
1. If (a % b == 0) then a is a factor of b.
2. When you have found a factor, output the factor and then reduce the number you are working with by dividing the number by the factor... ie) b = b / a;
1. Design an algorithm in pseudocode to solve the problem. Make sure to include steps to get each input and to report the output. Include steps to deal with error cases as specified above.
2. Identify three test cases, one using a number with 4 factors, one using a negative number, and one using a number with more than 4 factors. For each of the three test cases show what inputs you will use and what your expected outputs should be.
3. Write the program to implement your algorithm
Explain how would a voice signal be affected by a carrier
: AN SSB signal is generated by modulating a 5 MHz carrier with a 400 Hz sine tone. At the receiver, carrier is reinserted during demodulation, but its frequency is 5.00015 MHz rather than exactly 5 MHz. How does this affect the recovered signal
|
Determine the turns ratio of each transformer and current
: Three single-phase transformer are used to form a three-phase transformer bank rated 13.8kV(delta)/120kV(wye). One side is connected to a three-phase load of 12 MVA at 0.8 power factor lagging. Determine the turns ratio of each transformer
|
What is the net investment of this project
: Your company uses the 3-year MACRS method to depreciate the machine and equipment which are 33% 45%, 15% and 7%. The cost of capital is 11%.
|
Write an equation for the voltage across the resistor
: For a certain source-free parallel RLC circuit, R=1k-ohm, C=3uF and L is such that the circuit response is overdamped. Write an equation for the voltage across the resistor if it is known that v(0-) = 9V and dv/dt|t=0+= 2 V/s
|
Identify three test cases one using a number with 4 factors
: Identify three test cases, one using a number with 4 factors, one using a negative number, and one using a number with more than 4 factors. For each of the three test cases show what inputs you will use and what your expected outputs should be.
|
What is the percentage up movement
: Use a two-step tree to value a six-month European call option and a six-month European put option. In both cases the strike price is $150.
|
Verify that put-call parity holds
: Consider an option on a non-dividend-paying stock when the stock price is $30, the exercise price is $29, the risk-free interest rate is 5% per annum, the volatility is 25% per annum, and the time to maturity is four months.
|
Calculate the liquidity risk premium
: The maturity risk premium is 0.65 percent on 5-year securities and increases by 0.05 percent for each additional year to maturity. Calculate the liquidity risk premium on Tom and Sue's Flowers, lnc.'s, 15-year bonds.
|
What is weighted average cost of capital for the company
: The company is in the 40% tax bracket. What is the weighted average cost of capital (WACC) for the company?
|