Hi Guys,
this is my first post at this great forum
i need help making an electricity bill based on a table i have which is kinda complicated for a java beginner programmer.
here is the project details:
Project_one.doc
and this is what i've done so far:
any ideas on how to let java take a rate between 1-1000 and 1001-2000 and so on ..PHP Code:
import java.util.*;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author deathpa1N
*/
public class Abdulkareem_1113065 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String Name = null;
short Service;
Long Account;
int billNum;
int OldMtrRdng;
int NewMtrRdng;
String Month;
double unpaid;
double currentblnc;
double otherchrgs;
int Total;
int RatePerUnit;
Scanner in1=new Scanner(System.in);
System.out.println("Enter name of owner Name of Apartment or Flat or Shop:");
Name = in1.next();
Scanner in2=new Scanner(System.in);
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 = in2.nextShort();
Scanner in3=new Scanner(System.in);
System.out.println("Enter account Number:");
Account = in3.nextLong();
Scanner in4=new Scanner(System.in);
System.out.println("Enter Bill Number:");
billNum = in4.nextInt();
Scanner in5=new Scanner(System.in);
System.out.println("Enter Old Meter Reading:");
OldMtrRdng = in5.nextInt();
Scanner in6=new Scanner(System.in);
System.out.println("Enter New Meter Reading:");
NewMtrRdng = in6.nextInt();
Scanner in7=new Scanner(System.in);
System.out.println("Enter Bill Month:");
Month = in7.next();
Scanner in8=new Scanner(System.in);
System.out.print("Enter any unpaid balance:");
unpaid = in8.nextDouble();
Scanner in9=new Scanner(System.in);
System.out.println("Enter any other charges:");
otherchrgs = in9.nextDouble();
Total = NewMtrRdng-OldMtrRdng;
if (Total >= 1 && Total <=1000)
RatePerUnit=5;
else if (Total >= 1001 && Total <=2000)
RatePerUnit=5;
else if (Total >= 2001 && Total <=3000)
RatePerUnit=10;
else if (Total >= 3001 && Total <=4000)
RatePerUnit=10;
else if (Total >= 4001 && Total <=5000)
RatePerUnit=12;
else if (Total >= 5001 && 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;
based on the service the user choose ( Commercial, Residental, etc. ) how can i put the consumption rate of each one of them.
Sorry for my bad english