EGRE 245 Programming Project #1 Calculating Parallel Resistance solution


Original Work


5/5 - (5 votes)

1 Overview
The formula for the e↵ective resistance R of n resisters in parallel is
R = 1
+ … +
Write a complete C program that inputs from the keyboard the value of 3 resisters (in kohms)
and then prints to the screen a simple diagram of the system plus the e↵ective resistance of the 3
resisters connected in parallel. Make sure you prompt the user for all input and that you label all
of your output; you should do this for all applicable programs this semester. Also be sure to echo
print to the screen the values that have been entered.
Project #1’s code is given to you below; you are to input it exactly as it is shown (with the exception
that you would of course replace my name with yours). Don’t worry that the diagram will only
format correctly for up to three-digit input.
2 The Code
/* Project #1
D. Resler */
#include <stdio.h>
int main(void) {
float r1,r2,r3;
printf(“Proj. #1 – D. Resler\n”);
printf(“Enter the value of 3 resisters connected in parallel (in kohms)\n”);
printf(” #1: “);
printf(” value entered: %f\n”,r1);
printf(” #2: “);
printf(” value entered: %f\n”,r2);
printf(” #3: “);
printf(” value entered: %f\n”,r3);
printf(” |—— %6.2f kohms ——|\n”,r1);
printf(“—-|—— %6.2f kohms ——|—-\n”,r2);
printf(” |—— %6.2f kohms ——|\n”,r3);
printf(“Effective resistance: %f kohms\n”,1.0/(1.0/r1 + 1.0/r2 + 1.0/r3));
return 0;
3 Project Documentation
The very first lines in all of your programming project files this semester should be comments giving
general information about the project, class, author using the following format (you of course will
use your name instead of mine):
/* Project #1
EGRE245 Fall 2014
D. Resler */
In addition, the first output for all of your projects this semester should be the name of the project
and your name, e.g.
/* … */
main() {
printf(“Proj. #1 – D. Resler\n”);
/* … */
Again, be sure to use your name instead of mine!
4 Sample Run
5 Deliverables
You should turn in a stand-alone, complete application program (your C source code, a single file)
containing a main function. Name your source code file proj1XXXX.c where XXXX is the last
4 digits of your student id number. For example, if your student id number is V12345678, your
file will be named proj15678.c. Projects this term will be submitted via the web using a link o↵
of the class web page ( Be sure to keep a receipt of your file
submission. Note you need not turn in an executable file!
Due date: Thursday, January 22