logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

how to output the total number of candidates accepted and the percent

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

#include <iostream>

#include <iomanip>

#include <string>

using namespace std;

 

int main()

{

/*******************************************************************************

* CONSTANTS

* -----------------------------------------------------------------------

* OUTPUT - USED FOR CLASS HEADING

* -----------------------------------------------------------------------

* PROGRAMMER        : Programmer's Name

* CLASS             : Student's Course

* SECTION           : Class Days and Times

* ASSIGNMENT_NUM    : Assignment Number (specific to this assignment)

* ASSIGNMENT_NAME   : Title of the Assignment

******************************************************************************/

 

const char PROGRAMMER[]               = "Stephanie Tucker";

const char CLASS[]                    = "CS1A";

const char SECTION[]                  = "MW: 8-am";

const int  ASSIGNMENT_NUM             = 6;

const char ASSIGNMENT_NAME[]          = "Boolean Expressions";

 

// Constants

const int OUTPUT = 15;

 

// Variables

char   candidateInfo;

char   sexInfo;                // IN & OUT   - the candidate's sex

int    heightInfo;             // IN & OUT   - the candidate's height information

int    weightInfo;             // IN & OUT   - the candidate's weight information

char   acceptableHeight;       // IN & OUT   - an acceptable height for the candidate

int    totalCandidatesApplied; // IN & OUT   - the total number of candidate's accepted

int    acceptanceNum;          // IN & OUT   - the number of candidate's accepted

long   acceptanceAvg;          // IN & OUT   - the percent average of candidate's accepted

 

cout << "**********************************************************\n";

cout << "*  PROGRAMMED BY : " << PROGRAMMER     << endl;

cout << "*  CLASS         : " << CLASS          << endl;

cout << "*  SECTION       : " << SECTION        << endl;

cout << "*  ASSIGNMENT "      << ASSIGNMENT_NUM << "  : " << ASSIGNMENT_NAME

                                                          << endl;

cout << "**********************************************************\n\n";

 

 

totalCandidatesApplied = 0;

acceptanceNum          = 0;

 

cout << left << setw(OUTPUT) << "Please enter the candidate's infromation (enter 'X' to exit). ";

//cin.get(candidateInfo);

//cin.ignore(1000, '\n');

 

cout << left << setw(OUTPUT) << "\nSex: ";

cin>>sexInfo;

cin.ignore(1000, '\n');

while(sexInfo != 'x' && sexInfo != 'X')

{

cout << left << setw(OUTPUT) << "Height: ";

cin  >> heightInfo;

cin.ignore(1000, '\n');

 

  cout << left << setw(OUTPUT) << "Weight: ";

cin  >> weightInfo;

cin.ignore(1000, '\n');

cout<<"\n"<<endl;

 

totalCandidatesApplied = totalCandidatesApplied + 1;

 

  if(sexInfo == 'm' || sexInfo == 'M')

  {

    if(heightInfo >= 65 && heightInfo <=80)

    {

      if(weightInfo >= 130 && weightInfo <=250)

      {

        cout << "This candidate has been ACCEPTED! "<<endl;

        acceptanceNum ++;

      }

      else{cout<<"This candidate has been rejected based on the WEIGHT requirement."<<endl;}

    }

    else{cout<<"This candidate has been rejected based on the HEIGHT requirement."<<endl;}

  }

  if(sexInfo == 'F' || sexInfo == 'f')

  {

    if(heightInfo >= 62 && heightInfo <=75)

    {

      if(weightInfo >= 110 && weightInfo <=185)

      {

        cout << "This candidate has been ACCEPTED! "<<endl;

        acceptanceNum ++;

      }

      else{cout<<"This candidate has been rejected based on the WEIGHT requirement."<<endl;}

    }

    else{cout<<"This candidate has been rejected based on the HEIGHT requirement."<<endl;}

  }

 

 

cout<<"\n\n"<<endl;

cout << left << setw(OUTPUT) << "Please enter the candidate's infromation (enter 'X' to exit). ";

//cin.get(candidateInfo);

//cin.ignore(1000, '\n');

 

cout << left << setw(OUTPUT) << "\nSex: ";

cin  >>sexInfo;

cin.ignore(1000, '\n');

}

 

  return 0;

}

 

 

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Atharva PatilComputer science

935 Answers

Hire Me
expert
Chrisantus MakokhaComputer science

717 Answers

Hire Me
expert
AyooluwaEducation

741 Answers

Hire Me
expert
RIZWANAMathematics

620 Answers

Hire Me

Get Free Quote!

432 Experts Online