473,382 Members | 1,302 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Grading Program Homework

15
i have a problem on my program, actually it runs and compile but it is lacking of the informaton needed, can you please help me with this, im really appreciate in any comments, Here it is

The grade should follow the table below

<50 fail
50-59 D
60-69 C
70-79 B
80-89 A
90-100 exellent


enter no: 50
do you want to enter another? yes
enter no: 50
do you want to enter another? yes
enter no: 100
do you want to enter another? no// with this statement the program will stop and he needs to diplay this:

your total input : 3

the percentage Failed is: 0%
the percentage D is: 66.67%
the percentage C is: 0%
the percentage B is: 0%
the percentage A is: 0%
the percentage Exellent is: 33.33%

how can i make the total of that three inputs into code,

and how can i get the code of that percentage of A,B,C,D,Excellent and failed

this is what I’ve got so far

Expand|Select|Wrap|Line Numbers
  1.  #inlude <iostream.h> 
  2. #include<string.h>
  3. #include <conio.h>
  4. #include <stdio.h>
  5.  
  6. class Grade
  7.  
  8. {
  9.  
  10. Grade () {};
  11. ~Grade () {};
  12. void Message();
  13. int Gradefailed ( int F, int Total);
  14. int GradeD ( int D, int Total);
  15. int GradeC ( int C, int Total);
  16. int GradeB ( int B, int Total);
  17. int GradeA ( int C, int Total);
  18. int GradeDistinction ( int Distinction, int Total);
  19. };
  20.  
  21. void Message();
  22. {
  23. cout <<"enter grade:\n";
  24. cin<< score;
  25. cout <<"Do you want to enter another:";
  26. cin >> answer;
  27. }
  28. int Gradefailed ( int F, int Total);
  29. {
  30. return (F/Total)*100;
  31. }
  32. int GradeD ( int D, int Total);
  33. {
  34. return (D/Total)*100;
  35. }
  36. int GradeC ( int C, int Total);
  37. int GradeB ( int B, int Total);
  38. int GradeA ( int C, int Total);
  39. int GradeDistinction ( int Distinction, int Total);
  40.  
  41. same as the other foramat as above
  42.  
  43. }
  44.  
  45. int main ()
  46.  
  47. {
  48.  
  49. clrscr();
  50. Grade *p = new Grade;
  51. int score;
  52. char answer[5]="yes"
  53.  
  54. while (stricmp (answer, "no")!=0)
  55.  
  56. {
  57. p->Message ();
  58.  
  59. {
  60.  
  61. while mark (==0)
  62. {
  63. cout << "\n\nAnswer can’t be zero\n";
  64. }
  65. cout << "\nDo you want to solve another equation ? ( Yes ) or ( No )" << endl;
  66. cin >> answer;
  67. cout <<”please enter grade:”;
  68. cin >> grade;
  69. while(( stircmp( answer, "yes" ) != 0 ) && ( stricmp( answer, "no" ) != 0 ))
  70.         {
  71. cout << "Please only answer by \"yes\" or \"no\"!";
  72. cin >> answer;
  73.         }
  74. getch ();
  75.     }
  76. delete p;
  77. }
  78.  
how can make this kind of aoutput

your total input(s) is/are : 3

the percentage Failed is: 0%
the percentage D is: 66.67%
the percentage C is: 0%
the percentage B is: 0%
the percentage A is: 0%
the percentage Exellent is: 33.33%

thanks in advance!!!!!!!!!
Dec 13 '06 #1
3 2086
Manjiri
40
i have a problem on my program, actually it runs and compile but it is lacking of the informaton needed, can you please help me with this, im really appreciate in any comments, Here it is

The grade should follow the table below

<50 fail
50-59 D
60-69 C
70-79 B
80-89 A
90-100 exellent


enter no: 50
do you want to enter another? yes
enter no: 50
do you want to enter another? yes
enter no: 100
do you want to enter another? no// with this statement the program will stop and he needs to diplay this:

your total input : 3

the percentage Failed is: 0%
the percentage D is: 66.67%
the percentage C is: 0%
the percentage B is: 0%
the percentage A is: 0%
the percentage Exellent is: 33.33%

how can i make the total of that three inputs into code,

and how can i get the code of that percentage of A,B,C,D,Excellent and failed

this is what I’ve got so far

#inlude <iostream.h>
#include<string.h>
#include <conio.h>
#include <stdio.h>

class Grade

{

Grade () {};
~Grade () {};
void Message();
int Gradefailed ( int F, int Total);
int GradeD ( int D, int Total);
int GradeC ( int C, int Total);
int GradeB ( int B, int Total);
int GradeA ( int C, int Total);
int GradeDistinction ( int Distinction, int Total);
};

void Message();
{
cout <<"enter grade:\n";
cin<< score;
cout <<"Do you want to enter another:";
cin >> answer;
}
int Gradefailed ( int F, int Total);
{
return (F/Total)*100;
}
int GradeD ( int D, int Total);
{
return (D/Total)*100;
}
int GradeC ( int C, int Total);
int GradeB ( int B, int Total);
int GradeA ( int C, int Total);
int GradeDistinction ( int Distinction, int Total);

same as the other foramat as above

}

int main ()

