Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You are expected to use the concept of arrays and loops in this assignment. Write a program that has resistance and current values, and needs
You are expected to use the concept of arrays and loops in this assignment. Write a program that has resistance and current values, and needs to calculate the value of the voltage and power dissipated in a circuit. 1. Declare and initialize an array named Resistances that holds the following values: 16, 27, 39, 56, 81. 2. You must also create additional arrays named Current, Voltage and Power, each with the same size as the Resistances array. 3. Set up a for loop to allow the user to enter the current values to be stored in the array named Current when the program is run. (This must be able to accept decimal numbers) 4. You want your program to calculate the value of Voltage for each case with the formula: Voltage = Resistance * Current So you will need to set up a formula like: Voltage[i] = Resistance[i] * Current[i] as you cycle through each element in the array. 5. Also find the power dissipated for each case using this formula: Power = Current^2 * Resistance. (So for this also you will need to write your formula for each element within your array Finally you should have the voltage and Power values calculated for each of the resistance values. Your output should be displayed as follows: Resistance Current Voltage Power 16 27 And so on Use required manipulators like setw, etc to ensure the values are displayed one below the other neatly. Run the program. Enter any 5 random values for the Current array. Get the output in the required format. Paste a screenshot of your output window into a word file, and make sure to submit that as a part of your zip file
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started