بناءً على طلب بعض الأعضاء راح أضع حل البروجكت الاول هنا،
أول شيء ملف تفاصيل البروجكت:
http://asifkhan.co.cc/Documents/Project_one_CPCS202.doc
الحل بالتفصيل:
كود PHP:
import java.util.*;
public class ProjectOneCPCS202 {
public static void main(String[] args) {
String Name; // الاسم
short Service; // نوع الخدمة
Long Account; // رقم الحساب
int billNum; // رقم الفاتورة
int OldMtrRdng; // قراءة العداد القديمة
int NewMtrRdng; // قراءة العداد الجديدة
String Month; // الشهر
double unpaid; // المبلغ غير المسدد
double currentblnc; // مجموع المبلغ الحالي
double otherchrgs; // مبالغ أخرى
double Total; // معدل الاستهلاك
double RatePerUnit=0; // معدل التكلفة للوحدة
Scanner in1=new Scanner(System.in);
System.out.println("Enter name of owner Name of Apartment or Flat or Shop:");
Name = in1.nextLine();
System.out.println("Enter (1)for Residential, (2)for Commercial, (3)for Governmental, (4)for Agricultural, (5)for Charities, (6)for Private educational establishments, (7)for Private health establishments");
Service = in1.nextShort();
System.out.println("Enter account Number:");
Account = in1.nextLong();
System.out.println("Enter Bill Number:");
billNum = in1.nextInt();
System.out.println("Enter Old Meter Reading:");
OldMtrRdng = in1.nextInt();
System.out.println("Enter New Meter Reading:");
NewMtrRdng = in1.nextInt();
while (NewMtrRdng < OldMtrRdng){
System.out.println("New meter reading cannot be less than old meter reading");
System.out.println("Enter New Meter Reading again:");
NewMtrRdng = in1.nextInt();}
System.out.println("Enter Bill Month:");
Month = in1.next();
System.out.println("Enter any unpaid balance:");
unpaid = in1.nextDouble();
while (unpaid<0){
System.out.println("Unpaid amount cannot be less than zero");
System.out.println("Enter any unpaid balance again:");
unpaid = in1.nextDouble();}
System.out.println("Enter any other charges:");
otherchrgs = in1.nextDouble();
while (otherchrgs<0){
System.out.println("Other Charges cannot be less than zero");
System.out.println("Enter any other charges again:");
otherchrgs = in1.nextDouble();}
Total = NewMtrRdng-OldMtrRdng;
// Residential Service خدمة سكنية
if (Service==1) {
if (Total >= 1 && Total <=2000)
RatePerUnit=5;
else if (Total >= 2001 && Total <=4000)
RatePerUnit=10;
else if (Total >= 4001 && Total <=6000)
RatePerUnit=12;
else if (Total >= 6001 && Total <=7000)
RatePerUnit=15;
else if (Total >= 7001 && Total <=8000)
RatePerUnit=20;
else if (Total >= 8001 && Total <=9000)
RatePerUnit=22;
else if (Total >= 9001 && Total <=10000)
RatePerUnit=24;
else if (Total > 10000)
RatePerUnit=26; }
// Commercial Service خدمة تجارية
else if (Service==2){
if (Total >= 1 && Total <=4000)
RatePerUnit=12;
else if (Total >= 4001 && Total <=8000)
RatePerUnit=20;
else if (Total >= 8001)
RatePerUnit=26; }
// Governmental Service خدمة حكومية
else if (Service==3) {
if (Total >= 1 )
RatePerUnit=26; }
// Agricultural Service خدمة زراعية
else if (Service==4) {
if (Total >= 1 && Total <=2000)
RatePerUnit=5;
else if (Total >= 2001 && Total <=5000)
RatePerUnit=10;
else if (Total >= 5001)
RatePerUnit=12;}
// Charities Service خدمة خيرية
else if (Service==5) {
if (Total >= 1 && Total <=2000)
RatePerUnit=5;
else if (Total >= 2001 && Total <=5000)
RatePerUnit=10;
else if (Total >= 5001)
RatePerUnit=12;}
// Private Educational Establishments Service خدمة المؤسسات التعليمية الخاصة
else if (Service==6) {
if (Total >= 1)
RatePerUnit=12; }
// Private Health Establishments Service خدمة المؤسسات الصحية الخاصة
else if (Service==7) {
if (Total >= 1)
RatePerUnit=12; }
currentblnc = (RatePerUnit/100)*Total+unpaid+otherchrgs;
// Outputs المخرجات
System.out.println(" Saudi Electricity Company ");
System.out.println(" Bill Number: "+billNum);
System.out.println("Name: "+Name+" Bill Month: "+Month);
System.out.println("Old Meter Reading: "+OldMtrRdng+" Current Meter Reading: "+NewMtrRdng);
System.out.println("Total Consumption: "+Total+" Unit Rate Per Unit:"+RatePerUnit+" Halalah");
System.out.println("Unpaid Amount: "+unpaid+" Other Charges: "+otherchrgs);
System.out.println("Total Bill Payment: "+currentblnc+" Total Days: 30");
System.out.println("Note: You have to pay your bill withing 15 days of Bill Month");
System.exit(0);
إذا كان في نقاط مو واضحة راح أشرحها