I have to write a c++ program for class on grading and averages

I have to write a C++ program and I have NO clue how to do it!!

Page 1 of 1

7 Replies - 14660 Views - Last Post: 05 December 2008 - 11:58 AM Rate Topic: -----

#1 LauraCB  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 03-December 08

I have to write a c++ program for class on grading and averages

Posted 03 December 2008 - 07:50 AM

I have to design a class grading program in c++ and I dont know where to start can anyone help me!!! I can tell you the requirements and anything you need to know but I NEED HELP asap!!!!!!! This is all I have so far but I dont know if any of it is right because we did some of it in class to write a program that cubes and squares numbers!!

// ********************************************
//*        Program Name: Calculations
//*        Date:         December 3, 2008
//*        Class Name:   Computer Science 1300
//*        Class Number: CRN 25804
//*        Instructor:   Professor Jackson
//*        Programmer:   Laura Butler
//*
//*        Version:      0- Initial Program
//*********************************************
// PREPROCESSOR STATEMENTS
#include <iostream>
#include <string>
using namespace std;
//  DECLARATION SECTION (Nouns)
int average; 
	cout << endl<< "Less than 70 is failing " <<name;
	cout << endl<< "A 70 up to 85 is fair " <<name;
	cout << endl<< "Equal to 86 or greater is excelent " <<name;


string name;
int calculate;
//   MAIN PROGRAM  (Verbs)
int  main()
{

 cout << "Hello, what is your name? ";
 cin >>  name;
 cout << "Tell me your 5 grades ";
// SELECTION SECTION
  while (number != guess)
  {
 cout << endl  << "Please enter a number: ";
 cin >> number;
    if (number < guess)  
  cout << endl << " TOO LOW - try again " << name;
 else if 
    (number > guess)
     cout << endl << " TOO HIGH- try again " << name;
    else
     cout << endl << " YOU GUESSED CORRECTLY " << name;
   }
    square = number * number;
 cube= number * number * number;
 cout << endl << "YOUR NUMBER SQUARED IS: " << square;
 cout << endl << "YOUR NUMBER CUBED IS: " << cube;
    cout << endl;
 
 
 return 0;
}



** Edit ** :code:

Is This A Good Question/Topic? 0
  • +

Replies To: I have to write a c++ program for class on grading and averages

#2 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3120
  • View blog
  • Posts: 19,163
  • Joined: 14-September 07

Re: I have to write a c++ program for class on grading and averages

Posted 03 December 2008 - 07:57 AM

This code has nothing to do with grading really. Requirements would be helpful.

[Also, multiple threads to the same topic is generally frowned upon.]

This post has been edited by KYA: 03 December 2008 - 07:59 AM

Was This Post Helpful? 0
  • +
  • -

#3 LauraCB  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 03-December 08

Re: I have to write a c++ program for class on grading and averages

Posted 04 December 2008 - 06:09 AM

View PostKYA, on 3 Dec, 2008 - 06:57 AM, said:

This code has nothing to do with grading really. Requirements would be helpful.

[Also, multiple threads to the same topic is generally frowned upon.]


well it would help if i knew ANYTHING at all about coding but I really dont my teacher hasnt helped me at all and I really dont know where to start!!!
Was This Post Helpful? 0
  • +
  • -

#4 janotte  Icon User is offline

  • code > sword
  • member icon

Reputation: 990
  • View blog
  • Posts: 5,141
  • Joined: 28-September 06

Re: I have to write a c++ program for class on grading and averages

Posted 04 December 2008 - 06:45 AM

View PostLauraCB, on 4 Dec, 2008 - 05:09 AM, said:

well it would help if i knew ANYTHING at all about coding but I really dont my teacher hasnt helped me at all and I really dont know where to start!!!


Well it looks like you may have signed up for a course that you shouldn't have.

At this point you are not applying any rational problem solving to the problem in front of you. This is the key and fundamental skill that anyone who wants to construct a computer program must bring to bear on the task. Applied rational thought is what it is all about in programming, everything else is 'gravy'.

You are also having difficulty with reading, comprehending and following instructions. See Posting Rule 3 and :code:

My diagnosis at a distance is that both of the above are caused by some degree of panic. Again if you are panicking at this early stage then the stuff that's going to come down the pipe at you will be a true torment. You really need to consider your class selections if it's not too late.

On the issue at hand:
I can tell you that nothing between // SELECTION SECTION and return 0; has anything to do with grading so doesn't belong in this program.

My guess is that you have been asked to write a program that:
1 - has the student enter their name and 5 grades
2 - calculates the average of those 5 grades
3 - displays one of the provided outputs to the student based on what the calculated average is.

Am I guessing right?
If your answer is "I don't know" give up now.

If my guess is right then write some code to collect the name and grades from the student.
HINT: The professor has written most of it for you.

Get out your textbook/handouts and do some reading or go here:
http://www.cplusplus.com/doc/tutorial/
and do some reading.

Once you have written some code you think does step one we may be able to help you fix it and move you on.
But we aren't going to write your code for you because that would be cheating the others in your class of what they earn by doing the work.

Sorry if all the above seems too harsh but better to face facts early than waste your time. It's a tough world out here with the grown-ups.

This post has been edited by janotte: 04 December 2008 - 06:48 AM

Was This Post Helpful? 0
  • +
  • -

#5 Bench  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 857
  • View blog
  • Posts: 2,343
  • Joined: 20-August 07

Re: I have to write a c++ program for class on grading and averages

Posted 04 December 2008 - 11:49 AM

View PostLauraCB, on 4 Dec, 2008 - 01:09 PM, said:

well it would help if i knew ANYTHING at all about coding but I really dont my teacher hasnt helped me at all and I really dont know where to start!!!

You don't need to know a great deal about coding - being able to digest and fully understand a problem is the real skill which you need to learn; after that the programming bit is much easier, because in analysing the problem, you'll have broken it up into very small, simple chunks which you should easily be able to relate to something a computer can do.
Was This Post Helpful? 0
  • +
  • -

#6 LauraCB  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 03-December 08

Re: I have to write a c++ program for class on grading and averages

Posted 05 December 2008 - 07:14 AM

View Postjanotte, on 4 Dec, 2008 - 05:45 AM, said:

View PostLauraCB, on 4 Dec, 2008 - 05:09 AM, said:

well it would help if i knew ANYTHING at all about coding but I really dont my teacher hasnt helped me at all and I really dont know where to start!!!


Well it looks like you may have signed up for a course that you shouldn't have.

At this point you are not applying any rational problem solving to the problem in front of you. This is the key and fundamental skill that anyone who wants to construct a computer program must bring to bear on the task. Applied rational thought is what it is all about in programming, everything else is 'gravy'.

You are also having difficulty with reading, comprehending and following instructions. See Posting Rule 3 and :code:

My diagnosis at a distance is that both of the above are caused by some degree of panic. Again if you are panicking at this early stage then the stuff that's going to come down the pipe at you will be a true torment. You really need to consider your class selections if it's not too late.

On the issue at hand:
I can tell you that nothing between // SELECTION SECTION and return 0; has anything to do with grading so doesn't belong in this program.

My guess is that you have been asked to write a program that:
1 - has the student enter their name and 5 grades
2 - calculates the average of those 5 grades
3 - displays one of the provided outputs to the student based on what the calculated average is.

Am I guessing right?
If your answer is "I don't know" give up now.

If my guess is right then write some code to collect the name and grades from the student.
HINT: The professor has written most of it for you.

Get out your textbook/handouts and do some reading or go here:
http://www.cplusplus.com/doc/tutorial/
and do some reading.

Once you have written some code you think does step one we may be able to help you fix it and move you on.
But we aren't going to write your code for you because that would be cheating the others in your class of what they earn by doing the work.

Sorry if all the above seems too harsh but better to face facts early than waste your time. It's a tough world out here with the grown-ups.









 we have been working on other programs that is why the last one didnt look anything like the requirements I was trying to go through it and decide what to keep and what to change but I started over and this is all I have now and I am going to check out that website you gave me...I am Not by anymeans trying to get you to do this for me because I could never allow my self to turn it in my concious you get to me too bad!!! all I am asking for is someone to walk me through this because I have never done this before and it hasnt clicked for me yet! the class was something I have to do for my major and if I knew it was going to require me to do this I dont think I would have taken it because I am NO good when it comes to computers all I know is how to turn in on and off lol!! but thank you for your time and dont give up on me now im not a hopeless cause I promise!

