Skip to content

Commit 7156c75

Browse files
authored
Add files via upload
1 parent bd626f4 commit 7156c75

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1150
-0
lines changed

SET1/Customer/Customer.cbp

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2+
<CodeBlocks_project_file>
3+
<FileVersion major="1" minor="6" />
4+
<Project>
5+
<Option title="Customer" />
6+
<Option pch_mode="2" />
7+
<Option compiler="gcc" />
8+
<Build>
9+
<Target title="Debug">
10+
<Option output="bin/Debug/Customer" prefix_auto="1" extension_auto="1" />
11+
<Option object_output="obj/Debug/" />
12+
<Option type="1" />
13+
<Option compiler="gcc" />
14+
<Compiler>
15+
<Add option="-g" />
16+
</Compiler>
17+
</Target>
18+
<Target title="Release">
19+
<Option output="bin/Release/Customer" prefix_auto="1" extension_auto="1" />
20+
<Option object_output="obj/Release/" />
21+
<Option type="1" />
22+
<Option compiler="gcc" />
23+
<Compiler>
24+
<Add option="-O2" />
25+
</Compiler>
26+
<Linker>
27+
<Add option="-s" />
28+
</Linker>
29+
</Target>
30+
</Build>
31+
<Compiler>
32+
<Add option="-Wall" />
33+
</Compiler>
34+
<Unit filename="Customer.cc" />
35+
<Unit filename="Customer.h" />
36+
<Unit filename="Customer_test.cc" />
37+
<Extensions>
38+
<lib_finder disable_auto="1" />
39+
</Extensions>
40+
</Project>
41+
</CodeBlocks_project_file>

SET1/Customer/Customer.cc

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#include<iostream>
2+
#include "customer.h"
3+
using namespace std;
4+
//std::string name
5+
6+
Customer::Customer() :
7+
m_custId(0), m_phone(0),m_type(0),m_custName(""), m_balance(0) {
8+
}
9+
10+
11+
12+
Customer::Customer(int id,int phone ,int type,std::string name, double bal) :
13+
m_custId(id), m_phone(phone),m_type(type),m_custName(name), m_balance(bal) {
14+
}
15+
16+
17+
18+
Customer::Customer(int id,int phone ,int type) :
19+
m_custId(id), m_phone(phone),m_type(type) {
20+
}
21+
22+
23+
24+
Customer::Customer(const Customer& ref) :
25+
m_custId(ref.m_custId), m_custName(ref.m_custName),
26+
m_balance(ref.m_balance) {
27+
}
28+
29+
30+
void Customer::credit(double amount) {
31+
m_balance += amount;
32+
}
33+
void Customer::makecall(int m_phone) {
34+
cout<<m_phone;;
35+
}
36+
double Customer::getBalance() const {
37+
return m_balance;
38+
}
39+
void Customer::display() {
40+
std::cout << m_custId << "," <<m_phone<<","<<m_type<<","<< m_custName << ","
41+
<< m_balance << "\n";
42+
}
43+

SET1/Customer/Customer.h

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#pragma once
2+
#include<string>
3+
#include "gtest/gtest.h"
4+
//#include<iostream>
5+
using namespace std;
6+
7+
class Customer{
8+
int m_custId, m_phone, m_type;
9+
double m_balance;
10+
std::string m_custName;
11+
12+
public:
13+
Customer();
14+
Customer(int,int,int,string,double);
15+
Customer(int,int,int);
16+
Customer(const Customer &);
17+
void credit(double);
18+
void makecall(int);
19+
double getBalance() const;
20+
void display();
21+
22+
23+
};
24+

SET1/Customer/Customer.layout

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2+
<CodeBlocks_layout_file>
3+
<FileVersion major="1" minor="0" />
4+
<ActiveTarget name="Debug" />
5+
<File name="Customer_test.cc" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
6+
<Cursor>
7+
<Cursor1 position="910" topLine="11" />
8+
</Cursor>
9+
</File>
10+
<File name="Customer.cc" open="1" top="1" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
11+
<Cursor>
12+
<Cursor1 position="590" topLine="16" />
13+
</Cursor>
14+
</File>
15+
<File name="Customer.h" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
16+
<Cursor>
17+
<Cursor1 position="453" topLine="0" />
18+
</Cursor>
19+
</File>
20+
</CodeBlocks_layout_file>

