Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- class attendance
- {
- double p[70];
- double pres=0;
- double abs=0;
- public:
- void mark(int day,int present)
- {
- p[day]=present;
- if(present==0)
- abs++;
- else
- pres++;
- }
- int getpresent()
- {
- return pres;
- }
- int getabsent()
- {
- return abs;
- }
- double collegiate(int total)
- {
- double x=total-abs;
- double v=(x/total)*100;
- return v;
- }
- };
- int main()
- {
- attendance obj;
- int n,i;
- cout<<"enter total days: ";
- cin>>n;
- cout<<"enter absence percentages: ";
- for(i=0;i<n;i++)
- {
- int s;
- cin>>s;
- obj.mark(i,s);
- }
- cout<<"ROMAN AL ASIF: "<<endl;
- cout<<"total present: "<<obj.getpresent()<<" days"<<endl;
- cout<<"total absent: "<<obj.getabsent()<<" days"<<endl;
- double b;
- b=obj.collegiate(n);
- cout<<"percentage: "<<b<<"%"<<endl;
- if(b<90 && b>=75)
- {
- cout<<"the student is non collegiate"<<endl;
- }
- else if(b<75)
- {
- cout<<"the student is dis collegiate"<<endl;
- }
- else
- {
- cout<<"the student is collegiate"<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement