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]
4 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]4 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
2x²-6x+10/x-2 x=2<br><br><br>plsssss<br><br><br><br>​
aleksandr82 [10.1K]

Answer:

hope it helps you..

5 0
3 years ago
The 150-lb man sits in the center of the boat, which has a uniform width and a weight per linear foot of 3 lb&gt;ft. Determine t
irina1246 [14]

Answer:

M = 281.25 lb*ft

Explanation:

Given

W<em>man</em> = 150 lb

Weight per linear foot of the boat: q = 3 lb/ft

L = 15.00 m

M<em>max</em> = ?

Initially, we have to calculate the Buoyant Force per linear foot (due to the water exerts a uniform distributed load upward on the bottom of the boat):

∑ Fy = 0  (+↑)     ⇒    q'*L - W - q*L = 0

⇒       q' = (W + q*L) / L

⇒       q' = (150 lb + 3 lb/ft*15 ft) / 15 ft

⇒       q' = 13 lb/ft   (+↑)

The free body diagram of the boat is shown in the pic.

Then, we apply the following equation

q(x) = (13 - 3) = 10   (+↑)

V(x) = ∫q(x) dx = ∫10 dx = 10x   (0 ≤ x ≤ 7.5)

M(x) = ∫10x dx = 5x²  (0 ≤ x ≤ 7.5)

The maximum internal bending moment occurs when x = 7.5 ft

then

M(7.5) = 5(7.5)² = 281.25 lb*ft

8 0
4 years ago
A safety interlock module operates by monitoring the voltage from the
In-s [12.5K]

Answer: its an Ignition coil

8 0
4 years ago
Give two disadvantages of a moving coil Meter
Temka [501]
1.Only suitable for dc
2.more expensive than moving iron type
3. Easily damaged
7 0
2 years ago
The product life cycle defines the stages that new products move through as they enter, are established in, and ultimately leave
Bas_tet [7]

Answer:

The four marketing mix of every new business are:

1. Product

2. Place

3. Price

4. Promotion

For each of the stages of product life cycle, those 4p should be use appropriately.

Explanation:

The four marketing mix of every new business are:

1. Product

2. Place

3. Price

4. Promotion

the product life cycle are directly proportional to the 4p of marketing. the product life cycle stages are introduction, growth, maturity and decline.

For each of the stages of product life cycle, those 4p should be use appropriately.

Stages of product life cycle and how the 4p fit into it.

The introduction stage:

at this stage, a new product just want to be introduced to the consumers. the product stage has being developed. The place where the product will fit in will also be consider. the location of people who consume this product. Pricing strategy consider a low price at the introduction stage, the business owner may not get any profit at this stage. then, continuous advertisement to create awareness of the product to the environment.

The growth stage:

the product will continuing to be move to different locations. the standard of the product quality will be maintained. the Pricing will start increasing. then, continuous advertisement to create awareness of the product and working on improving the product to suit the consumer.

the Mature stage:

At this stage, the consumer are fully aware of the product. wide range of location are reach. the pricing has reach its peak. Profit have been maximized. And, competitors of the product are in the market. Corporate social responsibility (CSR) will be the promotional value at this stage.

The Declining stage:

The business product have fully grown to its peak, and its only constant promotional values like CSR, advertisement, bonuses, can sustain it in the market. At this stage also, price comparison with other competitor should be carefully look into.

4 0
4 years ago
Other questions:
  • A manometer containing a fluid with a density of 60 lbm/ft3 is attached to a tank filled with air. If the gage pressure of the a
    12·1 answer
  • Consider the following program:
    15·1 answer
  • A rectangular open box, 25 ft by 10 ft in plan and 12 ft deep weighs 40 tons. Sufficient amount of stones is placed in the box a
    13·1 answer
  • 12 times the square root of 8737
    13·1 answer
  • Will mark brainliest!
    13·2 answers
  • I NEED HELP ASAP WILL AWARD BRAINLIEST
    8·2 answers
  • When economist determine that a nations GDP has declined, they can point to this as a sign of what?
    8·1 answer
  • A step-up transformer has 20 primary turns and 400 secondary turns. If the primary current is 30 A, what is the secondary curren
    15·1 answer
  • For some metal alloy, a true stress of 345 MPa (50040 psi) produces a plastic true strain of 0.02. How much will a specimen of t
    13·1 answer
  • Which of the following statements about resistance is TRUE?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!