Hello. I am very new to c++ and needed help with a code for my class. Here is the scenario.
You are given an input file (say Lab8_P1_InputFile.txt) with the following data:
Alex Antonio 9 1
John Jeffrey 14 0
Sala Kutha 12 1
Sara David 15 1
Tiffany Peterson 6 0
Justin Alberto 9 0
Nancy Scott 12 1
Each input line consists of a student's first name, last name, number of credits registered for the current term, and a flag that indicates whether the student is eligible for in-state tuition rate or not (1 means in-state rate, and 0 means out-state rate). For example, in the first input line, the first name of the student is Alex, the last name is Antonio, the number of registered credit hours is 9, and the student is eligible for in-state tuition rate.
Write a program that reads data from the specified input file and stores the output in an output file (say Lab8_P1_OutputFile.txt). If the tuition per credit hour is $350 for in-state students and $570 for out-state students. You need to read the information for each student from the input file, compute the total tuition amount, and then write the required information into the output file.
For each student, the data must be written into the output file in the following format:
lastName, firstName NumberOfCreditsRegistered TotalTuitionAmount
For example, the first line in the output file should be as below:
Antonio, Alex 9 3150
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main ();
{
int name, number_Credit_Hours, cost;
string xyz;
ifstream inFile;
ofstream outFile;
inFile.open ("indata.txt");
outFile.open("outdata.txt");
return 0;
}
|