princess33
| Subject: check for errors ??? Mon Jan 04, 2010 6:51 pm | |
| my program is not compiling plz check if there are any errors import java.io.*; public class bill { double amt; String cust_name; double bill; InputStreamReader ir = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(ir); System.out.println("APCPDCL"); System.out.println("Electricity bill"); System.out.println("enter the following and pay the bill"); System.out.println("*******************"); System.out.println("ENTER CUSTOMER'S NAME :"); String cust_name =br.readLine(); System.out.println() System.out.println("enter customer's address :"); String add=br.readline(); System.out.println() System.out.println("enter meter no.") String mtr_no=br.readline() String mtr_no =Double.parseDouble(br.readLine(mtr_no)); System.out.println(); System.out.println("enter no. of units consumed"); String u=br.readline(); String u=Double.parseDouble(br.readLine()); } public void display throws IOException if(u<=50) bill=(double)(1.45*u); else if((u>50)&&u<=100)); bill=(double)(1.45*50+(u-50)*2.80); else if((u>100)&&(u<=200)); bill=(double)(50*1.45)+(50*2.80)+(u-100*3.05); else if((u>200)&&(u<=300)); bill=(double)(50*1.45)+(50*2.80)+(100*3.05)+(u-200*4.75); else if((u>300)&&(u<=400)); bill=(double)(50*1.45)+(50*2.80)+(100*3.05)+(100*4.75)+(u-300*5.50); } else { System.out.println("invalid entry") } total amount= bill+650; System.out.println("------------------------------------"); System.out.println("monthly rental=Rs 250 /-"); System.out.println() System.out.println(you need to pay RS+"bill" ); System.out.println() System.out.println(" Due Date is 30/2/10"); System.out.println("Note: pay before the due date or you will be charged fine"); System.out.println ("THANK YOU"); } } |
|
abhas Active member
| Subject: Re: check for errors ??? Mon Jan 04, 2010 9:45 pm | |
| U had not added semi colons after System.out.println etc. try this(i have not tried it on java as i don't have it installed. if error is still there then tell me in which line u r getting it and what does it say)
import java.io.*; public class bill { double amt; String cust_name; double bill; InputStreamReader ir = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(ir); public void accept()throws IOException
{ System.out.println("APCPDCL"); System.out.println("Electricity bill"); System.out.println("enter the following and pay the bill"); System.out.println("*******************"); System.out.println("ENTER CUSTOMER'S NAME :"); String cust_name =br.readLine(); System.out.println(); System.out.println("enter customer's address :"); String add=br.readline(); System.out.println(); System.out.println("enter meter no.");
double mtr_no =Double.parseDouble(br.readLine(mtr_no)); System.out.println(); System.out.println("enter no. of units consumed");
double u=Double.parseDouble(br.readLine()); } public void display () { if(u<=400) { if(u<=50.0) amt=(1.45*u); else if((u>50.0)&&(u<=100.0)) amt =(1.45*50.0+((u-50.0)*2.80)); else if((u>100.0)&&(u<=200.0)) amt =(50*1.45)+(50*2.80)+((u-100.0)*3.05)); else if((u>200.0)&&(u<=300.0)) amt=(50*1.45)+(50*2.80)+(100*3.05)+((u-200*4.75)); else if((u>300.0)&&(u<=400.0)) amt=(50*1.45)+(50*2.80)+(100*3.05)+(100*4.75)+((u-300)*5.50)); } else { System.out.println("invalid entry"); } double bill = amt + 250.0; System.out.println("------------------------------------"); System.out.println("monthly rental=Rs 250 /-"); System.out.println(); System.out.println("you need to pay RS"+bill ); System.out.println(); System.out.println(" Due Date is 30/2/10"); System.out.println("Note: pay before the due date or you will be charged fine"); System.out.println ("THANKYOU!"); } } |
|
sahilsweetypie
| Subject: Re: check for errors ??? Tue Nov 09, 2010 12:58 pm | |
| hey bhai__________ tune saare methods bana to diye hain bt tumne usko main class me call hi nahi kiya hai. thatz y errors display ho rhe hain_______ main right prog bana kar tujhe kuch der me reply kar dunga_____________ |
|
Sponsored content
| Subject: Re: check for errors ??? | |
|
|
|