Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

BR 2 0 / * Nem: Klas: Det: Diskripsh n: * / #inklud we yu kin yuz #inklud we yu go yuz yuz nemsp

BR20"/*
Nem:
Klas:
Det:
Diskripshn:
*/
#inklud we yu kin yuz
#inklud we yu go yuz
yuz nemsps std;
void input (string& nem, int& id, int& numKs dn);
void inputKs (string& ksNmba, int& kredit, char& gred);
dabl klkulGPA(int totlPoints, int totlKrdit dn);
char gredToPoints(char gred);
void autput (string nem, int id, int totlKrdit, dabl gpa);
const int MAKS_KS DN =5;
const char GRADES []={'A','B','C','D','F'};
const dabl PYNT []={4.0,3.0,2.0,1.0,0.0};
int men (){
fstrim tFayl;
outFile.open (""GPA_Ript.txt"");
// Print di h\epsi da
outFile <<""&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~ ~&~&~&~&~
""
<<""\tKmyuniti Klej
""
<<""\tCIS 160 Studnt dn GPA ript
""
<<""\tSpring 2023 S\epsi m\epsi sta
""
<<""\&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~ ~&~&~&~&~
"";
char ripit;
du {
string nem;
int id, numKs, totlKrdit =0, ttalPoint =0;
input (nem, id, numKs dn);
outFile <<""Nem: ""<< nem <<""\tID #: ""<< id << endl;
f(int i =1; i <= numKs; i++){
string ksNmba;
int kredit dn;
char gred;
inputKs(ksNmba, kredit, gred);
totlKrdit dn += kredit dn;
totalPoints += gredToPoints(grd)* kredit dn;
}.
dabl gpa = klkyulGPA (ttalPoint, ttalKrdit);
autput (nem, id, totlKrdit, gpa);
cout <<""Yu wan f pross da studnt?(Y/N): "";
cin >> ripit;
} while (toupper (ripit)=='Y');
tFayla.klos ();
cout <<""Autput we dn rayt to GPA_Ript.txt
"";
ritn 0;
}.
void input(string& nem, int& id, int& numKs dn){
cout <<""ntay studnt nem: "";
getlayn (cin, nem);
bool validID = lay lay wan;
we (!validID){
cout <<""ntay studnt ID (0-9999): "";
cin >> id we dn kl;
validID =(id >=0 && id <=9999);
if (!validID){
cout <<""ID nmba we n valid." "";
}.
}.
bool validNumKs dn = lay;
while (!validNmKs dn){
cout <<""ntay nmba f di ks dn (1-5): "";
cin >> numKs dn;
validNumKs =(numKs >=1 && numKs <= MAX_KS);
if (!validNumKs dn){
cout <<""Nmba we n valid f di ks dn.""";
}.
}.
cin.ignore ();
}.
void inputKs(string& ksNmba, int& kredit, char& gred)
n sh wetin rng wit di kd aw f ivin fiks am bt dn tin ya na in rikwaymnt dn:
Rayt wan C++ program f klkul wan studnt dn GPA f di smsta. Di program f aksept wan studnt in nem, di ID nmba n di nmba f di ks dn we i de tek. Fni ks, dn nid di data we de d ya
di ks nmba wan string e.g. CIS 160 we de na di wl
di ks de kredit wan intajgz.4.4.
di las gred we dn gt f di ks a character. f e.g. WAN
Di program f rayt to fayl di studnt in nem, ID nmba, di l di kredit dn we di studnt de tek, n di studnt dn Gret Point Avrej (GPA) f di smsta. Dn f put wnin msej insay di autput if di GPA sml pas 2.0n msej f kle if di GPA na 3.0 pas dat. Di ript go print wan layn fni studnt. Chek d ya aw f fn di gpa f wan studnt.
Di tin dn we yu nid:
Input studnt in nem, ID nmba, ks nmba, nmba f di kredit f di ks n gred yuz di rayt prmpt.
Yuz wan lp f ripit f bku studnt dn te dn nta Nn f ansa wan prmpt.
Krio knstant dn we de sho di pynt dn fni gred.
A-4 pont
B-3 pont
C-2 pynt dn
D -1 pont
F-0 pont dn
Kalkul yuz di knstant dn we yu dn difayn, n ni data we di yuza nta.
Yuz at le 4 slf-kntinnt fnshn f du IPO, wan fnshn we sml pas 5-10 stetmnt dn n kin tek am as slf-kntinnt fnshn.
Inklud data validshn fl di data we dn dn nta
ID Rnj: 0-9999
Nmba f di ks dn: 15
Gret dn na: A, B, C, D, F.
Yuz toupper () function f limited yu karakta kmpiashn.
Mek yu program gt di rayt d n klm taytul f di autput.
Output go to wan file as di spesifikeshn dn we de p.
Dokumnt yu program, yuz kmnt, n pasmak, fksplen.
Yuz fnshn spsifikshn fksplen fnshn dn
Krayteria we dn f du:
-Prpa spshal, kmnt, yus f vribul, jenral program apinns.
-Program na knsistns wit programin kdin standad. (Input, prses,tput)
-Dn de difayn n yuz knstant dn krkt wan, lokal we i psibul.
-D\epsi n de yuz minimm 4 s\epsi lf-knt\epsi n fnshn d\epsi m \epsi n \epsi vri wan de du wan sbtask.
-Lp de kntinyu te dn nta Nn, i f bi prmpt lp.
-Aprpriet pas bay valyu/pas bay rfrns.
-Taytul dn de insay n dn fit.
-l di data we dn dn nta dn validet.
-dn kin print wan msej.
-l di rikwaymnt we dn dn spsifa

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions