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

  What is the resulting number of bits for a piece of music

In a CD player, the sampling rate is 44.1 kHz and the samples are quantized using a 16-bit/sample quantizer. what is The resulting number of bits for a piece of music with a duration of 50 minutes.

  Calculate the mass of the cooling water in a minute

an electrical transformer dissipates heat equivalent of 3000 kW/h. the inlet and outlet temperatures of the cooling water are 55C and 15C respectively. calculate the mass of the cooling water in a minute.

  Calculate the output signal for the input signal of a system

The transfer function of a system is formulated as H(f)=2f^2+i3f+2. Calculate the output signal for the input signal below which was applied to this system Vin(t)= 5+2cos(20(pi)t+30degrees)+sin(10(pi)t)

  What would make the pll converge in frequency and phase

A clever student notices that a high constant loop gain would make the PLL converge in frequency and phase. Rather than use an amplifier with infinite gain the student decides to just use an unstable filter.

  Design a mux with hardware description language

a. Write a Verilog code for a 2 to 1 Mux using gate-level structural level description. The two data input is D0 and D1, control input is C and output is Q. b. Write a Verilog code for a 2 to 1 Mux using behavioral level description.

  Calculate the phase voltage and line voltage

A three 120 - V power line is Y-connected. The three phase outputs are marked as a,b,c. The neutral is marked as n. The phase sequence is abc. It is connected to a balanced Y- connected load, with the impedance is 12 + j 9 omega.

  Calculate necessary excitation voltage n input complex power

A 150 MVA, 24 kV, 123% three-phase synchronous generator carries the rated load at a power factor 0.83 (lagging). Calculate the necessary excitation voltage and input complex power.

  Determine magnitude of the average inductor current

A buck-boost converter works with an input voltage of 12 V and switching frequency 10 kHz. The load resistance of 24 Ω requires doubled input voltage. The inductor and capacitors are 1 mH and 100 μF, respectively.

  Determine what is the mmf of the solenoid in ampere-turns

A 800 turn solenoid has a total wire length of 400 feet of AWG 24 copper wire. This wire has a resistance of 26.17 ohms per 1000 feet. The voltage measured from one end of the solenoid to the other is 21 volts. What is the mmf of the solenoid in a..

  What are individual drift and diffusion components of hole

given the electron and hole concentrations for a 2 micro meter region of Silicon. At x=0 the concentration of electrons is 10^16 and the concentration of holes is 1.01x10^18. At x=2 micro meters the concentration of electrons is 10^4

  Design 8-bit programmable microprocessor-compatible timer ic

design an 8-bit programmable microprocessor-compatible TIMER IC by doing the following steps: Specify, draw , and clearly label( the functional name), the complete set of 8-bit registers that will be needed in the TIMER.

  Determine what is the probability of false alarm

A spread-spectrum acquisition system uses a serial search scheme.The synchroniser integrates the squarer output for interval of 0.1s and the synchroniser output is sampled at intervals of 0.05s . The probability of false alarm is 0.064255 .

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