SET1/Customer/Customer_test.cc

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#include "customer.h"
2+
3+
TEST(Customer, DefaultConstructor) {
4+
Customer a1;
5+
EXPECT_EQ(0, a1.getBalance());
6+
}
7+
TEST(Customer, ParameterizedConstructor) {
8+
Customer a1(1001,98765,1,"abc",5000.0);
9+
EXPECT_EQ(5000.0, a1.getBalance());
10+
11+
}
12+
TEST(Customer, CopyConstructor) {
13+
Customer a1(1001,98765,1,"abc",5000.0);
14+
Customer a2(a1);
15+
EXPECT_EQ(5000.0, a2.getBalance());
16+
17+
}
18+
TEST(Customer, CreditTest) {
19+
Customer a1(1001,98765,1,"abc",5000.0);
20+
a1.credit(3000);
21+
EXPECT_EQ(8000.0, a1.getBalance());
22+
23+
}
24+
TEST(Customer, makecallTest) {
25+
Customer a1(1001,98765,1,"abc",5000.0);
26+
a1.makecall(98765);
27+
EXPECT_EQ(5000.0, a1.getBalance());
28+
}
29+
30+
TEST(Customer, displayTest) {
31+
Customer a1(1001,98765,1,"abc",5000.0);
32+
std::string ExpectedOut = "1001,98765,1,abc,5000.0\n";
33+
testing::internal::CaptureStdout();
34+
a1.display();
35+
std::string ActualOut = testing::internal::GetCapturedStdout();
36+
}
37+
38+

SET1/Customer/bin/Debug/Customer.exe

2.05 MB
Binary file not shown.

SET1/Customer/customer.png

82.2 KB
Loading

SET1/Customer/obj/Debug/Customer.o

84.2 KB
Binary file not shown.
408 KB
Binary file not shown.

SET1/IPAddress/IPAddress.cbp

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2+
<CodeBlocks_project_file>
3+
<FileVersion major="1" minor="6" />
4+
<Project>
5+
<Option title="IPAddress" />
6+
<Option pch_mode="2" />
7+
<Option compiler="gcc" />
8+
<Build>
9+
<Target title="Debug">
10+
<Option output="bin/Debug/IPAddress" prefix_auto="1" extension_auto="1" />
11+
<Option object_output="obj/Debug/" />
12+
<Option type="1" />
13+
<Option compiler="gcc" />
14+
<Compiler>
15+
<Add option="-g" />
16+
</Compiler>
17+
</Target>
18+
<Target title="Release">
19+
<Option output="bin/Release/IPAddress" prefix_auto="1" extension_auto="1" />
20+
<Option object_output="obj/Release/" />
21+
<Option type="1" />
22+
<Option compiler="gcc" />
23+
<Compiler>
24+
<Add option="-O2" />
25+
</Compiler>
26+
<Linker>
27+
<Add option="-s" />
28+
</Linker>
29+
</Target>
30+
</Build>
31+
<Compiler>
32+
<Add option="-Wall" />
33+
</Compiler>
34+
<Unit filename="IPAddress.cc" />
35+
<Unit filename="IPAddress.h" />
36+
<Unit filename="IPAddress_test.cc" />
37+
<Extensions>
38+
<lib_finder disable_auto="1" />
39+
</Extensions>
40+
</Project>
41+
</CodeBlocks_project_file>

SET1/IPAddress/IPAddress.cc

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#include<string>
2+
#include<iostream>
3+
#include "ipaddress.h"
4+
using namespace std;
5+
6+
IPAddress::IPAddress(){}
7+
IPAddress::IPAddress(int x[0], int y[1], int z[2], int a[3])
8+
{ipval[0]=x[0]; ipval[1]=y[1]; ipval[2]=z[2]; ipval[3]=a[3];}
9+
10+
IPAddress::IPAddress(int w[4]) {ipval[4]=w[4];}
11+
12+
bool IPAddress::isLoopBack(int x[0], int y[1], int z[2], int a[3])
13+
{
14+
if(x[0]==127 && x[1]==000 && x[2]==000 && x[3]==001)
15+
return true;
16+
else
17+
return false;
18+
}
19+
20+
std::string IPAddress::getIPClass(int x[0])
21+
{
22+
23+
if(x[0]>=0 && x[0]<=127)
24+
cout<<"Class A";
25+
if(x[0]>127 && x[0]<191)
26+
cout<<"Class B";
27+
if(x[0]>191 && x[0]<224)
28+
cout<<"Class C";
29+
if(x[0]>224 && x[0]<=239)
30+
cout<<"Class D";
31+
if(x[0]>239)
32+
cout<<"Class E";
33+
}
34+
35+
/*
36+
int Box::get() {
37+
return m_length;
38+
}
39+
int Box::getBreadth() {
40+
return m_breadth;
41+
}
42+
int Box::getHeight() {
43+
return m_height;
44+
}*/
45+
void IPAddress::display()
46+
{
47+
cout << ipval[0] << "," << ipval[1] << "," << ipval[2] << ","<<ipval[3];
48+
}
49+
50+

