Identify three test cases one using a number with 4 factors

Assignment Help Electrical Engineering
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

Reference no: EM13263752

Questions Cloud

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?

Reviews

Write a Review

Electrical Engineering Questions & Answers

  Use microsoft excel to compare costs

Use Microsoft Excel to compare costs from at least three different vendors and reasons to accept specific bids. (May use graphs in Excel to provide a better visual comparison)

  Develop a system to help students learn morse code

Develop a system to help students learn Morse Code. The system will have one input and 26 outputs (one per letter). The user sends in Morse Code pulses on the input, and as characters are completed the appropriate letter is lit up momentarily.

  Display a flashing light to alert the operator

If a third attempt is made within 20 seconds, a waiting period of 20 seconds is required before additional attempts can be made to start the motor. While waiitng to make additional attempts to start the motor.

  Determine the armature current at a speed of dc motor

A DC motor has a terminal voltage of 5V, a motor constant of Ka = 5.2 x 10-3 Vs, and an armature resistance of 500-ohm. Find the stall current, max speed in rotations per minute (RPM), and armature current at a speed of 480.769 radian/s (4591.006 ..

  Define a three single phase transformers with a turns ratio

Three single phase transformers with a turns ratio of 1:1 are connected to form a three phase transformer. The transformer input is a three wire three phase 120V (line-to-line) system. the transformer output supplies a "Y" connected three phase lo..

  Design a circuit to multiply a 2-bit unsigned magnitude

Design a circuit to multiply a 2-bit unsigned magnitude binary number by 1, 2, 3, or 4 to produce a 4-bit output

  Find force f on current element assuming b field constant

A current element of length 1cm is located at (1m, 3m, 4m) in free space and carries a current of 20mA along ay. An infinitely long filamentary current of 12A along az passes through the coordinate origin (0,0).

  Calculate primary voltage required and voltage regulation

Three single phase 2400v/240v transformers are connected for operation as a 4160/240 v 3phase bank. Each transfomers has a Zeq1=1.42+j1.82 ohms and rated at 150kva

  Find shortest distance from the load to location of the stub

A 100-Ohm lossless transmission line is to be matched to a load with impedance ZL = 120 - j80 Ohm using a short-circuited stub. Use the Smith chart to determine: (a) the standing wave ratio, (b) the shortest distance from the load to the location ..

  Calculate the fermi level on each side of the junction

An abrupt silicon pn junction at zero bias has dopant concentrations of Na = 1017/cm3 and Nd = 5 x 1015 cm-3 at T = 300K. (a) Calculate the Fermi level on each side of the junction with respect to the intrinsic Fermi level.

  Determine the magnitude of the resultant

A tow truck applies forces F1 and F2 to the bumper of an automobile where F1 is horizontal. Determine the magnitude of F2 that will provide a vertical resultant force, and determine the magnitude of this resultant.

  Determine the generated voltage and the kw rating

A four pole DC machine has a wave winding of 300 turns. The flux per pole is .025 webers. The DC machine rotates at 1000 RPM. Determine the generated voltage and the kW rating if the current through the turn is 25 amps.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd