Ooc Labprogram
Ooc Labprogram
Implement a C++ Program to demonstrate the concepts of Class, Object and Constructors by creating a class
1.
that holds the basic information of students belonging to an Engineering College.
Develop a C++ Program to simulate a calculator that performs basic arithmetic operations on integer and
2.
floating point numbers using the concepts of function overloading.
Write a Java Program for demonstrating creation of Java classes, objects, constructors, declaration and
3.
initialization of variables.
4. Demonstrate the for, for-each, while and do-while loops using a Java Program
Develop a Java Program to create Java package and illustrate the process of importing a user defined Java
6.
Package .
7. Implement a Java Program to demonstrate of Bounded buffer problems using Java Multi-Threading concepts
1. Implement a C++ Program to demonstrate the concepts of Class, Object and Constructors by
creating a class that holds the basic information of students belonging to an Engineering
College.
#include <iostream>
#include <string>
using namespace std;
class Student {
string name;
string usn;
string branch;
float cgpa;
public:
// Constructor to initialize the student's information
Student(string sname, string susn, string sbranch, float scgpa) {
name = sname;
usn=susn;
branch=sbranch;
cgpa=scgpa;
}
int main( ) {
// Creating objects of Student class
Student s1 ("Ganaraj", "4SF21CI001", "CSE-AIML", 9.5);
Student s2 ("Manjunath", "4SF21AD002", " AI&DS", 9.0);
Student s3 ("Sandra", "4SF21CS003", " CSE", 8.6);
Student s4 ("Naveen", "4SF21IS002", " ISE", 9.0);
class Calculator {
public:
// Function to add two integers
int calculate(int num1, int num2) {
return num1 + num2;
}
int main() {
Calculator calc;
return 0;
}