SET1/IPAddress/IPAddress.depend

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# depslib dependency file v1.0
2+
1600490380 source:c:\users\training\downloads\set1\ipaddress\ipaddress_test.cc
3+
"ipaddress.h"
4+
<iostream>
5+
<gtest/gtest.h>
6+
7+
1600490383 c:\users\training\downloads\set1\ipaddress\ipaddress.h
8+
<string>
9+

SET1/IPAddress/IPAddress.h

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include<string>
2+
3+
class IPAddress{
4+
private:
5+
int ipval[4];
6+
public:
7+
IPAddress();
8+
IPAddress(int[],int[],int[],int[]);
9+
IPAddress(int[]);
10+
bool isLoopBack(int[],int[],int[],int[]);
11+
std::string getIPClass(int[]);
12+
void display();
13+
};
14+

SET1/IPAddress/IPAddress.layout

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2+
<CodeBlocks_layout_file>
3+
<FileVersion major="1" minor="0" />
4+
<ActiveTarget name="Debug" />
5+
<File name="IPAddress.cc" open="1" top="1" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
6+
<Cursor>
7+
<Cursor1 position="872" topLine="27" />
8+
</Cursor>
9+
</File>
10+
<File name="IPAddress.h" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
11+
<Cursor>
12+
<Cursor1 position="266" topLine="0" />
13+
</Cursor>
14+
</File>
15+
<File name="IPAddress_test.cc" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
16+
<Cursor>
17+
<Cursor1 position="376" topLine="0" />
18+
</Cursor>
19+
</File>
20+
</CodeBlocks_layout_file>

SET1/IPAddress/IPAddress_test.cc

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include "ipaddress.h"
2+
#include<iostream>
3+
#include <gtest/gtest.h>
4+
TEST(IPAddressytug,getIPClass) {
5+
IPAddress I1;
6+
//IPAddress I2(128);
7+
EXPECT_EQ("Class A",I1.getIPClass(000));
8+
//XPECT_EQ(true,I1.isLoopBack(127,000,000,001));
9+
//EXPECT_EQ("Class B",I2.getIPClass(128));
10+
//EXPECT_EQ(0,b1.getBreadth());
11+
//EXPECT_EQ(0,b1.getHeight());
12+
13+
}
14+
1.97 MB
Binary file not shown.

SET1/IPAddress/ip-addr.png

63.9 KB
Loading

SET1/IPAddress/obj/Debug/IPAddress.o

54.3 KB
Binary file not shown.
322 KB
Binary file not shown.

SET1/Point/Point.cbp

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2+
<CodeBlocks_project_file>
3+
<FileVersion major="1" minor="6" />
4+
<Project>
5+
<Option title="Point" />
6+
<Option pch_mode="2" />
7+
<Option compiler="gcc" />
8+
<Build>
9+
<Target title="Debug">
10+
<Option output="bin/Debug/Point" prefix_auto="1" extension_auto="1" />
11+
<Option object_output="obj/Debug/" />
12+
<Option type="1" />
13+
<Option compiler="gcc" />
14+
<Compiler>
15+
<Add option="-g" />
16+
</Compiler>
17+
</Target>
18+
<Target title="Release">
19+
<Option output="bin/Release/Point" prefix_auto="1" extension_auto="1" />
20+
<Option object_output="obj/Release/" />
21+
<Option type="1" />
22+
<Option compiler="gcc" />
23+
<Compiler>
24+
<Add option="-O2" />
25+
</Compiler>
26+
<Linker>
27+
<Add option="-s" />
28+
</Linker>
29+
</Target>
30+
</Build>
31+
<Compiler>
32+
<Add option="-Wall" />
33+
</Compiler>
34+
<Unit filename="Point.cc" />
35+
<Unit filename="Point.h" />
36+
<Unit filename="Point_test.cc" />
37+
<Extensions>
38+
<lib_finder disable_auto="1" />
39+
</Extensions>
40+
</Project>
41+
</CodeBlocks_project_file>

0 commit comments

Comments
 (0)