1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ymorist [56]
2 years ago
9

In this lab, you use the flowchart and pseudocode found in the figures below to add code to a partially created C++ program. Whe

n completed, college admissions officers should be able to use the C++ program to determine whether to accept or reject a student, based on his or her test score and class rank.
start input testScore,
classRank if testScore >= 90 then if classRank >= 25 then output "Accept"
else output "Reject" endif else if testScore >= 80
then if classRank >= 50 then output "Accept" else output "Reject" endif
else if testScore >= 70
then if classRank >= 75 then output "Accept"
else output "Reject"
endif else output "Reject"
endif
endif
endif
stop
Study the pseudocode in picture above. Write the interactive input statements to retrieve: A student’s test score (testScore) A student's class rank (classRank) The rest of the program is written for you. Execute the program by clicking "Run Code." Enter 87 for the test score and 60 for the class rank. Execute the program by entering 60 for the test score and 87 for the class rank.
[comment]: <> (3. Write the statements to convert the string representation of a student’s test score and class rank to the integer data type (testScore and classRank, respectively).)
Function: This program determines if a student will be admitted or rejected. Input: Interactive Output: Accept or Reject
*/ #include using namespace std; int main()
{ // Declare variables
// Prompt for and get user input
// Test using admission requirements and print Accept or Reject
if(testScore >= 90)
{ if(classRank >= 25)
{ cout << "Accept" << endl; }
else
cout << "Reject" << endl; }
else { if(testScore >= 80)
{ if(classRank >= 50)
cout << "Accept" << endl;
else cout << "Reject" << endl; }
else { if(testScore >= 70)
{ if(classRank >=75) cout << "Accept" << endl;
else cout << "Reject" << endl; }
else cout << "Reject" << endl; } } } //End of main() function
Computers and Technology
1 answer:
never [62]2 years ago
3 0

Answer:

The equivalent program in C++:

#include<iostream>

#include <sstream>

using namespace std;

int main(){

   string Score, Rank;

   cout<<"Enter student score and class rank: ";

   cin>>Score>>Rank;

   int testScore = 0, classRank = 0;

   stringstream sstream(Score);

   sstream>>testScore;

   

   stringstream tream(Rank);

   tream>>classRank;

   

   if (testScore >= 90){

       if(classRank >=25){cout<<"Accept";}

       else{cout<<"Reject";}

   }

   else if(testScore >= 80){

       if(classRank >=50){cout<<"Accept";}

       else{cout<<"Reject";}

   }

   else if(testScore >= 70){

       if(classRank >=75){cout<<"Accept";}

       else{cout<<"Reject";}

   }

   else{cout<<"Reject";}

   return 0;

}

Explanation:

This declares Score and Rank as string variables

   string Score, Rank;

This prompts the user for score and class rank

   cout<<"Enter student score and class rank: ";

This gets the user input

   cin>>Score>>Rank;

This declarees testScore and classRank as integer; and also initializes them to 0

   int testScore = 0, classRank = 0;

The following converts string Score to integer testScore

<em>    stringstream sstream(Score);</em>

<em>    sstream>>testScore;</em>

The following converts string Rank to integer classRank

   stringstream tream(Rank);

   tream>>classRank;

The following conditions implement the conditions as given in the question.    

If testScore >= 90

<em>    if (testScore >= 90){</em>

If classRank >=25

<em>        if(classRank >=25){cout<<"Accept";}</em>

If otherwise

<em>        else{cout<<"Reject";}</em>

<em>    } ---</em>

If testScore >= 80

<em>    else if(testScore >= 80){</em>

If classRank >=50

<em>        if(classRank >=50){cout<<"Accept";}</em>

If otherwise

<em>        else{cout<<"Reject";}</em>

<em>    }</em>

If testScore >= 70

<em>    else if(testScore >= 70){</em>

If classRank >=75

<em>        if(classRank >=75){cout<<"Accept";}</em>

If otherwise

<em>        else{cout<<"Reject";}</em>

<em>    }</em>

For testScore less than 70

<em>    else{cout<<"Reject";}</em>

<em />

You might be interested in
How do you calculate the total resistance in a series circuit with more than one resistor?
yan [13]
<span>Resistors are said to be connected in series when they are daisy chained together in a single line. The serial circuit of resistors result  has a common current flowing through the resistors.
</span><span>The current that flows through one resistor must also flow through the others.
</span>

The total equivalent resistance, is given as:

<span>Rtotal = R1 + R2 + R3 , where R1 is the resistance of the first resistor, R2 of the second and R3 f the third</span>

4 0
3 years ago
Hat is the purpose of the domain name?
Andreyy89

B because it is true it is a government website because the “ gov “ stands for government.

~ Destiny

3 0
3 years ago
Read 2 more answers
Can a computer evaluate an expression to something between true and false? Can you write an expression to deal with a "maybe" an
Maurinko [17]

Answer:

yes a computer can evaluate expressions depends on the computer for the maybe expression

Explanation:

4 0
3 years ago
Read 2 more answers
Global address list characteristics
Usimov [2.4K]

I DON'T KNOW THE ANSWER SO SORRY

BUT THANKS FOR THE POINTS

5 0
2 years ago
Strobe lights can become more yellow as they age true or false
guajiro [1.7K]
False they can have a yellow setting but the light is always white

6 0
3 years ago
Other questions:
  • Technological _____ is the term used to describe the merging of several technologies into a single device.
    13·1 answer
  • Blogs are typically written by large companies or organizations as a way to express formal, technical, or scholarly information
    5·2 answers
  • Describe three main types of testing and the order in which they are performed.
    9·2 answers
  • Compare and contrast the following network types: Personal Area Network (PAN) Local Area Network (LAN) Metropolitan Area Network
    14·1 answer
  • ____ is another term for document properties.
    12·1 answer
  • ¿Es especial que mi cumpleaños sea el día de San Valentín?<br><br> si o no
    11·2 answers
  • Amazon SWF is restricts you to use a specific programming language when setting up a work flow
    8·1 answer
  • 8.13 LAB: Elements in a range Write a program that first gets a list of integers from input. That list is followed by two more i
    8·1 answer
  • Next, Jamal wants to copy text from a Word document to the slide he just added. He outlines the steps to complete his task. Step
    15·2 answers
  • Which type of internet connection allows for high-speed bi-directional data communication over a hybrid fiber-coaxial (HFC) conn
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!