954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

My Assignment...Hu can help me???

Write a program for the following problem. An instructor needs a program that accepts a student identification number and three test scores, test1, test2, and final_test as input, and determines and outputs for each student the semester average and the final letter grade according to the following scheme:

SEMESTER AVERAGE FINAL LETTER GRADE
90 – 100 A
80 – 89 B
70 – 79 C
60 – 69 D
0 – 59 F

The semester average for students is computed using the formula
semester_average = 0.20 * test1 + 0.30 * test2 + 0.50 * final_test

Student identification numbers are four-digits integer. Input should terminate when the instructor types 0 for the student identification number. The instructor also wants a distribution of letter grades and a class average. Class average is computed using the following formula:

class_average = (4 * number_of_A_grades + 3 * number_of_B_grades + 2 * number_of_C_grades + 1 * number_of_D_grades)/number_of_students

hket89
Light Poster
31 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
 
Salem
Posting Sage
Team Colleague
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
 

Believe me nobody is gonna help you unless you show some progress in your assignment.

9868
Light Poster
36 posts since Mar 2009
Reputation Points: 45
Solved Threads: 7
 
Believe me nobody is gonna help you unless you show some progress in your assignment.

Then u noe hw 2 use do-while loop mar?

hket89
Light Poster
31 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
 
Then u noe hw 2 use do-while loop mar?


Something like

do {

/* your code here */
} while (condition)
ithelp
Nearly a Posting Maven
Banned
2,230 posts since May 2006
Reputation Points: 769
Solved Threads: 128
 

I think you should start with a basic C book. You can not learn each and every language construct by communities.

DangerDev
Posting Pro in Training
485 posts since Jan 2008
Reputation Points: 165
Solved Threads: 59
 

Something like

do {

/* your code here */
} while (condition)


You forgot the semicolon after the while.:icon_smile:

9868
Light Poster
36 posts since Mar 2009
Reputation Points: 45
Solved Threads: 7
 

Could u gv me the website tat can download c programing the notes n the example? Thx^^

hket89
Light Poster
31 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
 
Could u gv me the website tat can download c programing the notes n the example? Thx^^


Google C programming tutorials and you will find more than a ton.

9868
Light Poster
36 posts since Mar 2009
Reputation Points: 45
Solved Threads: 7
 

I am too very new in C... I ll try to solve ur prob.....

alvalany
Junior Poster in Training
61 posts since Jul 2009
Reputation Points: 8
Solved Threads: 2
 

Rily?
Then thx ya...hehe

hket89
Light Poster
31 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
 


For crying out loud, is this a forum on how to shortcut the English language? Sometimes it feels like it's a tutorial on how to read friggin' SMS messages.
Then u noe hw 2 use do-while loop mar?
u=you, noe=know,hw=how, 2=to, mar=anyone's guessCould u gv me the website tat can download c programing the notes n the example? Thx^^
u=you, gv=give, tat=that, n=and, thx=thanksI am too very new in C... I ll try to solve ur prob.....
ur=your,prob=problem

Here's the deal; in the examples I quoted, there is a difference of 19 characters between the crapshoot spelling and the correct spelling (not counting whatever the hell "mar" means).

Get on board and at least try to use proper English.

yellowSnow
Posting Whiz in Training
203 posts since Jul 2009
Reputation Points: 651
Solved Threads: 35
 

Im to 100% sure.. I ll try my best...

alvalany
Junior Poster in Training
61 posts since Jul 2009
Reputation Points: 8
Solved Threads: 2
 

I could do only this.......
Rest is left upto you....
Reply if this was useful..

#include<stdio.h>
#include<conio.h>
void main()
{
int i=0,a=0,b=0,c=0,dg=0,f=0;float ca=0,x;
struct data
{
	int sin; //student id no
	int t1; //test 1
	int t2; //test 2
	int tf;//final test
	float sa ;//sem average
	char grad;
};


struct data d[100];
clrscr();
for(i=0;i<=99;)
{
	printf("Enter the student identification number:");
	scanf("%d",&d[i].sin);
	if(d[i].sin==0)
	break;
	printf("Enter the test marks of TEST 1,TEST 2,TEST 3 respectively\n");
	scanf("%d%d%d",&d[i].t1,&d[i].t2,&d[i].tf);
	d[i].sa=0.20*d[i].t1 +0.30*d[i].t2+0.50*d[i].tf;
	printf("SEMESTER AVERAGE= %f\n",d[i].sa);
	x=d[i].sa;

	if((x<=100.00) && (x>=90.0))
	{
		d[i].grad='A';
		printf("The grade of student is A\n");
		a++;
	}
	if((x<=89.0) && (x>=80.0))
	{
		d[i].grad='B';
		printf("The grade of student is B\n");
		b++;
	}
	if((x<=79.0) && (x>=70.0))
	{
		d[i].grad='C';
		printf("The grade of student is C\n");
		c++;
	}

	if((x<=69.0) && (x>=60.0))
	{
		d[i].grad='D';
		printf("The grade of student is D\n");
		dg++;
	}
	if((x<=59.0) && (x>=0.0))
	{
		d[i].grad='F';
		printf("The grade of student is F\n");
		f++;
	}

	i++;
}
printf("The number of students having A grade : %d\n",a);
printf("The number of students having B grade : %d\n",b);
printf("The number of students having C grade : %d\n",c);
printf("The number of students having D grade : %d\n",dg);
printf("The number of students having F grade : %d\n",f);


ca= (4*a+3*b+2*c+1*dg)/i;
printf("Class Average is %f",ca);
getch();

}
alvalany
Junior Poster in Training
61 posts since Jul 2009
Reputation Points: 8
Solved Threads: 2
 