{

clrscr();
Grade *p = new Grade;
int score;
char answer[5]="yes"

while (stricmp (answer, "no")!=0)

{
p->Message ();

{

while mark (==0)
{
cout << "\n\nAnswer can’t be zero\n";
}
cout << "\nDo you want to solve another equation ? ( Yes ) or ( No )" << endl;
cin >> answer;
cout <<”please enter grade:”;
cin >> grade;
while(( stircmp( answer, "yes" ) != 0 ) && ( stricmp( answer, "no" ) != 0 ))
{
cout << "Please only answer by \"yes\" or \"no\"!";
cin >> answer;
}
getch ();
}
delete p;
}

how can make this kind of aoutput

your total input(s) is/are : 3

the percentage Failed is: 0%
the percentage D is: 66.67%
the percentage C is: 0%
the percentage B is: 0%
the percentage A is: 0%
the percentage Exellent is: 33.33%

thanks in advance!!!!!!!!!
Hi.... here i have the solution written in c.... Is it required one...?

Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5. int n[100],j,i=0;
  6. float f=0,d=0,c=0,b=0,a=0,e=0;
  7. char ch='Y';
  8. while(ch!='N')
  9. {
  10. printf("Enter the number:\n");
  11. scanf("%d",&n[i]);
  12. i++;
  13. printf("Do you want to enter another?  Y/N\n");
  14. scanf("%s",&ch);
  15. }
  16.  
  17. printf("Your total input : %d\n",i);
  18.  
  19. for(j=0; j<i; j++)
  20. {
  21. if(n[j]<50)
  22. f++;
  23. else if(n[j]>=50 && n[j]<=59)
  24. d++;
  25. else if(n[j]>=60 && n[j]<=69)
  26. c++;
  27. else if(n[j]>=70 && n[j]<=79)
  28. b++;
  29. else if(n[j]>=80 && n[j]<=89)
  30. a++;
  31. else if(n[j]>=90 && n[j]<=100)
  32. e++;
  33. }
  34.  
  35. printf("the percentage Failed is: %f\n",(f*100)/i);
  36. printf("the percentage D is: %f\n",(d*100)/i);
  37. printf("the percentage C is: %f\n",(c*100)/i);
  38. printf("the percentage B is: %f\n",(b*100)/i);
  39. printf("the percentage A is: %f\n",(a*100)/i);
  40. printf("the percentage Exellent is: %f\n",(e*100)/i);
  41. return 0;
  42. }
Dec 13 '06 #2
angelcd
15
Hi.... here i have the solution written in c.... Is it required one...?

Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5. int n[100],j,i=0;
  6. float f=0,d=0,c=0,b=0,a=0,e=0;
  7. char ch='Y';
  8. while(ch!='N')
  9. {
  10. printf("Enter the number:\n");
  11. scanf("%d",&n[i]);
  12. i++;
  13. printf("Do you want to enter another?  Y/N\n");
  14. scanf("%s",&ch);
  15. }
  16.  
  17. printf("Your total input : %d\n",i);
  18.  
  19. for(j=0; j<i; j++)
  20. {
  21. if(n[j]<50)
  22. f++;
  23. else if(n[j]>=50 && n[j]<=59)
  24. d++;
  25. else if(n[j]>=60 && n[j]<=69)
  26. c++;
  27. else if(n[j]>=70 && n[j]<=79)
  28. b++;
  29. else if(n[j]>=80 && n[j]<=89)
  30. a++;
  31. else if(n[j]>=90 && n[j]<=100)
  32. e++;
  33. }
  34.  
  35. printf("the percentage Failed is: %f\n",(f*100)/i);
  36. printf("the percentage D is: %f\n",(d*100)/i);
  37. printf("the percentage C is: %f\n",(c*100)/i);
  38. printf("the percentage B is: %f\n",(b*100)/i);
  39. printf("the percentage A is: %f\n",(a*100)/i);
  40. printf("the percentage Exellent is: %f\n",(e*100)/i);
  41. return 0;
  42. }
hi there,

thanks alot, i really appreciate it, and I,m so glad that you'll helping me
do you know any solution in C++,

thanks,
mike
Dec 13 '06 #3
DeMan
1,806 1GB
c code should work in c++ without too much tweaking....
Dec 14 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: C.E.O. Gargantua | last post by:
http://blog.seattlepi.nwsource.com/microsoft/ Featured in the blog: Grading Bill Gates Charles Cooper, CNet News.com executive editor, assesses the performance of Bill Gates as the company's...
7
by: rockwell | last post by:
Hi groups i want to write a program ro numerically integrate an equation using the rectangle method,i know a little bit about the rectangle method but never used it abd dont quite really know how...
26
by: Albert | last post by:
how do i write a program that outputs its input if its input is more than 80 characters?
3
by: Akinyemi | last post by:
I am writing a Visual Basic program for calculating students scores, and also grading the highest 3 scores as "First" , "Second" and "Third" respectively. I have been able to get the program to...
4
by: hjc | last post by:
i am trying to created a program that will write a grading program for a class with the following policies there are 2 quizzes each graded on the basis of 10 points there is 1 midterm and 1...
17
by: Brian Blais | last post by:
Hello, I have a couple of classes where I teach introductory programming using Python. What I would love to have is for the students to go through a lot of very small programs, to learn the...
11
by: cazconv2007 | last post by:
hi i have homework due tomorrow been trying to do java homework all week and nothings happening really starting to stress out i dont understand what the program is meant to do or how to use three...
9
by: Grimmjow04 | last post by:
first of all, im a beginner with this thing.. turbo C,, my prof gave us a homework: we must do a grading system consist of: format>>> Grading System Enter your name:
1
by: gator6688 | last post by:
I have to write a program that allows the user to enter the information for up to 20 students. The info then has to be displayed and written to a file. After I enter the first students info and hit...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.