Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

All code must be in C++ using G++ compiler write a program that uses a structure

ID: 3826844 • Letter: A

Question

All code must be in C++ using G++ compiler

write a program that uses a structure named StudentRecord to store the following information: stdd Name: string std UIN: integer stdMajor: string stdYear: integer (1st year, 2nd year etc.) stdTotalCredits: integer stdCreditsCompleted: integer The main function should get all the above details as input from a user. Furthermore, create a function monthsBeforeGraduation() that takes stdTotalCredits and stdCreditscompleted as parameters and returns the number of months remaining for graduation. Assume that the student completes 10 credits over 6 months.

Explanation / Answer

#include <iostream>
using namespace std;
int monthsBeforeGraduation(int s_stdTotalCredits,int s_stdCreditsCompleted);
//structure declaration
struct StudentRecord
{
char stdName[100];
int stdUIN;
char stdMajor[100];
int stdYear;
int stdTotalCredits;
int stdCreditsCompleted;
}s;
int main()
{
   cout << "Enter the student's name :" << endl;  
   cin.get(s.stdName,100);//to read the name with spaces

   cout << "Enter the student's UIN :" << endl;
    cin >> s.stdUIN ;

   cout << "Enter the student's Major : " << endl;
    cin >> s.stdMajor;

   cout << "Enter the student's class year :" << endl;
    cin >> s.stdYear ;

   cout << "Enter the total credits required for graduation :" << endl;
    cin >> s.stdTotalCredits ;

   cout << "Enter the total credits the student has completed :" << endl;
    cin >> s.stdCreditsCompleted ;
  
  
cout << " Student Record " << endl;

cout << "Name: " << s.stdName << endl;
cout << "UIN: " << s.stdUIN << endl;
   cout << "Major: " << s.stdMajor << endl;
cout << "Class Year: " << s.stdYear << endl;
   cout << "Total Credits :" << s.stdTotalCredits<< endl;
cout << "Total Credits Completed :" << s.stdCreditsCompleted << endl ;
//calling the function to get the months remaining for graduation
   int months_Before_Graduation=monthsBeforeGraduation(s.stdTotalCredits,s.stdCreditsCompleted);
   cout << "The number of months remaining before graduation :" << months_Before_Graduation << endl;

return 0;
}
int monthsBeforeGraduation(int s_stdTotalCredits,int s_stdCreditsCompleted)
{
   int months_Before_Graduation;
   int CreditsRequired=s_stdTotalCredits-s_stdCreditsCompleted;
   if(CreditsRequired%10==0)
   {
       months_Before_Graduation=(CreditsRequired/10)*6;  
   }
   else
   {
       months_Before_Graduation=((CreditsRequired/10)+1)*6;
   }
   return months_Before_Graduation;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote