OOP Lab: A Class that determine polar coordinates

#include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;
class polar{
  float r,a;
  public:
void setpolar(float i, float j){ r=i; a=j; }
void showpolar()
{
  cout<<“Radius = “<<setprecision(4) <<r
  <<” Angle = “<<setprecision(4)<<a;
}
void getresult(){}
polar operator + (polar ob);
};
polar polar :: operator + (polar ob){
  float x1,x2,y1,y2,x,y,rad,angle;
  float angle1,angle2,ang;
  polar tempob;
  angle1 = (22 * a) /float(7 * 180);
  angle2 = (22 * ob.a)/ float (7 * 180);
  x1 = r*cos(angle1);
  y1 = r*sin(angle1);
  x2 = ob.r * cos(angle2);
  y2 = ob.r * sin(angle2);
  x = x1 + x2;
  y = y1 + y2;
  rad = sqrt((x*x)+(y*y));
  ang = atan(y/float(x));
  angle = (180*7*ang)/22;
  tempob.setpolar(rad,angle);
  return tempob;
}
int main()
{
float r,a;
int i;
polar ob[2],sumob;
cout<<“Determine polar coordinates\n”;
cout<<“=================\n\n\n\n\n”;
for(i=0;i<2;i++){
 cout<<“\nEnter r:”<<i+1<< “:”;
 cin>>r;
 cout<<“\nEnter a:”<<i+1<< “:”;
 cin>>a;
 ob[i].setpolar(r,a);
}
cout<<“\n”;
for(i=0;i<2;i++){
 cout<<“\n\n\n\n”;
 cout<<i+1<<” number polar coordinate:”;
 cout<<“\n\n”;
 ob[i].showpolar();
 cout<<“\n\n\n\n”;
}
cout<<“\n\n\n\nResult\n\n”;
sumob = ob[0] + ob[1];
sumob.showpolar();
return 0;
}

Introducing Virtual Base Class

/* C++ program to introduce virtual base class. */
#include<iostream>
using namespace std;
class Student{
private:
int roll;
public:
void get_roll(){
cout<<“Enter Student Roll No.:”;
cin >> roll;
}
void show_roll(){
cout<<“Roll = “<<roll<<endl;
}
};
class Test: virtual public Student{
protected:
float m1,m2;
public:
void get_marks(){
cout<<“Enter Marks of Test 1&2:”;
cin>>m1>>m2;
}
void show_marks(){
cout<<“Marks Obtained:”<<m1 <<“&”<<m2<<endl;
}
};
class Sports: public virtual Student{
protected:
float score;
public:
void get_score(){
cout<<“Enter Sports score:”;
cin >> score;
}
void show_score(){
cout<<“Score = “<<score<<endl;
}
};
class Result: public Test, public Sports{
float total;
public:
void get_data(){
get_roll();
get_marks();
get_score();
}
void show_data(){
total = m1+m2+score;
show_roll();
show_marks();
show_score();
cout<<“Total= “<<total<<endl;
}
};
int main(){
Result s1;
s1.get_data();
s1.show_data();
return 0;
}

Posted in CSE

OOP Lab list

B.Sc (Hons.) in CSE
3rd Semester, CSE 520204 ,OOP Lab
Object Oriented Programming Lab list

1 Write a program in C++ that finds the volume of different shape (like rectangle, cylinder, cube) using function overloading.
2 Write a class to represent time that includes the member function to perform the following:
•Take input for time in hours and minutes.
•Add two times.
•Display the time in form hours : minutes.
3 Create a class called COMPLEX that has two private data called real and imaginary. Include member function input() to input real & imaginary values, show() to display complex numbers. Write a program to add and subtract two complex numbers.
4 Write a program to find the largest and smallest number between two numbers of different classes.
5 Using class write a program that would be able to do the following task:
a)To create the vector.
b)To add the value of a two vector
c)To display the vector in the form (ai+bj+ck)
6 Using class write a program that would be able to do the following task:
·To create the vector.
·To modify the value of a given element.
·To multiply by a scale value
·To display the vector in the form (10, 20, 30…….. )
7 Create two classes……….. DB which stores the value distance. DM store distance……and centimetres and DB in feet inches. Write a program that can read the values for the class objects and add one object DM with another object of DM. Use friend function to carry out the addition operation. The object that stores the results may be a DM object Or DB object, depending on the units in which the result are required.

The display should be in the format of feet inches or meter and centimetres depend on the object on display.

8 Define a class string that could work as a user defined string type. Include constructors dynamically that will enable to input a string from keyboard and to initialize an object with a string constant at the time of creation like string s2(“3rd year”). Also include a