// ********************************************
//*		Program Name: Calculations
//*		Date:		 December 3, 2008
//*		Class Name:   Computer Science 1300
//*		Class Number: CRN 25804
//*		Instructor:   Professor Jackson
//*		Programmer:   Laura Butler
//*
//*		Version:	  0- Initial Program
//*********************************************
// PREPROCESSOR STATEMENTS
#include <iostream>
#include <string>
using namespace std;
 
//  DECLARATION SECTION 
int grade;
float scale;
string average;

 cout;<< "What is your grade? ";
  cin;<< "My grade is ";
 cout;<< endl; << endl;
 
//   MAIN PROGRAM  
int  main()
{
 if(grade < 70) 
{ cout <<"You are failing "; 
 }
else if(grade >= 70)
{
 cout;<< "You are fair ";
}
while (grade > 85) 
{
 cout;<< "You are Excellent ";
}

cout;<< endl  << endl;
 
 return 0;
}




Was This Post Helpful? 0
  • +
  • -

#7 JdMasterJoe  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 06-November 08

Re: I have to write a c++ program for class on grading and averages

Posted 05 December 2008 - 07:48 AM

I'm bored. If you have AIM message me, I can help you. SN: pwnedbyJoe
Was This Post Helpful? 0
  • +
  • -

#8 Bench  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 857
  • View blog
  • Posts: 2,343
  • Joined: 20-August 07

Re: I have to write a c++ program for class on grading and averages

Posted 05 December 2008 - 11:58 AM

View PostLauraCB, on 5 Dec, 2008 - 02:14 PM, said:

 cout;<< "What is your grade? ";
  cin;<< "My grade is ";
 cout;<< endl; << endl;
 
//   MAIN PROGRAM  
int  main()
{
 

(Other quotes cut out)

If you tried compiling that, you probably ran into alot of errors (It helps if you post those aswell)

Try to understand what each bit of your program means to your compiler. computer programs are just lots of simple instructions (known as statements) put together. A semicolon ; signals the end of an instruction. a bit like an english language 'full stop' (or 'period' if you're from the US) which signals the end of a sentence.

statements/instructions are made up of all sorts of different things - Operators, like <<, names, like cout and values, like "What is your grade?". Putting them together in a logical way tells the computer to do things

cout is the name of the standard output (in your case, probably the console/command window)
<< is sometimes called the "put to" operator because its used for putting some value to some output mechanism, such as cout. (its got other names and uses too, but "put to" is probably the most useful for you)
"What is your grade?" is like a plain text value (A bit more complicated in reality, but you can treat it like that).

When you put them all together as cout << "What is your grade?"; You've just told the computer
.."What is your grade?"..
.. is 'put to' ..
.. cout.
-Reading instructions in reverse order often helps in C++


You can't simply put statements such as cout << "What is your grade? "; outside of a function. Try putting those 3 lines inside your main() function instead. ie, between the two curvy brackets which show where the function starts and ends
int main()
{
    //Statements and all other instructions in here!
} 
the main() function is named as such since its the 'main' chunk of your program. The computer will always look to the first instruction within main() to work out where the program starts.


Have a look at whatever book or reading material you've been given for C++. check how to use cin. cin is almost the 'opposite' of cout - instead of putting output, it 'gets input'.
- Getting input needs you to record the input somewhere (in a variable), so the name of the variable you're going to store the input to needs to be used as part of the input instruction.
>> the 'get from' operator is needed here instead (two arrows pointing the opposite way to the ones used by cout)
int my_number;
cin >> my_number; 

Again, read it backwards to understand it
.. my_number ..
.. gets input from ..
.. cin ..


If you haven't tried compiling or running anything you've written, i strongly suggest you try it - you'll learn alot by just toying around and seeing what all the different compiler errors mean. you'll probably find you quickly get familiar with some of them - the compiler is there to throw errors to help you write your program correctly - but understanding them is a skill which you can only learn through trial and error

This post has been edited by Bench: 05 December 2008 - 12:00 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1