Forwarded from تجمع بؤساء الهندسة²⁴⁻²³
Creat a class with name students this class sould inherit the students name and three data members (opp,math,English) from a class called subject which has a method to calculate the sum of the students degrees further the derivied class can acess a method student to calculate the students average in class called student average.
❤2
Forwarded from تجمع بؤساء الهندسة²⁴⁻²³
تجمع بؤساء الهندسة²⁴⁻²³
Creat a class with name students this class sould inherit the students name and three data members (opp,math,English) from a class called subject which has a method to calculate the sum of the students degrees further the derivied class can acess a method…
حل السؤال بالصيغة الصحيحة :
#include <iostream>
using namespace std;
class subjects
{
protected:
string name;
int oop;
int math;
int english;
public:
subjects(string name,int oop ,int math,int english){
this->name=name;
this->oop=oop;
this->math=math;
this->english=english;
}
int sum()
{
return oop + math + english;
}
};
class studentavrage{
public:
void avrage(double s){
cout << "Average: " <<s/3 << endl;
}
};
class student:public subjects,public studentavrage{
public:
student(string name,int oop,int math,int english):subjects(name,oop,math,english){}
};
int main() {
student s1("yas",90,77,56);
double a= s1.sum();
s1.avrage(a);
return 0;
}
❤1👍1
Forwarded from تجمع بؤساء الهندسة²⁴⁻²³
تجمع بؤساء الهندسة²⁴⁻²³
Creat a class with name students this class sould inherit the students name and three data members (opp,math,English) from a class called subject which has a method to calculate the sum of the students degrees further the derivied class can acess a method…
ركزلي على التخطيط الي فوگ المساحة🟩 والأقلام
❤1
Forwarded from تجمع بؤساء الهندسة²⁴⁻²³
تجمع بؤساء الهندسة²⁴⁻²³
OOP Examples.pdf
هذا ملف للهياكل يتضمن افكار
مو كل الافكار اخذناهن
اقرأ الكود و فقط الي ضمن مادتنا طبقه
مو كل الافكار اخذناهن
اقرأ الكود و فقط الي ضمن مادتنا طبقه
❤1
Forwarded from البرمجة💻 (ɴᴏᴏʀ ᴍᴏʜᴀᴍᴍᴇᴅ)
Programiz
C++ Examples | Programiz
This page contains examples of basic concepts of Python programming like loops, functions, native datatypes and so on.
❤1
Forwarded from تجمع بؤساء الهندسة²⁴⁻²³
البرمجة💻
https://www.programiz.com/cpp-programming/examples
هذا رابط ل63 سؤال
بداخله اسئلة عن البوينتر/رفرنس/ستركتر
https://t.me/no_zero_any_more/713
هنا بعض الأكواد والافكار وان كانت بسيطة حاول تصعبها مثلا سويها كلاس او طورها وهيج أمور
https://t.me/no_zero_any_more/1120
وهذا الملف👆
بداخله اسئلة عن البوينتر/رفرنس/ستركتر
https://t.me/no_zero_any_more/713
هنا بعض الأكواد والافكار وان كانت بسيطة حاول تصعبها مثلا سويها كلاس او طورها وهيج أمور
https://t.me/no_zero_any_more/1120
وهذا الملف👆
❤1
Forwarded from تجمع بؤساء الهندسة²⁴⁻²³
تجمع بؤساء الهندسة²⁴⁻²³
declare a struct called personweight with a member variables name and weight. the struct should have an implementation to print a message " person-name you are overweight " if the person's weight is over 75kg, otherwise print a message " person-name you are…
هذا الكوز بصيغة Class الي طبقها دكتور ضياء خلال المحاضرة :
#include <iostream>
using namespace std;
class personweight {
public :
string name;
float weight;
string gender;
void printStatus() {
if ( (weight > 80 && gender == "male") || (weight > 65 && gender == "female") ) {
cout << name << " you are overweight" << endl;
} else {
cout << name << " you are fit" << endl;
}
}
};
int main() {
personweight person1 = {"am_kean", 56, "female"};
personweight person2 = {"abo_kean", 89, "male"};
person1.printStatus();
person2.printStatus();
return 0;
}
❤1
Forwarded from تجمع بؤساء الهندسة²⁴⁻²³
CoE_123_Object_oriented_programming_Exercises_Students_version.pdf
1 MB
تمارين برمجة
من دكتور ضياء
من دكتور ضياء
❤1🍓1
Ex1 :
Design a health care application to check the blood pressure of a patients. The application has a struct called patientPressure with a member variable (name, age, gender). Implement a method to issue the following message:
1- “name your blood pressure is high” if the systolic blood pressure is over 120mm Hg.
2- “name your blood pressure is normal” if the systolic blood pressure is between (100-120) mm Hg.
3- “name your blood pressure is low” if the systolic blood pressure is less 100 mm Hg.
Note: Instantiate an object called patient of type patientPressure.
Design a health care application to check the blood pressure of a patients. The application has a struct called patientPressure with a member variable (name, age, gender). Implement a method to issue the following message:
1- “name your blood pressure is high” if the systolic blood pressure is over 120mm Hg.
2- “name your blood pressure is normal” if the systolic blood pressure is between (100-120) mm Hg.
3- “name your blood pressure is low” if the systolic blood pressure is less 100 mm Hg.
Note: Instantiate an object called patient of type patientPressure.
#include <iostream>
using namespace std;
struct patientPressure {
string name;
int age;
string gender;
void issue(int pressure) {
if(pressure > 120) {
cout<< name << " your blood pressure is high " << endl;
}
if(pressure >= 100 && pressure <= 120) {
cout<< name << " your blood pressure is normal " << endl;
}
if(pressure < 100) {
cout<< name << " your blood pressure is low " << endl;
}
}
};
int main()
{
patientPressure patient1 = {"salam", 34, "male"};
patient1.issue(110);
return 0;
}
❤5✍1👍1
EX2 :
A health care application, that specializes in tracking the weight of persons, has a class called personWeight with three variables (name, gender, and weight). Implement a method to give an appropriate message according to the following conditions:
1- “name you are overweight” if the person is male and his weight more than 80 kg else “you
are fit”.
2- “name you are overweight” if the person is female and his weight more than 60 kg else
“you are fit”.
Note: Instantiate an object called person of type personWeight. Use constructor to initialize the variables.
A health care application, that specializes in tracking the weight of persons, has a class called personWeight with three variables (name, gender, and weight). Implement a method to give an appropriate message according to the following conditions:
1- “name you are overweight” if the person is male and his weight more than 80 kg else “you
are fit”.
2- “name you are overweight” if the person is female and his weight more than 60 kg else
“you are fit”.
Note: Instantiate an object called person of type personWeight. Use constructor to initialize the variables.
#include <iostream>
using namespace std;
class personweight {
protected :
string name;
float weight;
string gender;
public :
personweight ( string n, float w, string g ) {
name = n;
weight = w;
gender = g;
}
void printStatus() {
if ( (weight > 80 && gender == "male") || (weight > 60 && gender == "female") ) {
cout << name << " you are overweight" << endl;
} else {
cout << name << " you are fit" << endl;
}
}
};
int main() {
personweight person1 = {"am_kean", 56, "female"};
personweight person2 = {"abo_kean", 89, "male"};
person1.printStatus();
person2.printStatus();
return 0;
}
👍8
EX3 :
A health care application, that specializes in tracking the weight of persons, has a class called personWeight with three variables (name, gender, and weight). Implement a method to give an appropriate message according the following conditions:
1- “name you are overweight” if the person is male and his weight more than 80 kg else “you
are fit”.
2- “name you are overweight” if the person is female and his weight more than 60 kg else
“you are fit”.
Note: Instantiate an object called person of type personWeight. Use setter function to initialize the variables
A health care application, that specializes in tracking the weight of persons, has a class called personWeight with three variables (name, gender, and weight). Implement a method to give an appropriate message according the following conditions:
1- “name you are overweight” if the person is male and his weight more than 80 kg else “you
are fit”.
2- “name you are overweight” if the person is female and his weight more than 60 kg else
“you are fit”.
Note: Instantiate an object called person of type personWeight. Use setter function to initialize the variables
#include <iostream>
using namespace std;
class personweight {
protected :
string name;
float weight;
string gender;
public :
void setinf( string n, float w, string g ) {
name = n;
weight = w;
gender = g;
}
void printStatus() {
if ( (weight > 80 && gender == "male") || (weight > 60 && gender == "female") ) {
cout << name << " you are overweight" << endl;
} else {
cout << name << " you are fit" << endl;
}
}
};
int main() {
personweight person1;
person1.setinf ("am_kean", 56, "female");
personweight person2;
person2.setinf ("abo_kean", 89, "male");
person1.printStatus();
person2.printStatus();
return 0;
}
👍5❤2
Ex4 :
Create a class for a bank_account that includes the account_holder's_name, account_number, and balance. Implement member functions for deposit (as member inside the class), withdrawal (as member outside the class), and displaying (as a void friend function) the current balance. Instantiate an object called client of type bank_account. Use constructor to initialize the variables.
Create a class for a bank_account that includes the account_holder's_name, account_number, and balance. Implement member functions for deposit (as member inside the class), withdrawal (as member outside the class), and displaying (as a void friend function) the current balance. Instantiate an object called client of type bank_account. Use constructor to initialize the variables.
#include <iostream>
using namespace std;
class bank {
private :
string AccountHolderName;
int AccountNumber;
double balance;
public:
bank ( string AH, int AN, double B) {
AccountHolderName = AH;
AccountNumber = AN;
balance = B;
}
void deposit (double amount) {
balance += amount;
}
void withDrawal(double amount);
friend void display (bank bank);
};
void bank::withDrawal(double amount) {
balance -= amount;
}
void display (bank bank) {
cout << "your balance is : " << bank.balance << endl;
};
int main()
{
bank client = {"mogo", 78904, 1090};
client.deposit(24.5);
client.withDrawal(9.5);
display(client);
return 0;
}
❤8👍5
Ex5 :
Create a class for a bank_account that includes the account_holder's_name, account_number, and balance. Implement member functions for deposit (as member inside the class), withdrawal (as member outside the class), and displaying (as a void friend function) the current balance. Instantiate an object called client of type bank_account. Implement setter function to initialize the variables.
Create a class for a bank_account that includes the account_holder's_name, account_number, and balance. Implement member functions for deposit (as member inside the class), withdrawal (as member outside the class), and displaying (as a void friend function) the current balance. Instantiate an object called client of type bank_account. Implement setter function to initialize the variables.
#include <iostream>
using namespace std;
class bank {
protected :
string AccountHolderName;
int AccountNumber;
double balance;
public :
void setinf ( string AH, int AN, double B) {
AccountHolderName = AH;
AccountNumber = AN;
balance = B;
}
void deposit (double amount) {
balance += amount;
}
void withDrawal(double amount);
friend void display (bank bank);
};
void bank::withDrawal(double amount) {
balance -= amount;
}
void display (bank bank) {
cout << "your balance is : " << bank.balance << endl;
};
int main()
{
bank client;
client.setinf("mogo", 78904, 1090);
client.deposit(24.5);
client.withDrawal(9.5);
display(client);
return 0;
}
👍3❤2
Ex6 :
Create a class for a bank_account that includes the account_holder's_name, account_number, and balance. Implement member functions for deposit (as member inside the class), withdrawal (as member outside the class), and displaying (as a void friend function) the current balance. Instantiate an object called client of type bank_account. Declare a pointer to invoke the functions.
Create a class for a bank_account that includes the account_holder's_name, account_number, and balance. Implement member functions for deposit (as member inside the class), withdrawal (as member outside the class), and displaying (as a void friend function) the current balance. Instantiate an object called client of type bank_account. Declare a pointer to invoke the functions.
#include <iostream>
using namespace std;
class Bank {
protected :
string AccountHolderName;
int AccountNumber;
double balance;
public :
Bank (string AHN, int AN, double B) {
AccountHolderName = AHN;
AccountNumber = AN;
balance = B;
}
void deposit(double amount) {
balance += amount;
}
void withdrawal(double amount);
friend void display(Bank Bank);
};
void Bank::withdrawal (double amount) {
balance -= amount;
}
void display(Bank Bank) {
cout << " AccountHolderName : " << Bank.AccountHolderName << ", AccountNumber : " << Bank.AccountNumber << " , balance : " << Bank.balance << endl;
}
int main()
{
Bank client = {"mogo", 98056, 70.53};
Bank* ptr = &client;
ptr -> deposit(15.22);
ptr -> withdrawal(13.45);
display(*ptr);
return 0;
}
👍3❤2
Ex10 :
Design an application to calculate the area of any rectangle shape. The application should contain a class called Shape with two variables (length, width). Then generate a class with name (Rectangle) that publicly inherits the attributes of the other class, and has a method to calculate the area of any rectangle. Instantiate an object called Rect of type Shape. Use an appropriate setter function to initialize the variable.
Design an application to calculate the area of any rectangle shape. The application should contain a class called Shape with two variables (length, width). Then generate a class with name (Rectangle) that publicly inherits the attributes of the other class, and has a method to calculate the area of any rectangle. Instantiate an object called Rect of type Shape. Use an appropriate setter function to initialize the variable.
#include <iostream>
using namespace std;
class Shape {
protected :
double length;
double width;
public :
void setDim(double l, double w) {
length = l;
width = w;
}
};
class Rectangle : public Shape {
public:
double getArea() {
return ( length * width);
}
};
int main()
{
Rectangle Rect;
Rect.setDim (9.5, 3.6);
cout << Rect.getArea() << endl;
return 0;
}
👍3❤1🎄1
Ex11 :
Design an application to calculate the area of any rectangle shape. The application should contain a class called Shape with two variables (length, width). Then generate a class with name (Rectangle) that privately inherits the attributes of the other class, and has a method to calculate and display the area of any rectangle. Instantiate an object called Rect of type Shape. Use constructor to initialize the variable.
Design an application to calculate the area of any rectangle shape. The application should contain a class called Shape with two variables (length, width). Then generate a class with name (Rectangle) that privately inherits the attributes of the other class, and has a method to calculate and display the area of any rectangle. Instantiate an object called Rect of type Shape. Use constructor to initialize the variable.
#include <iostream>
using namespace std;
class Shape {
protected :
double length;
double width;
public :
Shape (double l, double w) {
length = l;
width = w;
}
};
class Rectangle : private Shape {
public :
Rectangle (double l, double w) : Shape (l, w) {}
double getArea() {
return length * width;
}
void display() {
cout << getArea() << endl;
}
};
int main()
{
Rectangle Rect = {9.2, 4.7};
Rect.display();
return 0;
}
❤3🥱2