import java.util.Scanner;
package p1;
class Electricity
{
int cread=18634,fix_rate,due,ub_tax,curr_charge,bill,to_bill ;
int pread,unit ;
System.out.println("fix_rate=");
Scanner sc=new Scanner(System.in);
int fix_rate=sc.nextInt();
System.out.println("due=");
int due= sc.nextInt();
System.out.println("ub_tax=");
int ub_tax= sc.nextInt();
System.out.println("curr_charge=");
int curr_charge= sc.nextInt();
System.out.println("unit=");
int unit=sc.nextInt();
public void calc()
{
do
{
pread=cread-unit;
System.out.println("fix_rate=" +pread);
}
while(unit<200)
{
int c1=2.75*unit;
System.out.println(c1);
}
while(200< unit >300)
{
int c2=3.00*unit;
System.out.println(c2);
}
while(300< unit > 450)
{
int c3= 4.65*unit;
System.out.println(c3);
}
}
public static void main (String[] arg)
{
Electricity e=new Electricity();
e.calc();
}
}
**Errors are:**
Electricity.java:2: class, interface, or enum expected
package p1;
^
Electricity.java:7: <identifier> expected
System.out.println("fix_rate=");
^
Electricity.java:7: illegal start of type
System.out.println("fix_rate=");
^
Electricity.java:10: <identifier> expected
System.out.println("due=");
^
Electricity.java:10: illegal start of type
System.out.println("due=");
^
Electricity.java:12: <identifier> expected
System.out.println("ub_tax=");
^
Electricity.java:12: illegal start of type
System.out.println("ub_tax=");
^
Electricity.java:14: <identifier> expected
System.out.println("curr_charge=");
^
Electricity.java:14: illegal start of type
System.out.println("curr_charge=");
^
Electricity.java:16: <identifier> expected
System.out.println("unit=");
^
Electricity.java:16: illegal start of type
System.out.println("unit=");
^
Electricity.java:25: ';' expected
while(unit<200)
^
12 errors
Richa_2 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
stultuske 1,116 Posting Maven Featured Poster
Richa_2 0 Newbie Poster
stultuske 1,116 Posting Maven Featured Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
Richa_2 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.