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
What is the definition of insert view and why do we use it
maw [93]

Answer:

its a view point for auto cad

Explanation:

from my knowlege in IED we learned about it as a way of sing how an object would look in inventor or auto CAD

4 0
3 years ago
A 400-m^3 storage tank is being constructed to hold LNG, liquefied natural gas, which may be assumed to be essentially pure meth
GuDViN [60]

Answer:

mass of LNG: 129501.3388 kg

quality: 0.005048662

Explanation:

Volume occupied by liquid:

400 m^3*0.9 = 360 m^3

Volume occupied by vapor

400 m^3*0.1 = 40 m^3  

A figured with thermodynamic properties of saturated methane is attached. Notice that a liquid-gas mixture is present

For liquid phase specific volume (vf) at 150 K is 0.002794 m^3/kg and for vapor phase specific volume (vg) is 0.06118 m^3/kg

From specific volume definition:

vf = liquid volume/liquid mass

liquid mass = liquid volume/vf

liquid mass = 360 m^3/0.002794 m^3/kg

liquid mass = 128847.5304 kg

vg = vapor volume/vapor mass

vapor mass = liquid volume/vg

vapor mass = 40 m^3/0.06118 m^3/kg

vapor mass = 653.8084341 kg

total mass = 128847.5304 kg + 653.8084341 kg = 129501.3388 kg

Quality is defined as the ratio between vapor mass and total mass

quality =  653.8084341 kg/129501.3388 kg = 0.005048662

4 0
3 years ago
It is the same as force. b. Stress that is created by plate collision is the same everywhere and reflects the total force produc
Vlada [557]

Answer:

Explanation:

ωωωωωωωωω

7 0
3 years ago
What is the composition, in atom percent, of an alloy that consists of 4.5 wt% Pb and 95.5 wt% Sn?
jeka57 [31]

Answer: Option A is correct -- 2.6 at% Pb and 97.4 at% Sn.

Explanation:

Option A is the only correct option -- 2.6 at% Pb and 97.4 at% Sn. While option B, which is 7.6 at% Pb and 92.4 at% Sn. and option C, which is 97.4 at% Pb and 2.6 at% Sn. and option D, which is 92.4 at% Pb and 7.6 at% Sn. are wrong.

6 0
3 years ago
Write a function named "read_prices" that takes one parameter that is a list of ticker symbols that your company owns in their p
ohaa [14]

Answer:

import pandas pd

def read_prices(tickers):

price_dict = {}

# Read ingthe ticker data for all the tickers

for ticker in tickers:

# Read data for one ticker using pandas.read_csv  

# We assume no column names in csv file

ticker_data = pd.read_csv("./" + ticker + ".csv", names=['date', 'price', 'volume'])

# ticker_data is now a panda data frame

# Creating dictionary

# for the ticker

price_dict[ticker] = {}

for i in range(len(ticker_data)):

# Use pandas.iloc  to access data

date = ticker_data.iloc[i]['date']

price = ticker_data.iloc[i]['price']

price_dict[ticker][date] = price

return price_dict  

7 0
3 years ago
Other questions:
  • Given the following data, plot the stress-strain curves for the two unknown materials on the same set of stress-strain axes. Den
    9·1 answer
  • I need help!!! Because this is due
    14·2 answers
  • Technician A says that 18 gauge AWG wire can carry more current flow that 12 gauge AWG wire. Technician B says that metric wire
    9·1 answer
  • a triangle is defined by the three vertices. write the following functions of the triangle class assume that the point class has
    7·1 answer
  • List five things the welding symbol will tell the welder about the weld that is to be made.​
    13·1 answer
  • Yall pls help me out
    7·1 answer
  • Excessive looseness in steering and suspension components can cause _____
    13·1 answer
  • Special certification is required for technicians who handle which of the following systems?
    10·1 answer
  • There are some sections of the SDS that are not mandatory.
    11·1 answer
  • The most important reason to wear your seat belt is to protect you from:
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!