member function that adds two strings to make a third string. Write a complete program to implement this class.

 

9 Create a class called COMPLEX that has two private data called real and imaginary.

Include member function to add two complex objects using operator overloading.

10 Create a class float that contains one float data number. Overload all the four arithmetic operators for two objects.
11 Write a complete C++ program that computes the result of 10 students. In your program you must have two private data members say name and roll. In your program you also have two public member function say getdata() and showdata() and one public data member say marks. You have to calculate the result based upon the marks.
12 Given the following base class :
class area_cl
{
public:
double height; double width;
};
 
Create two derived classes called rectangle and isosceles that inherit area_cl. Have each class include a function area () that returns the area of a rectangle isosceles triangle, as appropriate. Use parameterized constructors to initialize height and width. Write the complete program.
13 Create a class that has two data members for account number and balance. It has two member functions to input data and display it. Also include a member function to transfer money from one account to another. Write the complete C++ program to implement this.
14 Create an abstract base class called shape. Derive class rectangle from the base class
shape and a class cube from the rectangle class.
Data members :   Length, width for class rectangleHeight for class cube
Member function : Area(), print() for class rectangle
Volume(), print() for class cube
Make function print() as virtual and declare as a pure virtual function in the base class. Write a main program to compute the area of rectangle and volume of cube and display the result using base class pointer.
15 Write a C++ program to append/copy the contents of one file to another.
16 Write a C++ program to read two files simultaneously.
17 Write a C++ program to perform the deletion of white spaces such as horizontal tab,
vertical tab, space, line feed, new line and carriage return from a text file and to store the contents of the file without white spaces on another file.

 

Constructor in derived class

/* Constructor in derived class */
#include<iostream>
using namespace std;
class Alpha{
int x;
public:
Alpha(){ x = 0; }
Alpha(int i){ x = i; }
void show_x(){
cout<<“X=”<<x<<endl;
}
};
class Beta{
float p,q;
public:
Beta(){
p = 0.0; q = 0.0;
}
Beta(float a, float b){
p =a; q = b;
}
void show_pq(){
cout<<“P=”<<p<<endl;
cout<<“Q=”<<q<<endl;
}
};
class Gamma: public Beta, public Alpha{
int z;
public:
Gamma(){ z = 0; }
Gamma(int a, float b, float c, int d):
Alpha(a), Beta(b,c){
z = d;
}
void show(){
show_x();
show_pq();
cout<<“Z=”<<z<<endl;
}
};
int main(){
Gamma g2;
Gamma g1(1,2,3,4);
g1.show();
return 0;
}

IPv4 Classes

Class A
IP Range: 1.0.0.0 to 127.0.0.0 (Public)
IP Range: 10.0.0.0 to 10.255.255.255 (Private)
First octet value range from 1 to 127 , Where first bit is 0.
Subnet Mask: 255.0.0.0 (8 bits)
Number of Networks: 126 (first octet 7 bit)
Number of Hosts per Network: 16,777,214 (~17 million) (last 3 octets)

Class B
IP Range: 128.0.0.0 to 191.255.0.0 (Public)
IP Range: 172.16.0.0 to 172.31.255.255 (Private)
First octet value range from 128 to 191, Where first two bits are 10
Subnet Mask: 255.255.0.0 (16 bits)
Number of Networks: 16,382
Number of Hosts per Network: 65,534

Class C
IP Range: 192.0.0.0 to 223.255.255.0 (Public)
IP Range: 192.168.0.0 to 192.168.255.255 (Private)
First octet value range from 192 to 223, Where first three bits are 110
Special IP Range: 127.0.0.1 to 127.255.255.255
Subnet Mask: 255.255.255.0 (24 bits)
Number of Networks: 2,097,150
Number of Hosts per Network: 254

Class D
Range: 224.0.0.0 to 239.255.255.255
First octet value range from 224 to 239
Number of Networks: N/A
Number of Hosts per Network: Multicasting (used for audio/video straming)
Class E IP Address Class
Range: 240.0.0.0 to 255.255.255.255
First octet value range from 240 to 255
Number of Networks: N/A
Number of Hosts per Network: Research/Reserved/Experimental

Multiple constructor and friend function in CPP program.

