عرض مشاركة واحدة
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 17-11-2011, 04:16 PM   #35

Prince soma

Super Hussam

الصورة الرمزية Prince soma

 
تاريخ التسجيل: Sep 2011
التخصص: IT
نوع الدراسة: إنتظام
المستوى: الرابع
الجنس: ذكر
المشاركات: 266
افتراضي رد: Cpcs 202 شروحات وحلول وواجبات الجافا

وهذا حل البروجيكت حقي

كود 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 >= && 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 >= && 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 >= && TotalConsumption 10000 )
                    
RatePerUnit =26;}
         
          if (
Service ==4){
              if(
TotalConsumption >= && 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 >= && 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 >= && TotalConsumption 10000 )
                    
RatePerUnit =12;}
          
           if (
Service ==7){
               if(
TotalConsumption >= && 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);
      
        
    }

و ملف البروجيكت في المرفقات
الملفات المرفقة
نوع الملف: doc Project_one_CPCS202.doc‏ (67.0 كيلوبايت, المشاهدات 59)
نصائح مهمة : 1 - إفحص الملف المرفق بأي برنامج مضاد للفيروسات
2 - قم بمراسلة الإدارة عن أي مرفق يوجد به فيروس
3 - المنتدى غير مسوؤل عن مايحتويه المرفق من بيانات

 

Prince soma غير متواجد حالياً   رد مع اقتباس