Since the OP seems to be happy (quote - "hehe") for someone to do his (or her) homework, all I'll say about your code is DO NOT USE void main().

And I'm sure the OP is 'rily' happy for you to do this.

The main function should be declared as:

- int main(), or
- int main(void), or
- int main(int argc, char *argv[]), or
- int main(int argc, char **argv)

Just shoot the void as the return type.

yellowSnow
Posting Whiz in Training
203 posts since Jul 2009
Reputation Points: 651
Solved Threads: 35
 

Since the OP seems to be happy (quote - "hehe") for someone to do his (or her) homework, all I'll say about your code is DO NOT USE void main().

And I'm sure the OP is 'rily' happy for you to do this.

The main function should be declared as:

- int main(), or - int main(void), or - int main(int argc, char *argv[]), or - int main(int argc, char **argv)

Just shoot the void as the return type.


thanks for your correction.......

alvalany
Junior Poster in Training
61 posts since Jul 2009
Reputation Points: 8
Solved Threads: 2
 

One correction has to be done in the code..
No rank will be reported when sa is b/w 69 and 70.. and other similar cases..
hope you can correct it yourself

alvalany
Junior Poster in Training
61 posts since Jul 2009
Reputation Points: 8
Solved Threads: 2
 

Whats the difference between void main() and int main()?

hket89
Light Poster
31 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
 

#include

int main(){
int id_no, test1, test2, final_test, semester_average, count;

printf("\t\t* * * * * * * * * * * * * * * * * * * * * * * * * *\n");
printf("\t\t*_________________________________________________*\n");
printf("\t\t*| Welcome to My Programe |*\n");
printf("\t\t*|_______________________________________________|*\n");
printf("\t\t*|____SEMESTER AVERAGE______FINAL LETTER GRADE__|*\n");
printf("\t\t*| | |*\n");
printf("\t\t*| 90 – 100 | A |*\n");
printf("\t\t*| 80 – 89 | B |*\n");
printf("\t\t*| 70 – 79 | C |*\n");
printf("\t\t*| 60 – 69 | D |*\n");
printf("\t\t*| 0 – 59 | F |*\n");
printf("\t\t*|________________________|______________________|*\n");
printf("\t\t* * * * * * * * * * * * * * * * * * * * * * * * * *\n");

do{
printf("Enter the student ID no[4 digit]: \n");
scanf("%d", &id_no);
if(id_no < 1000 || id_no > 10000){
do{
printf("Invalid!!! The ID no must in 4 digit number.\n");
printf("Please enter the student ID no again: \n");
scanf("%d", &id_no);
}while(id_no < 1000 || id_no > 10000);

}

printf("Enter test score 1: \n");
scanf("%d", &test1);
if(test1 <= -1 || test1 > 101)
{
do{
printf("Invalid!!!\n");
printf("Please enter the test for score 1 again: \n");
scanf("%d", &test1);
}while(test1 <= -1 || test1 > 101);
}

printf("Enter test score 2: \n");
scanf("%d", &test2);
if(test2 <= -1 || test2 > 101)
{
do{
printf("Invalid!!!\n");
printf("Please enter the test for score 2 again: \n");
scanf("%d", &test2);
}while(test2 <= -1 || test2 > 101);
}

printf("Enter test final score: \n");
scanf("%d", &final_test);
if(final_test <= -1 || final_test > 101)
{
do{
printf("Invalid!!!\n");
printf("Please enter the test for final again: \n");
scanf("%d", &final_test);
}while(final_test <= -1 || final_test > 101);
}

semester_average = 0.20 * test1 + 0.30 * test2 + 0.50 * final_test;

printf("Semester average for student %d: %d\n", id_no, semester_average);
printf("Press 1 to continue or press 0 to exit the programe.\n");
scanf("%d", &count);
}while(count != 0);

printf("Thanks 4 using.\n");

return 0;

}

hket89
Light Poster
31 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
 

I try 2 cr8 a program to my assignment, bt din fin yet...
Please have a look at my program n gv sm advise...Thx^^

hket89
Light Poster
31 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You