0% found this document useful (0 votes)
36 views3 pages

Laboratory 1

Uploaded by

floydmustang1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views3 pages

Laboratory 1

Uploaded by

floydmustang1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

LABORATORY 1: OBJECT ORIENTED PROGRAMMING (OOP) WITH C++

PROGRAM: Bachelor in Engineering Technology


ELECTRICAL ENGINEERING
SUBJECT: SOFTWARE ENGINEERING 2A
DATE: 2023
TOTAL POINTS: 40 (Activity 1 + Activity 2)

Objective
The objective of the assignment is to teach you how to develop C++ programs using OOP
techniques. Using OOP encourages the interaction of objects and their functions using
appropriate methods and properties. You are to perform this practical/task using pair
programming technique. Any group exceeding more than two participants per workstation
will neither be attended to nor graded.

Procedure
Follow the instructions as follows:
1. Open up 2019 Microsoft Visual Studio on your laboratory desktop.
2. Read out the instructions in your laboratory manuals properly.
3. Write out the codes in the Visual Studio C++ editor as indicated in the manual. Make
sure you save your codes at intervals.
4. Build and debug your code, if possible for every line. Make sure you print out your
output screen/interface and codes in your report.
5. Submit a report for the two activities on blackboard. However, each first activity will
be graded by the end of the lab.

Grading Rubric (Copy this Rubric onto the first page of your report)
BENCHMARK COMMENTS POINTS Ex 1 Ex 2 Ex 3
IDE proficiency Includes the proficiency of the IDE employed in the 2
course of code/interface development
Specification Analytics Applies to the software specification. Pre-analysis, UML 2
and flow charts for design and implementation
Programming Skills Applies to the reasoning and analytics of software design 4
in code writing and interface design.
Programming Logic and Applies to the logic and flow of the of the written code and
Flow interface designs. A good programme must have the 5
appropriate flow and logic.
Output This is the overall performance of the code/interface
Specification/validation design. Satisfactory realisation of the specifications have 2
been met and validated.

Software Documentation Applies to written reports and software documentations


with respect to laboratory activities 5
TOTAL The sum total of the proposed benchmarks 20

1
ACTIVITY 1.1 (To be graded within the Laboratory period; Report must be submitted
with Activity 1.2)
Write a C++ program using Object Oriented Programming (OOP) style to create a class for
UJ library management. You are to specify correctly, what parameters of your class should
be private, public or protected. Your prograrn may be structured with the following
specification and tasks.

Your Tasks (Creativity is very important):


1. Program must be able to identify the student, student library ID, book(s) borrowed,
dates borrowed and due date to return books
2. Program must be able to get and print particular details of a student and their library
records.
3. Program must be able to enrol new student information into the library database on
request.

ACTIVITY 1.2 (To be submitted as a report on Blackboard by Monday)


The program below is written in C++ language using an Object Oriented Programming
(OOP) style. The following tasks are to be performed by you with respect to this code:

Your Tasks (Creativity is very important):


(i) Working on the code line-by-line, if possible, study the entire code and describe
the purpose of each instruction on each line.
(ii) Using Visual Studio C++, copy this code into the editor and run/compile the code
by complete the required inputs.
(iii) From your results in (ii), can you give a good description of the exact purpose of
this code?

1 #include <iostream>
2 using namespace std;

3 #define MAX 10

4 class student
5 {
6 private:
char name[30];
int rollNo;
int total;
float perc;
7 public:
void getDetails(void);
void putDetails(void);
8 };

9 void student::getDetails(void)
10 {
11 cout << "Enter name: " ;
12 cin >> name;
13 cout << "Enter roll number: ";
14 cin >> rollNo;
15 cout << "Enter total marks out of 500: ";
16 cin >> total;

17 perc=(float)total/500*100;
18 }

2
19 void student::putDetails(void)
20 {
21 cout << "Student details:\n";
22 cout << "Name:"<< name << ",Roll Number:" << rollNo << ",Total:" << total <<
",Percentage:" << perc;
23 }

24 int main()
25 {
26 student std[MAX];
27 int n,loop;

28 cout << "Enter total number of students: ";


29 cin >> n;

30 for(loop=0;loop< n; loop++){
cout << "Enter details of student " << loop+1 << ":\n";
std[loop].getDetails();
31 }
32 cout << endl;

33 for(loop=0;loop< n; loop++){
cout << "Details of student " << (loop+1) << ":\n";
std[loop].putDetails();
34 }

35 return 0;
36 }

You might also like