//******************************************************************************

************//
// Written By: Joshua J Gaither
Title: HW4
Class: CSC 125
// Project: \\eccentric\Class\csc125\001\Joshua013\hws\hw4
// Last Updated: 3/7/13
// Created On 2/18/13
// Compiler: Visual Studios Visual C++ Native
// Notes: Compile and Execute
// Overview: Calculates GPA from previous and current school from hours and qua
lity
//******************************************************************************
************//
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
#include <cassert>
using namespace std;
int main()
{
string yourName;
cout << "Please enter your Full name: ";
getline (cin, yourName);
cout << "\nWelcome " << yourName << "\n";
string yourAge;
cout << "\n Please enter your age in years, using whole numbers: " ;
//ask user for age
cin >> yourAge;
string yourSocial;
cout << "\n Please enter your Social Security number, numerically withou
t dashes or spaces: ";
//ask user for ssn
cin >> yourSocial;

";

string yourGender;
cout << "\n Please indicate your gender by typing either Male or Female:
//ask user for gender
cin >> yourGender;

string yourOldSchool;
cout << "\n Please enter the name of your previous university: " ;
//ask user for previous college
cin >> yourOldSchool;
float yourOldHours(0);
//var for previous school hours
cout << "\nPlease enter the total number of completed credit hours you a
re \n transfering from " << yourOldSchool << " to Missouri State University.\n T
his should be a number between 1 and 999: " ;
cin >> yourOldHours;
float yourOldQuality(0);
//var for previous school qualit
y pounsigned ints
cout << "\nPlease enter your cumulative quality total from " << yourOldS
chool << "\nas it appears on your most recent transcript.\n This should be a num
ber between 1 and 999: ";

ofstream myout. myout << right << setw (3) << yourMsuQuality << endl. // open file location and create record. //output collected information cout << "\nStudent Name: " << yourName << setw(15) << " Age: " << you rAge << " \n". myout << < "\n\n". //combin //combin . ed quality calculation float yourOldTotal(yourOldQuality/yourOldHours). cout << right << setw (3) << yourMsuQuality << endl.txt"). cin >> yourMsuHours.\n This should be a number between 1 and 999: ". cout << "SSN: " << yourSocial << setw(27) << "Gender: " << yourGender << "\n\n". //combined Hours calculation float yourTotalQuality(yourOldQuality+yourMsuQuality). myout << "\nTransfer Hours: " << setw(10) << yourOldHours << setw(25) << "Transfer Quality: " << right << setw(3) << yourOldQuality << endl. myout. float yourMsuHours(0). file "\nStudent Name: " << yourName << setw(15) << " Age: " << yo "SSN: " << yourSocial << setw(27) << "Gender: " << yourGender < "*************************************************\n". cout << "Msu Hours: " << setw(15) << yourMsuHours << setw(25). //GPA Calculation for MSU float yourTotalGpa(yourTotalQuality/yourTotalHours). myout << //duplicated for myout << urAge << " \n".txt assert(myout. float yourTotalHours(yourOldHours+yourMsuHours). myout << "*************************************************\n". cout << "*********************************************************\n". float yourMsuQuality(0).open("\\\\eccentric\\Class\\csc125\\001\\Joshua013\\labs\\lab6\\re cord. ed GPA calculation cout << "\n**********************************************". cin >> yourMsuQuality.\n This should be a number between 1 and 999: ". //check if file is open cout << "*********************************************************\n".cin >> yourOldQuality. //var for MSU hours cout << "\nPlease enter the number of completed hours from Missouri Stat e University. cout << setw(25) << "Msu Quality: ". myout << setw(25) << "Msu Quality: ". myout << "Msu Hours: " << setw(15) << yourMsuHours. //GPA calculation for previous school float yourMsuTotal(yourMsuQuality/yourMsuHours). //var for MSU Quality cout << "\nPlease enter your current quality total from Missouri State U niversity. cout << "\nTransfer Hours: " << setw(10) << yourOldHours << setw(25) << "Transfer Quality: " << yourOldQuality << endl.is_open()).

myout << "**********************************************\n". myout << "\nTotal GPA: " << setw(18) << right << setprecision(2) << your TotalGpa <<" \n\n". cout << "\nTotal GPA: " << setw(18) << right << fixed << setprecision(2) << yourTotalGpa <<" \n\n". "\n Total quality: " << setw(18) << yourTotalQuality <<" \n\n". myout myout myout myout << << << << "\n**********************************************". "**********************************************\n". myout << "\nTransfer GPA: " << setw(15) << right << setprecision(2)<< yo urOldTotal << " \n". myout << "\nMsu GPA: " << setw(20)<< right << setprecision(2) << yourMsu Total <<" \n". //close file return 0. myout << "\n**********************************************\n". cout << "\n**********************************************\n".close(). cout << "**********************************************\n". cout << "\n Total quality: " << setw(18) << yourTotalQuality <<" \n\n". myout.cout << "\n\n Total hours: " << setw(20) << yourTotalHours << " ". } . cout << "\nMsu GPA: " << setw(20)<< right << fixed << setprecision(2) << yourMsuTotal <<" \n". "\n\n Total hours: " << setw(20) << yourTotalHours << " ". cout << "**********************************************\n". cout << "\nTransfer GPA: " << setw(15) << right << fixed << setprecision (2)<< yourOldTotal << " \n".

Sign up to vote on this title
UsefulNot useful