I am developing a short program of electricity bill where i taking input Reidential or commercial but i have face many problems kindly see my program code and correct the code and show my mistakes.Thanks
import java.io.*;
public class Final
{
public static void main(String args[]) throws IOException
{
InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader input = new BufferedReader(reader);
System.out.print("Please Enter your Units: ");
String userInput=input.readLine();
int userUnits=Integer.parseInt(userInput);
System.out.print("Please Enter your Units type Residential ® Commercial ©: ");
String userUnitstype=input.readLine();
int unitcostC=0;
int unitcostR=0;
if
(userUnits<100 & userUnits>1)
{
unitcostC=12;
unitcostR=5;
}
else if (userUnits>=100 & userUnits<200)
{
unitcostC=17;
unitcostR=7;
}
else if (userUnits>=200 & userUnits<500)
{
unitcostC=22;
unitcostR=11;
}
else{
unitcostC=30;
unitcostR=15;
}
int totalamount1=userUnits*unitcostC;
int totalamount2=userUnits*unitcostR;
if
(userUnitstype=="C")
totalamount1=userUnits*unitcostC;
else
totalamount2=userUnits*unitcostR;
System.out.println("Your Total amount is: "+totalamount1);
System.out.println("Your Total amount is: "+totalamount2);
}
}