# C++ Exercise



## quiet1der (Oct 17, 2009)

Task for Exercise 1
Suppose that a float variable called score contains the overall points earned for this course. The following set of cascaded if-then-else pseudocode statements determines your final grade.

If (score >= 85) then
Set grade = ‘A’ Else 
If (score >= 75) then
Set grade = ‘B’
Else
If (score >= 65) then
Set grade = ‘C’
Else
If (score >= 55) then
Set grade = ‘D’
Else
Set grade = ‘F’
End if // score >= 55
End if // score >= 65
End if // score >= 75
End if // score >= 85 


Your assignment is to convert this pseudocode into a C++ program. Use the following template for your program and remember to maintain all the blank lines, spaces, and general alignment. Then replace the areas that have been highlighted in yellow with your code. Do not change any of the other code.

Code Template for Exercise 1
/****************************************************/
/* File: name of your file with the source code */
/* */
/* Created by: give your name */
/* Date: give the date */
/* */
/* Program to determine course grade */
/* */
/* Inputs: (keyboard) */
/* 1. Float - weighted total points (<= 100) */
/* */
/* Output: */
/* letter grade using pseudocode grading policy */
/* */
/* Algorithm: Comparisons using if-then-else */
/* */
/****************************************************/
#include <iostream>

using namespace std ;

int main() 
{

Declare score and grade appropriately as variables. 

// read in total score 

cout << endl ;
cout << "Enter total score (float, must be <= 100) : " ; 
cin >> score ; 
Write C++ if-then-else statements to determine course grade, 
using the grading policy stated in the pseudocode. 

// display the result 

cout << endl ; 
cout << "Your grade for CMIS 102 is: " << grade << endl ; 

return (0); // terminate with success 
} 

Test Plan for Exercise 1
Test your code with the following numbers: 

85.0, 65.0001, 54.99999, –33.3, 100, 90, 150


----------



## jamiemac2005 (Jul 5, 2007)

Hey, please read the forum rules:



The Rules said:


> * You may not ask for assistance with homework assignments, projects or book reports for school college or university


We will not do this exercise for you. I suggest going here: http://www.cprogramming.com and learning to write C++ so that you actually get something out of your course.

Cheers,
Jamey


----------



## shuuhen (Sep 4, 2004)

As jamiemac2005 stated, we have specific rules about helping with homework. If you do not understand the assignment, I suggest you schedule a meeting with your instructor/TA for the course or attend office hours.

Thread closed. Please review the forum rules.


----------

