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

************//
// 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: ";

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

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

Sign up to vote on this title
UsefulNot useful