QUESTION IN ATTACHMENT! PLEASE CHECK ----AND ITS HUMBLE REQUEST TO USE ONLY BELOW TEMPLATES WHILE MAKING SOLUTION-----   MAIN.CPP #include #include #include #include #include #include #include #include #include "UserBO.cpp" using namespace std; int main() { // fill your code here // declare variables string name; string username; string password; string contactnumber; // create a User class object User obj; // create a object of ofstream class ofstream outfile; outfile.open("example.txt");// open file example.txt UserBO userObj;// create a object of class UserBO userObj for write in file int choice; int i=1; // input from user do{ cout<<"Sample input and output : "<>name; cout<<"Enter the contact number "<>contactnumber; cout<<"Enter the username"<>username; cout<<"Enter the password "<>password; obj.setName(name); obj.setContactnumber(contactnumber); obj.setUsername(username); obj.setPassword(password); userObj.writeUserdetails( outfile ,obj); // wirte in file cout<<"Press 1-> countinue \nPress 0-> exit \nChoice : "; cin>>choice; }while(choice!=0); // close the opened file. outfile.close(); return 0; }   UserBO.cpp   #include #include #include #include #include #include #include #include"User.cpp" using namespace std; class UserBO{ public: // writeUserdetails() function write data into file void writeUserdetails(ofstream &file,User Obj){ // fill your code here; // write data into the file. file << Obj.getName() << ","<< Obj.getContactnumber() << ","<< Obj.getUsername() << ","<< Obj.getPassword() << endl; cout<<"Datas writtrn in successfully"< #include #include #include #include #include #include using namespace std; class User{ // private variable declare private: string name; string username; string password; string contactnumber; public: // set name void setName(string name){ this->name = name; } // get name string getName(){ return this->name ; } // set username void setUsername(string username){ this->username = username; } /// get username string getUsername(){ return this->username; } // set password void setPassword(string password){ this->password = password; } // get password string getPassword(){ return this->password; } // set contactnumber void setContactnumber(string contactnumber){ this->contactnumber = contactnumber; } // get contactnumber string getContactnumber(){ return this->contactnumber; } };

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

QUESTION IN ATTACHMENT! PLEASE CHECK

----AND ITS HUMBLE REQUEST TO USE ONLY BELOW TEMPLATES WHILE MAKING SOLUTION-----

 

MAIN.CPP

#include<iostream>
#include<string>
#include<stdio.h>
#include<fstream>
#include<list>
#include<iterator>
#include<sstream>
#include <iostream>
#include "UserBO.cpp"

using namespace std;

int main()
{
// fill your code here
// declare variables
string name;
string username;
string password;
string contactnumber;
// create a User class object
User obj;
// create a object of ofstream class
ofstream outfile;
outfile.open("example.txt");// open file example.txt
UserBO userObj;// create a object of class UserBO userObj for write in file
int choice;
int i=1;

// input from user
do{
cout<<"Sample input and output : "<<i++<<endl;
cout<<"Enter the name of user "<<endl;
cin>>name;
cout<<"Enter the contact number "<<endl;
cin>>contactnumber;
cout<<"Enter the username"<<endl;
cin>>username;
cout<<"Enter the password "<<endl;
cin>>password;

obj.setName(name);
obj.setContactnumber(contactnumber);
obj.setUsername(username);
obj.setPassword(password);

userObj.writeUserdetails( outfile ,obj); // wirte in file
cout<<"Press 1-> countinue \nPress 0-> exit \nChoice : ";
cin>>choice;
}while(choice!=0);

// close the opened file.
outfile.close();
return 0;
}

 

UserBO.cpp

 

#include<iostream>
#include<string>
#include<stdio.h>
#include<fstream>
#include<list>
#include<iterator>
#include<sstream>
#include"User.cpp"
using namespace std;

class UserBO{
public:
// writeUserdetails() function write data into file
void writeUserdetails(ofstream &file,User Obj){
// fill your code here;
// write data into the file.
file << Obj.getName() << ","<< Obj.getContactnumber() << ","<< Obj.getUsername() << ","<< Obj.getPassword() << endl;
cout<<"Datas writtrn in successfully"<<endl;
}

};

 

User.cpp

#include<iostream>
#include<string>
#include<stdio.h>
#include<fstream>
#include<list>
#include<iterator>
#include<sstream>
using namespace std;

class User{
// private variable declare
private:
string name;
string username;
string password;
string contactnumber;

public:
// set name
void setName(string name){
this->name = name;
}
// get name
string getName(){
return this->name ;
}
// set username
void setUsername(string username){
this->username = username;
}
/// get username
string getUsername(){
return this->username;
}
// set password
void setPassword(string password){
this->password = password;
}
// get password
string getPassword(){
return this->password;
}
// set contactnumber
void setContactnumber(string contactnumber){
this->contactnumber = contactnumber;
}
// get contactnumber
string getContactnumber(){
return this->contactnumber;
}
};

Write a program to read the GPA of students from users and display the details using dynamic memory
allocation.
Strictly adhere to the Object-Oriented specifications given in the problem statement. All class
names, member variable names, and function names should be the same as specified in the problem
statement.
Include the following member function in the Main class
Member Function
void display(float arr[], int size)
Description
This method is used to display the student's GPA details.
In the main method, obtain input from the user in the console and call the display method to display the
GPA details.
Note:
Use a new keyword to create a dynamic array to store the GPA details.
Input Format:
Input consists of roll number and name.
Output Format:
The output displays the roll number and name
Refer sample input and output for formatting specifications.
[All text in bold corresponds to input and rest corresponds to output]
Sample Input and Output 1:
Enter total number of students:
2
Enter GPA of students
7.8
6.7
Students GPA Details
Student1:7.8
Student2:6.7
Transcribed Image Text:Write a program to read the GPA of students from users and display the details using dynamic memory allocation. Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement. Include the following member function in the Main class Member Function void display(float arr[], int size) Description This method is used to display the student's GPA details. In the main method, obtain input from the user in the console and call the display method to display the GPA details. Note: Use a new keyword to create a dynamic array to store the GPA details. Input Format: Input consists of roll number and name. Output Format: The output displays the roll number and name Refer sample input and output for formatting specifications. [All text in bold corresponds to input and rest corresponds to output] Sample Input and Output 1: Enter total number of students: 2 Enter GPA of students 7.8 6.7 Students GPA Details Student1:7.8 Student2:6.7
Expert Solution
steps

Step by step

Solved in 8 steps with 4 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY