وهذا حل البروجيكت حقي
كود PHP:
import java.util.Scanner;
public class Project1 {
public static void main(String[] args) {
double RatePerUnit=0;
Scanner input=new Scanner(System.in);
System.out.println("Enter name of owner Name of Apartment or Flat or Shop: \t");
String Name =input.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 ");
short Service =input.nextShort();
System.out.println("Enter an account Number : \t ");
Long accountNumber = input.nextLong();
System.out.println("Enter a bill Number: \t ");
int billNumber = input.nextInt();
System.out.println("Enter old Meter Reading: \t ");
int oldmeterreading =input.nextInt();
System.out.println("Enter new Meter reading: \t ");
int Newmeterreading =input.nextInt();
if (Newmeterreading < oldmeterreading){
System.out.println("New meter reading cannot be less than old meter reading");
System.out.println("Enter New Meter Reading again:");
Newmeterreading = input.nextInt();}
double TotalConsumption = Newmeterreading-oldmeterreading;
System.out.println("Enter a bill Month: \t ");
String billMonth =input.next();
System.out.println("Enter a unpaid Balance: \t ");
double unpaidbalance =input.nextDouble();
if (unpaidbalance<0){
System.out.println("Unpaid amount cannot be less than zero");
System.out.println("Enter any unpaid balance again:");
unpaidbalance = input.nextDouble();}
System.out.println("Enter an other Charges");
double otherCharges=input.nextDouble();
if (otherCharges<0){
System.out.println("other Charges cannot be less than zero");
System.out.println("Enter any other Charges again:");
otherCharges = input.nextDouble();}
TotalConsumption = Newmeterreading-oldmeterreading;
if (Service ==1){
if(TotalConsumption >= 1 && TotalConsumption <= 2000 )
RatePerUnit =5;
else if(TotalConsumption >= 2001 && TotalConsumption <= 4000 )
RatePerUnit =10;
else if(TotalConsumption >= 4001 && TotalConsumption <= 6000 )
RatePerUnit =12;
else if(TotalConsumption >= 6001 && TotalConsumption <= 7000 )
RatePerUnit =15;
else if(TotalConsumption >= 7001 && TotalConsumption <= 8000 )
RatePerUnit =20;
else if(TotalConsumption >= 8001 && TotalConsumption <= 9000 )
RatePerUnit =22;
else if(TotalConsumption >= 9001 && TotalConsumption <= 10000 )
RatePerUnit =24;
else if(TotalConsumption > 10000 )
RatePerUnit =26;}
if (Service ==2){
if(TotalConsumption >= 1 && TotalConsumption <= 4000 )
RatePerUnit =12;
else if(TotalConsumption >= 4001 && TotalConsumption <= 8000 )
RatePerUnit =20;
else if(TotalConsumption >= 8001 && TotalConsumption > 10000 )
RatePerUnit =26;}
if (Service ==3){
if(TotalConsumption >= 1 && TotalConsumption > 10000 )
RatePerUnit =26;}
if (Service ==4){
if(TotalConsumption >= 1 && TotalConsumption <= 2000 )
RatePerUnit =5;
else if(TotalConsumption >= 2001 && TotalConsumption <= 5000 )
RatePerUnit =10;
else if(TotalConsumption >= 2001 && TotalConsumption <= 4000 )
RatePerUnit =10;
else if(TotalConsumption >= 5001 && TotalConsumption > 10000 )
RatePerUnit =12;}
if (Service ==5){
if(TotalConsumption >= 1 && TotalConsumption <= 2000 )
RatePerUnit =5;
else if(TotalConsumption >= 2001 && TotalConsumption <= 5000 )
RatePerUnit =10;
else if(TotalConsumption >= 2001 && TotalConsumption <= 4000 )
RatePerUnit =10;
else if(TotalConsumption >= 5001 && TotalConsumption > 10000 )
RatePerUnit =12;}
if (Service ==6){
if(TotalConsumption >= 1 && TotalConsumption > 10000 )
RatePerUnit =12;}
if (Service ==7){
if(TotalConsumption >= 1 && TotalConsumption > 10000 )
RatePerUnit =12;}
double TotalBillPayment=(RatePerUnit/100)*TotalConsumption+unpaidbalance+otherCharges;
System.out.println("TotalBillPayment is " + TotalBillPayment );
System.out.println("*");
System.out.println(" Saudi Electricity Company ");
System.out.println(" Bill Number: "+billNumber);
System.out.println("Name: "+Name+" Bill Month: "+billMonth);
System.out.println("Old Meter Reading: "+oldmeterreading+" Current Meter Reading: "+Newmeterreading);
System.out.println("Total Consumption: "+TotalConsumption+" Unit Rate Per Unit:"+RatePerUnit+" Halalah");
System.out.println("Unpaid Amount: "+unpaidbalance+" Other Charges: "+otherCharges);
System.out.println("Total Bill Payment: "+TotalBillPayment+" Total Days: 30");
System.out.println("Note: You have to pay your bill withing 15 days of Bill Month");
System.out.println("*");
System.exit(0);
}
}
و ملف البروجيكت في المرفقات