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
11111nata11111 [884]
3 years ago
7

Your program must output each student’s name in the form: last name followed by a comma, followed by a space, followed by the fi

rst name; the name must be left justified. Moreover, other than declaring the variables and opening the input and output files, the function main should only be a collection of function calls.
Engineering
1 answer:
Reptile [31]3 years ago
3 0

Answer:

#include <iostream>

#include <string>

#include <fstream>

using namespace std;

char getStudentGrade(int testScore);

//Declare constant max students in file 10

const int maxStudents = 10;

struct StudentType

{

  string studentFName;

  string studentLName;

  int testScore;

  char grade;

};

void readStudentData(StudentType students[]){

  int i = 0;

 

  ifstream infile;

  infile.open("inputStudentData.txt");

 

 

  while (!infile.eof())

  {

   infile >> students[i].studentFName;

   infile >> students[i].studentLName;

   infile >> students[i].testScore;

   students[i].grade = getStudentGrade(students[i].testScore);

      i++;

  }

}

char getStudentGrade(int testScore){

  char grade;

  if(testScore >= 80) {

      grade = 'A';      

  }

  else if(testScore >= 60) {

      grade = 'B';

  }

  else if(testScore >= 50) {

      grade = 'C';  

  }

  else if(testScore >= 40) {

      grade = 'D';      

  }

  else {

      grade = 'F';  

  }

  return grade;

}

int main()

{

 

  StudentType students[10];

 

  readStudentData(students);

 

  for(int i=0;i<maxStudents;i++) {

      students[i].grade = getStudentGrade(students[i].testScore);

  }

 

  for(int i=0; i<maxStudents; i++){    

      cout << students[i].studentLName <<", " << students[i].studentFName << " " << students[i].grade << endl;

  }

  ofstream outputFile;

  outputFile.open ("outputStudentData.txt");

 

  for(int i=0; i<maxStudents; i++){    

      outputFile << students[i].studentLName <<", " << students[i].studentFName << " " << students[i].grade << endl;

  }

  outputFile.close();

  return 0;

}

You might be interested in
Water vapor at 6 MPa, 600 degrees C enters a turbine operating at steady state and expands to 10kPa. The mass flow rate is 2 kg/
kirill115 [55]

Answer:

Explanation:

Obtain the following properties at 6MPa and 600°C from the table "Superheated water".

h_1=3658.8KL/Kg\\s_1=7.1693kJ/kg.k

Obtain the following properties at 10kPa from the table "saturated water"

h_{f2}=191.81KJ/Kg.K\\h_{fg2}=2392.1KJ/Kg\\s_{f2}=0.6492KJ/Kg.K\\s_{fg2}=7.4996KJ/Kg.K

Calculate the enthalpy at exit of the turbine using the energy balance equation.

\frac{dE}{dt}=Q-W+m(h_1-h_2)

Since, the process is isentropic process Q=0

0=0-W+m(h_1-h_2)\\h_2=h_1-\frac{W}{m}\\\\h_2=3658.8-\frac{2626}{2}\\\\=2345.8kJ/kg

Use the isentropic relations:

s_1=s_{2s}\\s_1=s_{f2}+x_{2s}s_{fg2}\\7.1693=6492+x_{2s}(7.4996)\\x_{2s}=87

Calculate the enthalpy at isentropic state 2s.

h_{2s}=h_{f2}+x_{2s}.h_{fg2}\\=191.81+0.87(2392.1)\\=2272.937kJ/kg

a.)

Calculate the isentropic turbine efficiency.

\eta_{turbine}=\frac{h_1-h_2}{h_1-h_{2s}}\\\\=\frac{3658.8-2345.8}{3658.8-2272.937}=0.947=94.7%

b.)

Find the quality of the water at state 2

since h_f at 10KPa <h_2<h_g at 10KPa

Therefore, state 2 is in two-phase region.

h_2=h_{f2}+x_2(h_{fg2})\\2345.8=191.81+x_2(2392.1)\\x_2=0.9

Calculate the entropy at state 2.

s_2=s_{f2}+x_2.s_{fg2}\\=0.6492+0.9(7.4996)\\=7.398kJ/Kg.K

Calculate the rate of entropy production.

S=\frac{Q}{T}+m(s_2-s_1)

since, Q = 0

S=m(s_2-s_1)\\=2\frac{kg}{s}(7.398-7.1693)kJ/kg\\=0.4574kW/k

6 0
3 years ago
In software engineering how do you apply design for change?
Pavlova-9 [17]

Answer:

it is reducely very iloretable chance for a software engineer to give an end to this question

7 0
3 years ago
Sometimes, steel studs may not be used on outside walls because they are?
Helen [10]

Answer:

We can describe 15×-10 as an expression. we would describe 6×-2< 35 as an...

Explanation:

We can describe 15×-10 as an expression. we would describe 6×-2< 35 as an...

6 0
3 years ago
Suppose the following two events occur at the same time: the Chicago Cubs win the World Series, and the workers who make Cubs me
Annette [7]

Answer:

the answer would be decrease decrease

3 0
3 years ago
Express (118)10 and (-49)10 in 8-bit binary one’s complement form and then add the numbers. What would be the representation (-0
stealth61 [152]

Answer:

118_{10}= 0110111 2) -49_{10}=110001_{2} 3) 0_{10}=0:16 \Rightarrow 0_{10}=0_{16}

Explanation:

1) Expressing the Division as the summation of the quotient and the remainder

for

118, knowing it is originally a decimal form:

118:2=59  +(0), 59/2 =29 + 1, 29/2=14+1, 14/2=7+0, 7/2=3+1, 3/2=1+1, 1/2=0+1

118_{10}= 0110111

2) -49_{10}

Similarly, we'll start the process with the absolute value of -49 since we want the positive value of it. Then let's start the successive divisions till zero.

|-49|=49

49:2=24+1, 24:2=12+0,12:2=6+0,6:2=3+0,3:2=1+1,1:2=0+1

100011

-49_{10}=110001_{2}

3) (-0)_{10}

The first step on that is dividing by 16, and then dividing their quotient again by 16, so on and adding their remainders. Simply put:

(-0)_{10}=0:16=0 \Rightarrow (0)_{10}=0_{16} \:or\\(0)_{16}=0000000000000000

5 0
3 years ago
Other questions:
  • Superheated steam is stored in a large tank at 6 MPa and 800°C, The steam is exhausted isentropically through a converging-diver
    5·1 answer
  • Most licensed architects are members of which association?
    13·2 answers
  • A steam turbine receives 8 kg/s of steam at 9 MPa, 650 C and 60 m/s (pressure, temperature and velocity). It discharges liquid-v
    7·1 answer
  • An engineer is working with archeologists to create a realistic Roman village in a museum. The plan for a balance in a marketpla
    9·1 answer
  • I need solution for this question ​
    10·1 answer
  • What are the 2 reasons an alignment should be done?
    13·1 answer
  • Users say that the game is interesting to look at but the music gets annoying
    9·1 answer
  • ) A flow is divided into two branches, with the pipe diameter and length the same for each branch. A 1/4-open gate valve is inst
    5·1 answer
  • R-744 refrigerant is bad why
    6·1 answer
  • A coil having a resistance of 10 ohms and an inductance of 4 H is switched across a 20W dc source. Calculate (a) time required b
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!