Homework 7 Solution

1.  The below information is taken directly from the Academic Dean's Homepage describing criteria for the Superintendent's List and the Dean's List.

Superintendent's List. Midshipmen who meet the following criteria will be placed on the Superintendent's List 
SQPR of at least 3.4 with 
no grade of D, F, or I in any course, 
A in Conduct, 
A in Military Performance, and 
A or B in Physical Education and A or B on Physical Readiness Test. 
Dean's List. Midshipmen who meet the following criteria and are not on the Superintendent's     List will be placed on the Dean's List:
SQPR of at least 3.4 with 
no grade of D, F, or I in any course, 
B in Conduct, 
B in Military Performance, and 
C or better in Physical Education and C or better on Physical Readiness Test..

Assume the MIDS database can produce the following record:

(Name   SQPR   flag   conduct   MP   PE   PRT)


Name: last name of midshipman
Sqpr: students quality point ratio
Flag: contains a 1 if midshipman has a D, F, or I in any course. Contains 0 otherwise.
Conduct: holds a character \A` thru `F` (excluding `E`) for conduct grade.
MP: Military performance (same as conduct)
PE: physical education (same as conduct)
PRT: physical readiness test (same as conduct)

Write a program that will query the user to type a record in the format prescribed format and produce exactly one of "Superintendent's List", "Dean's List", and "NQ (not qualified)" based on the criteria described on the Dean's webpage. Here's some examples:


Sample Input

Sample Output

Jones 3.53 0 A B B A

Midshipman Jones: Dean's List

Smith 3.41 0 A A B A

Midshipman Smith: Superintendent's List

Brown 2.6 1 C C D A

Midshipman Brown: NQ (not qualified)


Turn In a copy of your source code and a screen dump for the execution of all three sample inputs.



// KGS
// Homework 7
// This program prints Supt's list, Dean's list or NQ

#include <iostream>
#include <string>
using namespace

int main (){
    string name, what;
    double sqpr;
    bool flag;
    char conduct, mp, pe, prt;

    cout << "This program was written by KGS." << endl;
    cout << "Enter the name, sqpr, flag, and grades for conduct, military"
            << " performance," << endl << "physical education and the PRT" << endl;
    cin >> name >> sqpr >> flag >> conduct >> mp >> pe >> prt;

    // First check that SQPR and flag are okay for either list
††† if
(sqpr >= 3.4 && flag == 0){
        // Now check specific requirements for Supeís / Deanís list
†††††††† if
(conduct=='A' && mp=='A' && (pe=='A' || pe=='B') && (prt=='A' || prt=='B')){
            what = "Superintendent's List";
            if (conduct<='B' && mp<='B' && pe<='C' && prt<='C'){
                what = "Dean's List";
                what = "NQ (not qualified)";
        what = "NQ (not qualified)";

    cout << "Midshipman " << name << "; " << what << endl;

    return 0;