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
One method that is used to grow nanowires (nanotubes with solid cores) is to initially deposit a small droplet of a liquid catal
7nadin3 [17]

Answer: maximum length of the nanowire is 510 nm

Explanation:

 

From the table of 'Thermo physical properties of selected nonmetallic solids at At T = 1500 K

Thermal conductivity of silicon carbide k = 30 W/m.K

Diameter of silicon carbide nanowire, D = 15 x 10⁻⁹ m  

lets consider the equation for the value of m

m = ( (hP/kAc)^1/2 )  = ( (4h/kD)^1/2 )  

m =  ( ((4 × 10⁵)/(30×15×10⁻⁹ ))^1/2 ) = 942809.04    

now lets find the value of h/mk    

h/mk = 10⁵ / ( 942809.04 × 30) =  0.00353

lets consider the value θ/θb by using the equation

θ/θb = (T - T∞) / (T - T∞)

θ/θb =  (3000 - 8000) / (2400 - 8000)

= 0.893

the temperature distribution at steady-state is expressed as;

θ/θb = [ cosh m(L - x) + ( h/mk) sinh m (L - x)]   / [cosh mL+  (h/mk) sinh mL]

θ/θb = [ cosh m(L - L) + ( h/mk) sinh m (L - L)]   / [cosh mL+  (h/mk) sinh mL]

θ/θb = [ 1 ]  / [cosh mL+  (h/mk) sinh mL]

so we substitute

0.893 =  [ 1 ]  / [cosh (942809.04 × L) +  (0.00353) sinh (942809.04 × L)]

L = 510 × 10⁻⁹m

L = 510 nm

therefore maximum length of the nanowire is 510 nm

4 0
3 years ago
5. One of the major road blocks for direct DC power in residences is the ___. A) generation of DC B) lack of standardization C)
Montano1993 [528]

Answer:

D) quantity of components required for this type of system

Explanation:

Electricity can be transmitted using the alternating and direct currents. The alternating current is one in which the flow of the current diverts at certain time intervals whereas, the direct current is one in which there is a constant one-directional flow of current. The DC is used in batteries and solar panels. Residential areas and business places make use of the AC current.

One of the several reasons why the DC is not used in homes is because unlike the AC it is not easy to build and sustain. Moreso, it has more components compared to the AC. For example, its motor consists of brushes and commutators . The components, example, switches are also large compared to the AC components.

6 0
3 years ago
3 facts about the Tokyo skytree tower aka the tallest tower in the world
UkoKoshka [18]

Answer:

1. Tokyo skytree tower is the tallest tower in the world, measuring 2080 feet. That's almost twice the size of the Eiffel Tower!

2.The process of building the tower began in 2008. The project was completed on 29 February 2012.

3. Pairing form with function, Skytree will serve as a TV and radio broadcast tower.

6 0
3 years ago
Read 2 more answers
The formula for calculating risk considering risk perception is ?​
s2008m [1.1K]

Answer:

risk = probability x loss

Explanation:

3 0
3 years ago
Which option identifies the next step Kristin should take to test the design in the following scenario?
Nadusha1986 [10]
The 2d sketch should be right
4 0
3 years ago
Other questions:
  • What are the challenges posed by strategic information systems, and how should they be addressed?
    10·1 answer
  • What are the optical properties of steel
    12·1 answer
  • A 14 inch diameter pipe is decreased in diameter by 2 inches through a contraction. The pressure entering the contraction is 28
    10·1 answer
  • What is stress corrosion cracking?
    9·1 answer
  • How did humans create a space suit without ever going. How did we know spaces conditions?
    5·2 answers
  • The heat transfer surface area of a fin is equal to the sum of all surfaces of the fin exposed to the surrounding medium, includ
    6·1 answer
  • Suppose there is a mobile application that can run in two modes: Lazy or Eager. In Lazy Mode, the execution time is 3.333 second
    11·1 answer
  • Which type of modeling can create virtual designs that can save clients thousands of dollars?
    9·1 answer
  • What is the moment that the wrench puts on the bolt?
    13·1 answer
  • Determine the maximum height (in inches) that a lift pump can raise water (0.9971 g/ml) from a well at normal atmospheric pressu
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!