Skip to content

Webpages last version #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added Reema/Reema/__init__.py
Empty file.
16 changes: 16 additions & 0 deletions Reema/Reema/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for Reema project.

It exposes the ASGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/5.1/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Reema.settings')

application = get_asgi_application()
124 changes: 124 additions & 0 deletions Reema/Reema/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
"""
Django settings for Reema project.

Generated by 'django-admin startproject' using Django 5.1.2.

For more information on this file, see
https://docs.djangoproject.com/en/5.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/5.1/ref/settings/
"""

from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-cscp8n!^-r4%j$^tqngah3e)!%irvm=7inx0l_s30bz77yf0v!'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'Reema_app',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'Reema.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'Reema.wsgi.application'


# Database
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}


# Password validation
# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/5.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.1/howto/static-files/

STATIC_URL = 'static/'

# Default primary key field type
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
7 changes: 7 additions & 0 deletions Reema/Reema/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.contrib import admin
from django.urls import path, include

urlpatterns = [
path('admin/', admin.site.urls),
path('', include('Reema_app.urls', namespace='Reema_app')),
]
16 changes: 16 additions & 0 deletions Reema/Reema/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for Reema project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/5.1/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Reema.settings')

application = get_wsgi_application()
Empty file added Reema/Reema_app/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions Reema/Reema_app/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions Reema/Reema_app/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class ReemaAppConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'Reema_app'
Empty file.
3 changes: 3 additions & 0 deletions Reema/Reema_app/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
Binary file not shown.
Binary file not shown.
Binary file added Reema/Reema_app/static/Tpruple.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 63 additions & 0 deletions Reema/Reema_app/static/Tuwaiq_project1/bank.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import random

class Customer:
def __init__(self, customer_id, age, balance, has_credit_card, is_active_member, estimated_salary):
self.customer_id = customer_id
self.age = age
self.balance = balance
self.has_credit_card = has_credit_card
self.is_active_member = is_active_member
self.estimated_salary = estimated_salary

def predict_churn(self):
"""Predict churn based on customer attributes."""
if self.balance < 5000 and not self.is_active_member:
return True
elif self.age > 60 and self.balance < 10000:
return True
elif self.has_credit_card and self.balance > 20000:
return False
else:
return random.choice([True, False]) # Random prediction for other cases

def get_customer_data():
"""Get customer data from user input."""
customer_data = {}
try:
customer_data['customer_id'] = input("Enter customer ID: ")
customer_data['age'] = int(input("Enter customer age: "))
customer_data['balance'] = float(input("Enter account balance: "))
customer_data['has_credit_card'] = input("Has credit card? (yes/no): ").strip().lower() == 'yes'
customer_data['is_active_member'] = input("Is active member? (yes/no): ").strip().lower() == 'yes'
customer_data['estimated_salary'] = float(input("Enter estimated salary: "))

return customer_data
except ValueError as e:
print(f"Invalid input: {e}")
return None

def main():
"""Main function to run churn prediction."""
customers = []

while True:
customer_data = get_customer_data()
if customer_data is None:
continue

customer = Customer(**customer_data)
churn_prediction = customer.predict_churn()

if churn_prediction:
print(f"Customer {customer.customer_id} is likely to churn.")
else:
print(f"Customer {customer.customer_id} is not likely to churn.")

customers.append(customer)

another = input("Do you want to check another customer? (yes/no): ").strip().lower()
if another != 'yes':
break

if __name__ == "__main__":
main()
68 changes: 68 additions & 0 deletions Reema/Reema_app/static/Tuwaiq_project1/blood.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Blood Bank Management System

class BloodBank:
def __init__(self):
self.donors = {} # Dictionary to store donor information

def add_donor(self, name, blood_type, quantity):
donor_id = len(self.donors) + 1
self.donors[donor_id] = {
'name': name,
'blood_type': blood_type,
'quantity': quantity
}
print(f"Donor {name} added successfully!")

def view_donors(self):
if not self.donors:
print("No donors found.")
else:
for donor_id, details in self.donors.items():
print(f"ID: {donor_id}, Name: {details['name']}, Blood Type: {details['blood_type']}, Quantity: {details['quantity']}")

def search_donor(self, donor_id):
if donor_id in self.donors:
details = self.donors[donor_id]
print(f"ID: {donor_id}, Name: {details['name']}, Blood Type: {details['blood_type']}, Quantity: {details['quantity']}")
else:
print("Donor not found.")

def total_blood_quantity(self):
total = sum(details['quantity'] for details in self.donors.values())
return total

def display_menu():
print("\n--- Blood Bank Management System ---")
print("1. Add Donor")
print("2. View Donors")
print("3. Search Donor")
print("4. Total Blood Quantity")
print("5. Exit")

def main():
blood_bank = BloodBank()
while True:
display_menu()
choice = input("Choose an option (1-5): ")

if choice == '1':
name = input("Enter donor name: ")
blood_type = input("Enter blood type (A, B, AB, O): ")
quantity = float(input("Enter quantity of blood (in liters): "))
blood_bank.add_donor(name, blood_type, quantity)
elif choice == '2':
blood_bank.view_donors()
elif choice == '3':
donor_id = int(input("Enter donor ID to search: "))
blood_bank.search_donor(donor_id)
elif choice == '4':
total_quantity = blood_bank.total_blood_quantity()
print(f"Total blood quantity in the bank: {total_quantity} liters")
elif choice == '5':
print("Exiting the system.")
break
else:
print("Invalid choice. Please try again.")

if __name__ == "__main__":
main()
66 changes: 66 additions & 0 deletions Reema/Reema_app/static/Tuwaiq_project1/employee.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Import necessary modules
import json

# Function to display menu
def display_menu():
print("\n--- Online Employee Recruitment System ---")
print("1. Add Employee")
print("2. View Employees")
print("3. Search Employee")
print("4. Exit")

# Function to add an employee
def add_employee(employees):
name = input("Enter employee name: ")
age = int(input("Enter employee age: "))
position = input("Enter employee position: ")
salary = float(input("Enter employee salary: "))

employee_id = len(employees) + 1
employees[employee_id] = {
'name': name,
'age': age,
'position': position,
'salary': salary
}
print("Employee added successfully!")

# Function to view all employees
def view_employees(employees):
if not employees:
print("No employees found.")
else:
for emp_id, details in employees.items():
print(f"ID: {emp_id}, Name: {details['name']}, Age: {details['age']}, Position: {details['position']}, Salary: {details['salary']}")

# Function to search for an employee
def search_employee(employees):
emp_id = int(input("Enter employee ID to search: "))
if emp_id in employees:
details = employees[emp_id]
print(f"ID: {emp_id}, Name: {details['name']}, Age: {details['age']}, Position: {details['position']}, Salary: {details['salary']}")
else:
print("Employee not found.")

# Main function
def main():
employees = {} # Dictionary to store employee data
while True:
display_menu()
choice = input("Choose an option (1-4): ")

if choice == '1':
add_employee(employees)
elif choice == '2':
view_employees(employees)
elif choice == '3':
search_employee(employees)
elif choice == '4':
print("Exiting the system.")
break
else:
print("Invalid choice. Please try again.")

# Entry point of the program
if __name__ == "__main__":
main()
Loading