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

You have a class diagram as below pictures: Note: m_UserName: no more that 20 ch

ID: 3623359 • Letter: Y

Question

You have a class diagram as below pictures: Note: m_UserName: no more that 20 characters. M_FullName: no more than 50 characters. M_Grade: is exactly 16 characters. M_ClassName: is exactly 6 characters. M_No: an integer greater than 0 and less than 99999. Write C++ program to implement these classes, and do the below tasks: Enter file name Add new Student to a class List all student in a class Tasks 1: Allow user to input name of file that contains information of all students in a class. Task 2: Allow user to add new information of a student to the class. After check validation of all data, save this information into file that was inputted in task 1. Task 3: Display all information of the class in file that was inputted in task 1. Sample data: SE0518

Explanation / Answer

#include<iostream>

using std::cerr;

using std::cin;

using std::cout;

using std::endl;

using std::ios;

#include<iomanip>

using namespace System;

using std::setw;

#include<fstream>

using std::fstream;

#include<cstdlib>

using std::exit;

#include "StdentData.h"

int main()

{

int no;

char userName[20];

char fullName[50];

double grade;

fstream outCreadit("creadit.dat",ios::in|ios::out|ios::binary);

if(!outCredit)

{

cerr<<"File could not be opened"<<endl;

exit(1);

}

cout<<"Enter number:");

StudentData student;

cin>>no;

while(no> && no<99999)

{

cout<<"Enter username,full name, grades: ";

cin>>setw(15)>>userName;

cin>>setw(10)>>fullName;

cin>>grade;

student.setNo(no);

student.setUserName(userName);

student.setFullName(fullName);

student.setGrade(grade);

outCreadit.seekp((student.getNo()-1)*sizeof(StudentData));

outCreadit.write(reinterpret_cast<const char*>(&student),sizeof(StudentData));

cout<<"Enter number:";

cin>>no;

}

return 0;

}

}

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