Create project
I am using Virtual Studio for this Project, as in the screenshot we can see that the New Project have been made under Chitarth_College and made under Win32 Console application.
Following is the screenshot of the console mode showing that I have created 2 students records a and b with different names, student id and marks of the 4 subject. Also after entering 2 records, I have also used the display option in order to view the records I have entered earlier.
CITATION Mic l 5129 (Microsoft)Create New Student Record
Attached is the screen shot of the Visual Studio showing the student id 1 with name and all 4 marks have been added in the system.
Display of student Records
After creating the student records into the console system, I have then displayed all the student records which I have added in the previous screenshot.
Create Another Student
Another example of creating another student record into the system, again with different name, marks and ID.
Search Student Record
After adding the student records in to the Visual Studio, I have then used Search Student record from the menu option and got the relevant result.
Modify Student Record
Following screenshot shows that the student ids 1 has changed the name from ABC to ABC2 and also have changed the marks as well.
Display All Records After Modification
After modifying the student record in the previous screenshot, I have then used the b option i.e. displaying all records after modification.
Deletion of Records
In the following screen shot I have deleted the record for the student id 2.
CITATION eas15 l 5129 (easytuts4you, 2015)Display Records after Deletion
As in the screen shot, when I delete the student id 2 from the system and then displayed records I can only see the student id 1.
Exit the Program
Following is the screen shot of the Studio while closing the program.
Code
// Chitarth_College.cpp This file contains the main function. Program execution begins and ends there.
//
includepch.h
includeltiostreamgt
includeltstringgt
usingnamespacestd
// declare class student
classstudent
private
intstudentID
stringstudentName
int marks1, marks2, marks3, marks4
double percentage
char grade
public
student()
studentID 0
studentName
marks1 0
marks2 0
marks3 0
marks4 0
percentage 0.0
//constructors
student(intid,stringname,intm1,intm2,intm3,intm4)
studentID id
studentNamename
marks1 m1
marks2 m2
marks3 m3
marks4 m4
percentage ((double)(m1 m2 m3 m4) / 400.0)100.0
if (percentage gt 80.0)
grade A
elseif (percentage gt 60.0 ampamp percentage lt 80.0)
grade B
elseif (percentage gt 40.0 ampamp percentage lt 60.0)
grade C
else
grade D
// setters and getters
stringgetName()
returnstudentName
intgetId()
returnstudentID
doublegetPercent()
return percentage
chargetGrade()
return grade
voidsetId(intid)
studentID id
voidsetName(stringname)
studentNamename
voidsetMarks(intm1, intm2, intm3, intm4)
marks1 m1
marks2 m2
marks3 m3
marks4 m4
//change grades and percentage accordingly
percentage ((double)(m1 m2 m3 m4) / 400.0)100.0
if (percentage gt 80.0)
grade A
elseif (percentage gt 60.0 ampamp percentage lt 80.0)
grade B
elseif (percentage gt 40.0 ampamp percentage lt 60.0)
grade C
else
grade D
voidshowMenu()
coutltlta)Create student recordsltltendl
coutltltb)Display all student recordsltltendl
coutltltc)Search student recordsltltendl
coutltltd)Modify student recordsltltendl
coutltlte)Delete records.ltltendl
coutltltf)Exit the programltltendl
int main()
char choice
//create an array of objects of student class of size 100
student s100
//i for storing the object index in s
inti 0
while (1)
showMenu()
coutltltEnter your choice(a-f)
cingtgt choice
if (choice a)
int id, m1, m2, m3, m4
string name
coutltltEnter student id
cingtgt id
coutltltEnter name
cingtgt name
coutltltEnter marks of 4 subjects
cingtgt m1 gtgt m2 gtgt m3 gtgt m4
student stud(id, name, m1, m2, m3, m4)
si stud
i
if (choice b)
for (int j 0 j lti j)
coutltltStudentltlt j 1 ltlt details ltltendl
coutltltID ltlt sj.getId() ltltendl
coutltltName ltlt sj.getName() ltltendl
coutltltPercentage ltlt sj.getPercent()ltltendl
coutltltGrade ltlt sj.getGrade()ltltendl
coutltltendl
if (choice c)
int id
//take input the id of the student to search
coutltltEnter student id to search ltltendl
cingtgt id
int flag 1
for (int j 0 j lti j)
if (sj.getId() id)
coutltltStudent record foundltltendl
flag 0
peak
//if record not found
if (flag 1)
coutltltStudent record not foundltltendl
if (choice d)
int id, m1, m2, m3, m4
string name
coutltltEnter student id
cingtgt id
coutltltEnter name
cingtgt name
coutltltEnter marks of 4 subjects
cingtgt m1 gtgt m2 gtgt m3 gtgt m4
student stud(id, name, m1, m2, m3, m4)
int flag 1
for (int j 0 j lti j)
if (sj.getId() id)
//as record is present then change the details
sj.setId(id)
sj.setName(name)
sj.setMarks(m1,m2,m3,m4)
flag 0
peak
//if record not found
if (flag 1)
coutltltStudent record not foundltltendl
if (choice e)
int id
coutltltEnter student id to delete ltltendl
cingtgt id
int flag 1
//if student found delete record and move each object one index behind
for (int j 0 j lti j)
if (sj.getId() id)
for (int k j k lt (i - 1) k)
sk sk 1
i--
flag 0
peak
//if record not found
if (flag 1)
coutltltStudent record not foundltltendl
if (choice f)
exit(0)
Pseudo code
START
DECLARE student class
DECLARE private members, member functions
DEFINE getter and setters
DECLARE student class array
DISPLAY showMenu()
INPUT the choice
IF the input is a THEN
DO
CREATE new student record
DISPLAY one record created successfully
CALL main menu
ENDDO
IF the input is b THEN
DO
DISPLAY all records present
CALL main menu
ENDDO
IF the input is c THEN
DO
INPUT the id of student to be searched
SEARCH the student id in records
DISPLAY record of student if present
DISPLAY not present if student not in record
CALL main menu
ENDDO
IF the input is d THEN
DO
INPUT the id of student to be modified
SEARCH the student id in records
DISPLAY record of student if present
INPUT the field to be changed
UPDATE student record
CALL main menu
ENDDO
IF the input is e THEN
DO
INPUT the id of student to be deleted
SEARCH the student id in records
DELETE record of student if present
DISPLAY student not present if id does not match
CALL main menu
ENDDO
IF the input is f THEN
DO
EXIT the program
ENDDO
EXIT
CLASS
class student
OBJECTS
S1, S2....S100
METHOD INVOCATION
showMenu()
student stud(id, name, m1, m2, m3, m4)
sj.setName(name)
sj.setMarks(m1,m2,m3,m4)
Class- Student
Private Members
intstudentID
stringstudentName
int marks1, marks2, marks3, marks4
double percentage
char grade
Getters
getId()
getName()
getPercent()
getGrade()
Setters
setId()
setName()
setMarks()
Objects- s 100
Access to class objects S100 are granted and modification can be performed by getters and setters.
Private members cannot be accessed directly by objects. Public member functions are used to access them.
DATA- int studentID
string studentName
int marks1, marks2, marks3, marks4
double percentage
char grade
METHODS-getName()
getId()
setId()
getGrade()
setMarks(int m1, int m2, int m3, int m4)
OBJECTS-s0, s1, s2, till the size of the class / number of students
INTERACTION- after deletion of 1 student
si si
TestingTest Plan
Title Student Report Card management with class, object, functions
Description Prompt the user to enter the choice. A-F are only allowed choices. EXIT on rest.
Precondition If Display is chosen then records must be present in the database already, otherwise empty object will through error.
Assumption Object defined are not limited by any number i.e. we can declare as many students as we wish.
Expected Result INPUT , OUTPUT or CALCULATION as per the entered choice.
INHERITANCE- class Subject public Student
(Association, Aggregation and Composition Relationships with Examples, 2019)
Test -1
Input alphanumeric to all fields and check the expected results.
If program peaks at some stage-gt debug the code with allowing alphanumeric at the required place.
Test-2
Access student Records before entering the details and check if the program peaks.
If it peaks we allow display function to show empty student record.
Association, Aggregation and Composition Relationships with Examples. (2019). Retrieved from https//www.go4expert.com/articles/association-aggregation-composition-t17264/
pother, H., amp pother, H. (2019). Algorithm And Pseudocode In C language With Example. Retrieved from https//www.hitpother.com/algorithm-pseudocode-c-language-with-example-main-printf-scanf/
BIBLIOGRAPHY easytuts4you. (2015, Oct 23). New and Delete Operators in C. Retrieved from https//www.youtube.com https//www.youtube.com/watchv0duhNmu8zgA
Microsoft. (n.d.). Create a C console app project. Retrieved from https//docs.microsoft.com https//docs.microsoft.com/en-us/cpp/build/vscpp-step-1-createviewvs-2017
Microsoft Visual Studio Software - Microsoft Store. (2019). Retrieved from https//www.microsoft.com/en-us/store/b/visualstudio
Related Reads You Can’t Miss :
INF30004 Business Intelligence and Data Visualization Assignment Sample
1,212,718Orders
4.9/5Rating
5,063Experts
Turnitin Report
$10.00Proofreading and Editing
$9.00Per PageConsultation with Expert
$35.00Per HourLive Session 1-on-1
$40.00Per 30 min.Quality Check
$25.00Total
FreeGet
500 Words Free
on your assignment today
Get
500 Words Free
on your assignment today
Request Callback
Doing your Assignment with our resources is simple, take Expert assistance to ensure HD Grades. Here you Go....
Lock in your expert now.
Pay the rest only after you're 100% satisfied.
Why this is a no-brainer: