Can any one please help me in this homework
all the informations in the document
--NOTE-- /I must use proper indentation and meaningful variable names in my programs
Adobe Document Cloud
or you can see these pic :
------
------
Can any one please help me in this homework
all the informations in the document
--NOTE-- /I must use proper indentation and meaningful variable names in my programs
Adobe Document Cloud
or you can see these pic :
------
------
Last edited by mishal07; 10-10-2018 at 09:23 AM.
So what are you stuck on?
Can you read a char and tell whether it's P, C or S ?
If you know you've chosen 'C' say, can you then go onto read parameters L,a,b ?
In short, you need to put forth some actual effort.
Colouring in your prose and dumping your assignment doesn't count.
Make an honest attempt, post your code where you get stuck, and ask a specific question.
Eg
"I can read all the parameters for C type capacitor, but why does it always prints zero?".
That is a specific question based on some coding effort.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
How is it 'much higher' your level?
Have you looked at your previous program to see how it handles basic things like
- using scanf to read input from the user
- using 'if' statements to decide a course of action.
Homework is there to enable the tutor to find out whether you've learnt anything.
It seems to me that if you've been coasting along getting others to do your work for you, and in doing so, you've failed to fully understand what you're supposed to do when faced with a new programming challenge.
Perhaps you should just drop the course if you're not willing to put in any effort on your own.
I mean, if you can't even manage to print a few strings and prompt for a choice (something you should have mastered weeks ago), then there really is no hope for you.
Some more salient points from your document
So you've been sitting on your hands for 2 weeks now, and now it's "urgent".[Posted: Thursday 27th September 2018]
[Due Date: Sunday 14th October 2018 @ 11:59 PM (Before Midnight)]
Or have you been wandering from one forum to another hoping to find some mug to do your homework, but come up empty?
Is this the course you're on?Cheating is taken seriously. Any cheating attempt will result in 0 for this homework and the remaining ones.
EACH STUDENT IS REQUIRED TO DO THE HOMEWORK ALONE. COPYING FROM ANY SOURCE IS REGARDED AS CHEATING.
ICS 103 Computer Programming in C
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
i just finished my exams so i can deal with that by my own but i notice that there are a new things in this homework i dont remember that i took them
this why i ask for help (i cant even start ) because i think this will take days from me to understand what i can do with this task and organize it
but if you dont want to help me or you think why i am doing it because the dead line is come up its ok its not even "urgent" i am sure i can come up with the solution alone
but i need days and i have exams too
and yes this is my course ics 103 in kfupm
The program doesn't even have to be that fancy, you can use simple techniques and get it done, just start and ask a more concrete question.
You've done your exams, and even if you passed them with a mediocre grade, you shouldn't need total hand holding.
Code:#include<stdio.h> #include<math.h> #define PI 3.14159 #define Eo 8.85e-6 int main () { int choice,type ; double C,d,l,a,b,area,air=1.000594*Eo,Teflon =2.1*Eo,Ceramic=5.6*Eo,Glass=7.5*Eo,Silicon=11.68*Eo,E,E2; printf ("---ccc-----\n"); printf ("1.[p] Parallel Plates\n" ); printf ("2.[c] Cylindrical\n"); printf ("3.[s] sphereical\n" ); printf("choice one plese:" ); scanf("%d",&choice); switch (choice){ case 1 : printf ("\nparallel plates was chosen!"); printf ("\nEnter the area: "); scanf ("%lf",&area); printf ("\nEnter the distance between plates:"); scanf ("%lf",&d); printf ("---type---\n"); printf ("10.Air\n"); printf("20.Teflon\n"); printf("30.Ceramic\n"); printf("40.Glass\n"); printf("50.Silicon\n"); printf("choice one plese: " ); scanf("%d",&type); switch (type) case 10 : printf ("\nTYPE AIR WAS CHOSEN ! "); C= air*(area/d); printf ("\nthe result is %.2le micro farad",C); break ; case 20: E=Teflon*Eo; C= Teflon*(area/d); printf("Type TEFLON was chosen!"); printf("\n the result is %.2le micro farad",C); break; case 30: C= Ceramic*(area/d); printf ("TYPE CERAMIC WAS CHOSEN !"); printf ("\nthe result is %.2le micro farad",C); break; case 40 : C= Glass*(area/d); printf ("TYPE GLASS WAS CHOSEN !"); printf ("\nthe result is %.2le micro farad",C); break; case 50 : printf ("\nTYPE SILICON WAS CHOSEN !"); C= Silicon*(area/d); printf ("\nthe result is %.2le micro farad",C); return 0; } switch (choice) { case 2 : printf ("Enter the length : "); scanf("%lf",&l); printf ("Enter radius a and b (a<b) "); scanf (" %lf %lf",&a,&b); printf ("---type---\n"); printf ("10.Air\n"); printf("20.Teflon\n"); printf("30.Ceramic\n"); printf("40.Glass\n"); printf("50.Silicon\n"); printf("choice one plese: " ); scanf("%d",&type); switch (type) case 10 : printf ("\nTYPE AIR WAS CHOSEN ! "); C=(2.0*PI*air*l)/log(b/a); printf ("\nthe result is %.2e micro farad",C); break ; case 20 : C=(2.0*PI*Teflon*l)/log(b/a); printf("Type TEFLON was chosen!"); printf("\n the result is %.2e micro farad",C); break; case 30 : C=(2.0*PI*Ceramic*l)/log(b/a); printf ("TYPE CERAMIC WAS CHOSEN !"); printf ("\nthe result is %.2e micro farad",C); break; case 40 : C=(2.0*PI*Glass*l)/log(b/a); printf ("TYPE GLASS WAS CHOSEN !"); printf ("\nthe result is %.2e micro farad",C); break; case 50 : printf ("\nTYPE SILICON WAS CHOSEN !"); C=(2.0*PI*Silicon*l)/log(b/a); printf ("\nthe result is %.2e micro farad",C); return 0; } switch (choice) { case 3 : printf("enter the inner and the outer (a<b) "); scanf ("%lf %lf",&a,&b); printf ("---type---\n"); printf ("10.Air\n"); printf("20.Teflon\n"); printf("30.Ceramic\n"); printf("40.Glass\n"); printf("50.Silicon\n"); printf("choice one plese: " ); scanf("%d",&type); switch (type) case 10 : printf ("\nTYPE AIR WAS CHOSEN ! "); C=(4*PI*air*a*b)/b-a; printf ("\nthe result is %.2e micro farad",C); break ; case 20 : C=(4*PI*Teflon*a*b)/b-a; printf("Type TEFLON was chosen!"); printf("\n the result is %.2e micro farad",C); break; case 30 : C=(4*PI*Ceramic*a*b)/b-a; printf ("TYPE CERAMIC WAS CHOSEN !"); printf ("\nthe result is %.2e micro farad",C); break; case 40 : C=(4*PI*Glass*a*b)/b-a; printf ("TYPE GLASS WAS CHOSEN !"); printf ("\nthe result is %.2e micro farad",C); break; case 50 : printf ("\nTYPE SILICON WAS CHOSEN !"); C=(4*PI*Silicon*a*b)/b-a; printf ("\nthe result is %.2e micro farad",C); return 0; } }
this what i do ( my best ) i wasn't want to do it because 100 % its will not work
but i do it to show you that its impossible to me
any way my problems is :
1- the texts like (TYPE SILICON WAS CHOSEN !") and the others never shows
2- in every case if i enter the same number its gives me the same result
3- its veeeeeeeeeeeeeeeeeeery long code
4- i cant use the char instead of the numbers i dont know why
5- like u see the program gives me the same result and not correct like what is showes in the example and gives me the same answer for all cases
Last edited by mishal07; 10-11-2018 at 03:02 PM.
I think part of the problem is you repeated the material type a lot. There are two switches handling the same thing.
It would be way easier to understand if there were one switch handling that job. The way I see it you can do it like this:
Code:// Figure out the shape of the capacitor printf ("---ccc-----\n"); printf ("1.[p] Parallel Plates\n" ); printf ("2.[c] Cylindrical\n"); printf ("3.[s] sphereical\n" ); printf("choice one plese:" ); scanf("%d",&choice); switch (choice){ case 1 : printf ("\nparallel plates was chosen!"); printf ("\nEnter the area: "); scanf ("%lf",&area); printf ("\nEnter the distance between plates:"); scanf("%lf",&d); break; case 2: printf("Cylindrical was chosen!\n"); printf ("Enter the length : "); scanf("%lf",&l); printf ("Enter radius a and b (a<b) "); scanf (" %lf %lf",&a,&b); break; case 3: printf("enter the inner and the outer (a<b) "); scanf ("%lf %lf",&a,&b); break; } // Now choose the capacitor's dielectric double material; scanf("%d", &type); switch (type) { case 10: material = air; break; case 20: material = teflon; break; case 30: material = ceramic; break; case 40: material = glass; break; case 50: material = silicon; break; }
This will be much simpler for you I think.
You should also review all your equations since the answers are wrong. The biggest thing that I can see is you're not necessarily dividing right: you need to use ( grouping ) to divide by the right quantities.
Last edited by whiteflags; 10-11-2018 at 03:57 PM.