#include<iostream>
using namespace std;
class Complex{
float x,y;
public:
Complex(){ //default constructor
//cout<<“Default constructor called!”<<endl;
x = 0; y = 0;
}
Complex(float a){ // Argument constructor, constructor overloading
//cout<<“Arg1 constructor called!”<<endl;
x = y = a;
}
Complex(float real, float imag){
//cout<<“Arg2 constructor called!”<<endl;
x = real; y = imag;
}
friend Complex sum(Complex, Complex);
friend void show(Complex);
~Complex(){
//cout<<“Destructor called!”<<endl;
}
};
void show(Complex c){
cout<<c.x<<“+”<<c.y<<“i”<<endl;
}
Complex sum(Complex a, Complex b){
Complex t;
t.x = a.x + b.x;
t.y = a.y + b.y;
return t;
}
int main(){
Complex c1, c2(10), c3(5,6);
show(c1);
show(c2);
show(c3);
cout<<“Sum of 2 Complex:”<<endl;
c1 = sum(c2,c3);
show(c1);
return 0;
}

Note:
In this program Complex indicates complex numbers (x + yi) where a and b r two numbers. x is real part and y is imaginary part of that number. We use multiple constructor (overloading) to create complex object. Also used friend function to add and show complex numbers.

 

BBA520125-E-Commerce Syllabus

Course Title : E-Commerce
Course Code: 520125

  1. Understanding E-commerce: Meaning of E-commerce & E-Business. Origins and Growth of E-commerce. History of E-commerce. Why Study E-commerce? Unique Features of Ecommerce Technology, Types of E-commerce, Growth of the Internet, Web, and Mobile Platform. E-Commerce Business Model and Concepts.
  2. Infrastructure for E-Commerce: The Internet, The Evolution of the Internet, The Internet Today The Future Internet Infrastructure, Limitations of the Current Internet. The Web, The Internet and the Web, Mobile Apps.
  3. Building an E-Commerce Perspective: Imagine Your E-commerce Presence, Building an Ecommerce Presence, Choosing Software and Hardware, Other E-Commerce Site Tools, Developing a Mobile Web Site and Building Mobile Applications.
  4. E-commerce Security and Payment Systems: The E-commerce Security Environment, Security Threats in the E-commerce Environment, Technology Solutions, Management Policies, Business Procedures, and Public Laws, E-commerce Payment Systems, Online Credit Card Transactions Credit Card E-commerce Enablers, Mobile Payment Systems, Digital Cash and Virtual Currencies, Electronic Billing Presentment and Payment.
  5. E- Commerce Marketing: Consumers Online, The Internet Audience and Consumer Behavior, Consumer Behavior Models, The Online Purchasing Decision, Digital Commerce Marketing and Advertising Strategies and Tools, The Web Site as a Marketing Platform: Establishing the Customer Relationship, Traditional Online Marketing and Advertising Tools, Search Engine Marketing and Advertising, Display Ad Marketing, E-mail Marketing, Affiliate Marketing, Viral Marketing, Lead Generation Marketing, Social, Mobile, and Local Marketing and Advertising, Multi-Channel Marketing: Integrating Online and Offline Marketing, Other Online Marketing Strategies, Customer Retention Strategies, Pricing Strategies, Long Tail Marketing, Internet Marketing Technologies, The Revolution in Internet Marketing Technologies, Customer Relationship Management (CRM) Systems, Understanding the Costs and Benefits of Online Marketing Communications, Online Marketing Metrics, How Well Does Online Advertising Work? The Costs of Online Advertising,
  6. Mobile Marketing: M-commerce Today, How People Actually Use Mobile Devices, In-App Experiences and In-App Ads, How the Multi-Screen Environment Changes the Marketing Funnel, Are Mobile Devices a Good Marketing Platform? Basic Mobile Marketing Features, The Technology: Basic Mobile Device Features, Mobile Marketing Tools: Ad Formats, Starting a Mobile Marketing Campaign, Insight on Business: Mobile Marketing: Land Rover Seeks Engagement on the Small Screen, Measuring Mobile Marketing Results. Local and Location-Based Marketing, The Growth of Local Mobile Marketing, The Growth of Location-Based Mobile Marketing, Location-Based Marketing Platforms, Location-Based Mobile Marketing: The Technologies, Why Is Local Mobile Attractive to Marketers? Location-Based Marketing Tools, A New Lexicon: Location-Based Digital Marketing Features, Local Marketing Ad Formats, Starting a Location-Based Marketing Campaign, Measuring Location-Based Marketing Results.
  7. Introduction to Social Media Marketing: Social Media Marketing, Social Media Marketing Players, The Social Media Marketing Process, Face book and Twitter Marketing

Recommended Books:

  1. David Chaffey, (2014).E-Business and E-Commerce Management 6th Edition, Pearson.
  2. Kenneth C. Laudon & Carol Guercio Traver, (2015.)E-Commerce, 11th Edition, Pearson.