Welcome to my programming section of my web page
This section shows all my web pages that i worked on
You are welcome to visit this section every once in awhile to see new updates in my programming
C L I C K
Encryption programm using cypher method
C#
Type:
namespace MyProject; class Program { static void Main(string [] args) { int shift = 3; Console.WriteLine("type: 1 for encryption or type: 2 for descryption"); int opt = int.Parse(Console.ReadLine()); if (opt == 1) {string plainText = Convert.ToString(Console.ReadLine()); string cipherText = Encrypt(plainText, shift); Console.WriteLine(cipherText); Console.ReadKey(); } else if (opt == 2) { string cipherText = Convert.ToString(Console.ReadLine()); string descryptedText =Descrypt (cipherText, shift); Console.WriteLine(descryptedText); Console.ReadKey(); } else Console.WriteLine(opt + " is not an option"); Console.ReadKey(); } static string Encrypt(string plainText, int shift) { string cipherText = "" ; foreach (char c in plainText) { if (char.IsLetter(c)) { char lowerC = char.ToLower(c); char shifted = (char)(((lowerC + shift - 'a') % 26) + 'a'); cipherText += shifted; }else { cipherText += c; } } return cipherText; } static string Descrypt(string cipherText, int shift) { string plainText = ""; foreach (char c in cipherText) { if (char.IsLetter(c)) { char lowerC = char.ToLower(c); char shifted = (char)(((lowerC - shift - 'a' + 26) % 26) + 'a'); plainText += shifted; }else { plainText += c; } } return plainText; } }
Encryption programm using cypher method
C#
Type:
using Programm; using static System.Net.Mime.MediaTypeNames; namespace MyProject; class Programm { static void Main(string[] args) { double sumOFmoney = 0; double sumOfMalfunctionDamage = 0; double DS = 0 ; double CS = 0 ; Console.WriteLine("Welcome to our company travel system"); Console.WriteLine("Please enter the number of cash bill trips between 2023/11/1 and 2023/11/30"); int cashTrips = int.Parse(Console.ReadLine()); for (int i = 0; i < 10; i++) { if (cashTrips > 30 || cashTrips < 0) { Console.WriteLine("The number you enterd is not correct please try again"); cashTrips = int.Parse(Console.ReadLine()); } else if(cashTrips == 0) { break; }; }; Listcash_Bills = new List (); for (int i = 0; i < cashTrips; i++) { Console.WriteLine("Please enter the bill number"); int BN = int.Parse(Console.ReadLine()); Console.WriteLine("Please enter the bill date .Only enter the(day)"); int BD = int.Parse(Console.ReadLine()); for (int j = 0; i < 10; i++) { if (BD > 30 || BD <= 0) { Console.WriteLine("Sorry not a valid date try again"); BD = int.Parse(Console.ReadLine()); }else { break; }; } Console.WriteLine("Please enter the car number"); int Cn = int.Parse(Console.ReadLine()); Console.WriteLine("Please enter the driver name"); string DN = Console.ReadLine(); Console.WriteLine("Please enter the driver share between 1-0"); DS = double.Parse(Console.ReadLine()); Console.WriteLine("Please enter the company share between 1-0"); CS = double.Parse(Console.ReadLine()); /*cheking for valid shares for both the company and the driver*/ check(DS, CS); /*End of check*/ Console.WriteLine("Please enter the weight in (KG)"); double W = double.Parse(Console.ReadLine()); Console.WriteLine("Please enter the distance in (KM)"); double D = double.Parse(Console.ReadLine()); Console.WriteLine("Please enter the price of one KM"); double OKP = double.Parse(Console.ReadLine()); Console.WriteLine("The Final cost of your trip is : "); cash_Bills.Add(new Cach_Bill(BN, BD, Cn, DN, DS, CS, W, D, OKP, Cach_Bill.Full_Prices(OKP, W, D, 0))); Console.WriteLine(Cach_Bill.Full_Prices(OKP, W, D, 0)); sumOFmoney = sumOFmoney + Cach_Bill.Full_Prices(OKP, W, D, 0); Console.WriteLine(); } Console.WriteLine("Please enter the number of forward bill trips between 2023/11/1 and 2023/11/30"); int forwardTrips = int.Parse(Console.ReadLine()); for (int i = 0; i < 10; i++) { if (forwardTrips > 30 || forwardTrips < 0) { Console.WriteLine("The number you enterd is not correct please try again"); forwardTrips = int.Parse(Console.ReadLine()); } else if(forwardTrips == 0) { break; }; }; List forward_Bills = new List (); for (int i = 0; i < forwardTrips; i++) { Console.WriteLine("Please enter the bill number"); int BN = int.Parse(Console.ReadLine()); Console.WriteLine("Please enter the bill date .Only enter the(day)"); int BD = int.Parse(Console.ReadLine()); for (int j = 0; i < 10; i++) { if (BD > 30 || BD <= 0) { Console.WriteLine("Sorry not a valid date try again"); BD = int.Parse(Console.ReadLine()); } else { break; }; } Console.WriteLine("Please enter the car number"); int Cn = int.Parse(Console.ReadLine()); Console.WriteLine("Please enter the driver name"); string DN = Console.ReadLine(); Console.WriteLine("Please enter the driver share between 1-0"); DS = double.Parse(Console.ReadLine()); Console.WriteLine("Please enter the company share between 1-0"); CS = double.Parse(Console.ReadLine()); /*cheking for valid shares for both the company and the driver*/ check(DS,CS); Console.WriteLine("Please enter the weight in (KG)"); double W = double.Parse(Console.ReadLine()); Console.WriteLine("Please enter the distance in (KM)"); double D = double.Parse(Console.ReadLine()); Console.WriteLine("Please enter the price of one KM"); double OKP = double.Parse(Console.ReadLine()); Console.WriteLine("Please enter the customer name"); string CN = Console.ReadLine(); Console.WriteLine("The cost of your trip before discount is : "); Console.WriteLine(Cach_Bill.Full_Prices(OKP, W, D, 0)); Console.WriteLine("Please enter the amount of discount .between 1-0"); double discount = double.Parse(Console.ReadLine()); for (int j = 0; j < 10; j++) { if (discount > 1 || discount <= 0) { Console.WriteLine("Sorry not a valid discount value try again"); discount = double.Parse(Console.ReadLine()); } else { break; }; } if (forwardTrips == 2) { discount = discount + 0.1; }else if(forwardTrips == 3 ) { discount = discount + 0.15; }else if(forwardTrips > 3) { discount = discount + 0.2; } forward_Bills.Add(new Forward_Bill(BN, BD, Cn, DN, DS, CS, W, D, OKP, Cach_Bill.Full_Prices(OKP, W, D, 0), CN, 0, Forward_Bill.DiscountFunction(forwardTrips, Cach_Bill.Full_Prices(OKP, W, D, 0),discount))); Console.WriteLine("The Final cost of your trip is : "); Console.WriteLine(Forward_Bill.DiscountFunction(forwardTrips,Cach_Bill.Full_Prices(OKP,W,D,0), discount)); sumOFmoney = sumOFmoney + Forward_Bill.DiscountFunction(forwardTrips, Cach_Bill.Full_Prices(OKP, W, D, 0), discount); Console.WriteLine(); } Console.WriteLine("Please Enter the number of extra payments receipts between 2023/11/1 and 2023/11/30"); int receipts = int.Parse(Console.ReadLine()); for (int i = 0; i < 10; i++) { if (receipts > 30 || receipts < 0) { Console.WriteLine("The number you enterd is not correct please try again"); receipts = int.Parse(Console.ReadLine()); } else if(receipts == 0) { break; }; }; List list = new List (); for (int i = 0; i < receipts; i++) { Console.WriteLine("Please enter the receipt number"); int RN = int.Parse(Console.ReadLine()); Console.WriteLine("Please enter the receipt date"); int RD = int.Parse(Console.ReadLine()); for (int j = 0; i < 10; i++) { if (RD > 30 || RD <= 0) { Console.WriteLine("Sorry not a valid date try again"); RD = int.Parse(Console.ReadLine()); } else { break; }; } Console.WriteLine("Please enter the receipt value"); double RV = double.Parse(Console.ReadLine()); sumOfMalfunctionDamage = sumOfMalfunctionDamage + RV; Console.WriteLine("Please enter the receipt cause"); string RC = Console.ReadLine(); Console.WriteLine(); } Console.WriteLine("The total of company share is : "); Console.WriteLine(sumOFmoney * (1 - DS)); Console.WriteLine(); Console.WriteLine("The total of drivers share is : "); Console.WriteLine(sumOFmoney * (1 - CS)); Console.WriteLine(); Console.WriteLine("The company profit is :"); Console.WriteLine((sumOFmoney * (1 - DS) - sumOfMalfunctionDamage)); Console.ReadKey(); } public static (double,double) check(double DS,double CS) { for (int k = 0; k < 10; k++) { for (int j = 0; j < 10; j++) { if (DS > 1 || DS <= 0) { Console.WriteLine("Sorry not a valid driver share try again"); DS = double.Parse(Console.ReadLine()); } else { break; }; } for (int a = 0; a < 10; a++) { if (CS > 1 || CS <= 0) { Console.WriteLine("Sorry not a valid company share try again"); CS = double.Parse(Console.ReadLine()); } else { break; }; } if (DS + CS == 1) { break; } else { Console.WriteLine("Your inserted Shares does not add up to 1 ,You need to try again"); Console.WriteLine("Please enter the driver share between 1-0"); DS = double.Parse(Console.ReadLine()); Console.WriteLine("Please enter the company share between 1-0"); CS = double.Parse(Console.ReadLine()); } } return (DS , CS) ; } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Programm { internal class Bill { public int billNumber; public int billDate; public int carNumber; public string driverName; public double driverShare; public double companyShare; } public class Cach_Bill { public int billNumber; public int billDate; public int carNumber; public string driverName; public double driverShare; public double companyShare; public double weight; public double distance; public double oneKmPrice; public double fullPrice; public Cach_Bill(int billNumber, int billDate, int carNumber, string driverName, double driverShare, double companyShare, double weight, double distance, double oneKmPrice, double fullPrice) { this.billNumber = billNumber; this.billDate = billDate; this.carNumber = carNumber; this.driverName = driverName; this.driverShare = driverShare; this.companyShare = companyShare; this.weight = weight; this.distance = distance; this.oneKmPrice = oneKmPrice; this.fullPrice = fullPrice; } public static double Full_Prices(double oneKmPrice, double weight, double distance, double fullPrice) { if (distance < 25) { fullPrice = oneKmPrice * 25 ; } if (distance > 25 && distance <= 60) { fullPrice = fullPrice + (10000 * (distance - 25)); if (weight > 1000) { fullPrice = fullPrice + (1000 * (weight - 1000)); } } else if (distance > 60) { fullPrice = fullPrice + (12000 * (distance - 60)); if (weight > 1200) { fullPrice = fullPrice + (1500 * (weight - 1200)); } } return fullPrice; } } publicclass Forward_Bill { public int billNumber; public int billDate; public int carNumber; public string driverName; public double driverShare; public double companyShare; public double weight; public double distance; public double oneKmPrice; public double fullPrice; public string costumerName; public double discount; public double fullDiscount; public Forward_Bill(int billNumber, int billDate, int carNumber, string driverName, double driverShare, double companyShare, double weight, double distance, double oneKmPrice,double fullPrice, string costumerName, double discount, double fullDiscount) { billNumber = billNumber; billDate = billDate; carNumber = carNumber; driverName = driverName; driverShare = driverShare; companyShare = companyShare; weight = weight; distance = distance; oneKmPrice = oneKmPrice; fullPrice = fullPrice; costumerName = costumerName; discount = discount; fullDiscount = fullDiscount; } public static doubleDiscountFunction (double numberOfTrips, double fullPrice,double discount) { if (numberOfTrips == 2) { fullPrice = fullPrice * (1 - discount); } else if (numberOfTrips == 3) { fullPrice = fullPrice * (1 - discount); } else if (numberOfTrips > 3) { fullPrice = fullPrice * (1 - discount); } return fullPrice; } } public class Payment { public int receiptNumber; public int receiptDate; public double receiptValue; public string receiptCause; } }