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
The fractional_part function divides the numerator by the denominator, and returns just the fractional part.
Alinara [238K]

Answer:

a. True

Explanation:

The fractional_part function divides the numerator by the denominator, and in turn returns just the fractional part, which is usually a number between 0 and 1.

When the denominator is 0, it produces an error result, instead of attempting the division, the function can be programmed to return "Math Error: cannot be divided by zero", as shown in the following Python code;

def fractional_part(numerator, denominator):

if denominator == 0:

 return "Math Error: cannot be divided by zero"

return (numerator % denominator)/denominator

6 0
2 years ago
Which of these causes the most collisions?
Vikentia [17]

Answer:

The answer is "failing to keep a proper lookout".

Explanation:

The theory of collision, especially concerning gas were used to forecast the chemical reaction. It is based on the idea which atoms or molecules of interacting organisms should be mixed or collided. In this question the key cause of collision would be a proper viewpoint is not established, that's why other given choices were wrong.

4 0
3 years ago
g The reciprocal Fibonacci constant ψ is defined by the infinite sum: ψ=∑n=1 [infinity] 1 Fn Where Fn are the Fibonacci numbers
timama [110]

Answer:

see explaination

Explanation:

MATLAB script:

% MATLAB script that calculates reciprocal Fibonacci constant Ψ

% Initial Values

a0 = 1;

a1 = 1;

% Looping variable

i = 2;

% Reading n value from user

n = input(' Enter n value: ');

% Initializing sum

sum = (1/a0) + (1/a1);

% Loop till i reaches n value

while i <= n

% Finding term in Fibnocii series

a2 = a0 + a1;

% Accumulating Sum

sum = sum + (1/a2);

% Updating previous terms

a0 = a1;

a1 = a2;

% Incrementing loop variable

i = i + 1;

endwhile

% Printing result

printf("\n Reciprocol Fibnocii Constant: %f \n", sum);

See attachment for sample output

5 0
3 years ago
Given that Jamie worked 50 hours (Hours = 50) last week and earns $10.00 an hour (Rate = 10), how much did Jamie earn last week,
quester [9]

Answer:

<em>Jamie earned (Total pay)  $500.</em>

<em></em>

Explanation:

We are given the following code:

<em>If (Rate >=10) OR (Hours <=40) Then </em>

<em>    TotalPay = Hours * Rate </em>

<em>Else </em>

<em>    TotalPay = (Hours * Rate)+(Hours–40)*Rate*1.5 </em>

<em>End If</em>

<em />

Let us understand the code line by line:

The first line contains an if statement with 2 conditions:

i.e. 1st condition:

The rate is greater than or equal to 10

2nd condition:

Number of hours are lesser than or equal to 40.

There is OR between the two condition i.e. the statement next to if() statement will get executed if any one of them becomes true and else part will not be executed.

The next statement is:

TotalPay = Hours * Rate

It calculates the pay if any of the two conditions written earlier becomes true.

Next statement is else statement:

It will get executed given that the above if() statement becomes false.

Now, we are given that Jamie worked 50 hours last week and earns $10.00 an hour:

i.e.

Hours = 50

Rate = 10

Now, let get to the code execution.

The first condition is true i.e. Rate >= 10 (because Rate is 10 here)

So, the following statement will be used to calculate the Total pay:

TotalPay = Hours * Rate

and else part will not be executed.

TotalPay = 50 * 10  =<em> $500  </em>

<em></em>

<em>Jamie earned (Total pay)  $500.</em>

3 0
2 years ago
PLEASE HELP ANSWER THIS only if you know BOTH ANSWERS!
Leya [2.2K]

Answer:

For the first question I think it is chains

The second question.

The woman is suspicious at hotel doors have numbers so how could he have been confused

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • Many malware attacks are ____ attacks, which involve more than one type of malware and/or more than one type of transmission met
    6·1 answer
  • What aspect of the internet makes it fault-tolerant?
    6·1 answer
  • What is the slide sorter view used for?
    11·1 answer
  • You type. The word "weather" when you ment "whether" when will the writer or word flag this as a misspelling or a grammar proble
    13·1 answer
  • Fedora operating system
    9·1 answer
  • Can someone help me with the 2.4 code practice question 2 on Edhesive???
    6·1 answer
  • For almost all networks today, including the internet, the communication protocol used is called ____.
    15·1 answer
  • How to cancel branly subscription??​
    8·1 answer
  • What is human data,
    8·1 answer
  • Which two features offered by SharePoint
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!