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
When subject to an unknown torque, the shear stress in a 2 mm thick rectangular tube of dimension 100 mm x 200 mm was found to b
laila [671]

Answer:

The shear stress will be 80 MPa

Explanation:

Here we have;

τ = (T·r)/J

For rectangular tube, we have;

Average shear stress given as follows;

Where;

\tau_{ave} = \frac{T}{2tA_{m}}

A_m = 100 mm × 200 mm = 20000 mm² = 0.02 m²

t = Thickness of the shaft in question = 2 mm = 0.002 m

T = Applied torque

Therefore, 50 MPa = T/(2×0.002×0.02)

T = 50 MPa × 0.00008 m³ = 4000 N·m

Where the dimension is 50 mm × 250 mm, which is 0.05 m × 0.25 m

Therefore, A_m = 0.05 m × 0.25 m = 0.0125 m².

Therefore, from the following average shear stress formula, we have;

\tau_{ave} = \frac{T}{2tA_{m}}

Plugging in then values, gives;

\tau_{ave} = \frac{4000}{2\times 0.002 \times 0.0125} = 80,000,000 Pa

The shear stress will be 80,000,000 Pa or 80 MPa.

7 0
3 years ago
Develop a chase plan that matches the forecast and compute the total cost of your plan. (Negative amounts should be indicated by
vladimir2022 [97]

Answer:

The answer for the question :

"Develop a chase plan that matches the forecast and compute the total cost of your plan. (Negative amounts should be indicated by a minus sign. Leave no cells blank - be certain to enter "0" wherever required. Omit the "$" sign in your response.)"

is explained in the attachment.

Explanation:

4 0
3 years ago
Ann’s Retail, a women’s clothing store, hires female attendants to assist clients in the store’s dressing rooms. Larry, a male,
mojhsa [17]

Answer:

A bona fide occupational qualification defense

Explanation:

Since the store is for women clothing, the retail may prefer to employ only female to assist the customers.  Under a bona fide occupational qualification defense, an employer is allowed to discriminate if a characteristic is a necessity for the performance of the job and for the business. Therefore, the store has a bona fide occupational qualification defense.

3 0
3 years ago
If a 2 1/8 inch diameter medium carbon steel rod is to be turned between centers to a 2 inch diameter using high speed cutting b
Crank

Answer:

I think 1 31/32

8 0
4 years ago
List in order first three steps to square a board
LenaWriter [7]

Answer:

STEP1 Cut to Rough Length

STEP2 Cut to Rough Width

STEP 3 Face-Jointing

HOPE THAT HELPSSS!!!

5 0
3 years ago
Other questions:
  • What engineers call moment, scientists call
    9·1 answer
  • Liquid flows at steady state at a rate of 2 lb/s through a pump, which operates to raise the elevation of the liquid 100 ft from
    6·1 answer
  • Consider a fully developed laminar flow in a circular pipe. The velocity at R/2 (midway between the wall surface and the centerl
    6·1 answer
  • 12.28 LAB: Output values in a list below a user defined amount - functions Write a program that first gets a list of integers fr
    13·1 answer
  • 1. The area of the given triangle is 25 square units. What is the value of x?<br> X+2
    8·1 answer
  • A car is stopped at an entrance ramp to a freeway; its driver is preparing to merge. At a certain moment while stopped, this dri
    10·1 answer
  • Write what you already know about college majors. What are they? Can you think of any examples? When do you have to pick one? Ca
    10·2 answers
  • I need a thesis statement about Engineers as Leaders.
    11·1 answer
  • What is mechanical engineer​
    14·1 answer
  • ───────────────────────────────
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!