add the current reading to that difference ot get cubic used
my trouble is the calculation i think if nothing else....
import java.util.Scanner;
public class NameGasUtilityCompany
{
public static void main(String [] args)
{
char choice;
int value,present,previous,cubic;
char home,commercial,name,usage;
double cost;
Scanner keyboard= new Scanner(System.in);
System.out.println("Welcome to Name Gas");
name=keyboard.charAt(0);
System.out.println("What type of customer are you? 'H' or 'h'(home)|| 'C' or 'c' (commercial)");
choice=keyboard.charAt(0);
System.out.println("Enter only cubic value in the range 0-9999");
value=keyboard.nextInt();
(usage = previous-present);
if(present < previous)
{ usage = (previous - 9999)* present;
(usage=present + usage);
else
usage = previous-present;
}
if (choice == 'H' || choice == 'h')
{
// use this formula constant
{if (cubic == 70)
cost = 5.00;
else if (cubic <= 100)
cost = cubic * .05;
else if (cubic <= 400)
cost = cubic * .025;
else
cost = cubic * .015;
}
if (choice == 'C' || choice == 'c')
{
//use this formula or constant
{if (cubic == 200)
cost = 30.00;
else if (cubic <=500)
cost = cubic * .04;
else if (cubic > 700)
cost = cubic * .03;
}
System.out.println("Present meter reading" + present);
System.out.println("Previous meter reading" + previous);
System.out.println("Enter how many cubic used :" + usage);
System.out.println("Cost this month $: " + cost);
}
}
}
}