Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Please Help! My error===> 'else' without 'if'

807607Oct 21 2006 — edited Oct 22 2006
I am a student trying to figure out what i did wrong. The program looks like it will work to me, but i keep getting this error

phone_chg.java:24: 'else' without 'if'

Here is what my code looks like
--------------------------------------------
import java.util.*;

public class phone_chg
{
static Scanner sc = new Scanner(System.in);
static final double CONN_FEE = 1.99;
static final double FIRST_T = 2.00;
static final double ADD_CHG = .45;
static final int INCLUDED = 3;

public static void main(String[] args)
{
int mins;
double ad_mins;
double chg;

System.out.println("Please enter the length of the phone call in minutes: ");

mins = sc.next();
System.out.println();

if (mins > INCLUDED)
ad_mins = mins - INCLUDED;
chg = (ad_mins * ADD_CHG) + CONN_FEE + FIRST_T;
else
chg = CONN_FEE + FIRST_T;


System.out.printf("Total Fee Assessed: $ %.2f", chg);

}
}

I would really appreciate any help you guys can give me. This is my 4th week of Java Programming and i want to stay on this good start i am.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 19 2006
Added on Oct 21 2006
2 comments
131 views