Results 1 to 3 of 3
  1. #1
    joepuchong is offline Member
    Join Date
    Jul 2012
    Posts
    1
    Rep Power
    0

    Default Anyone can help.....

    I don't no where the error, i compile this coding was ok but cannot get the output...please help mee...



    import java.util.*;


    //class BillingSystem main function
    class BillingSystem
    {
    public static void main (String [] args)
    {
    //declation of variables
    int[] anArray;
    anArray = new int[5];
    double Charges = 0;
    double water_usage = 0;
    double current_meter;
    double past_meter;
    double c_meter;
    double p_meter;
    char character;
    Scanner scanner = new Scanner(System.in);

    //looping for 5 customers;
    for (int i = 1; i<= 5; i ++);
    {
    System.out.println();
    System.out.println("BILLING SYSTEM");
    System.out.println("===============");
    System.out.println();
    System.out.println("MENU");
    System.out.println();
    do{
    System.out.println("SELECT USER TYPE");
    System.out.println();
    System.out.println("R - RESIDENTAL");
    System.out.println("I - INDUSTRIAL\n");
    character = scanner.next().charAt(0);
    if(character!='R' && character!='r' && character!='I' && character!='i')
    System.out.println("Invalid Type Enter Again");
    } while(character!='R' && character!='r' && character!='I'&& character!='i');
    if (character == 'r' || character == 'R')
    {
    System.out.println ("\nRESIDENTAL");
    System.out.println("\nENTER PAST METER >\n");
    past_meter = scanner.nextDouble ();
    System.out.println ("YOUR PASS METER >\t" + past_meter +"\n");
    System.out.println("\nENTER CURRENT METER >\n");
    current_meter = scanner.nextDouble ();
    System.out.println ("YOUR CURRENT METER >\t" + past_meter +"\n");
    water_usage = current_meter - past_meter;
    if ((water_usage > 0)&&(water_usage <= 15))
    Charges = (water_usage * 0.82 )+5.00;
    else if ((water_usage > 15)&&(water_usage <= 40))
    Charges = (water_usage * 0.65 )+5.00;
    else if (water_usage > 40)
    Charges = (water_usage * 0.42 )+5.00;
    else if (water_usage <= 0)
    Charges = 5.00;
    System.out.println("DISPLAY");
    System.out.println("====================");
    System.out.println ("----------------------------------------------------------------------");
    System.out.println (" User Type\tCURRENT READING\tPASS READING\t USAGES\tCharges(RM) ");
    System.out.println ("-----------------------------------------------------------------------");
    System.out.println("\t"+character +"\t " +current_meter +"m3\t " +past_meter +"m3 m3\t"+water_usage +" rm \t" +Charges);
    System.out.println ("-----------------------------------------------------------------------");
    }

    else if (character == 'i'|| character == 'I')
    {
    System.out.println ("\nINDUSTRIAL");
    System.out.println("\nENTER PAST METER >\n");
    p_meter = scanner.nextDouble ();
    System.out.println ("YOUR PASS METER >\t" + p_meter +"\n");
    System.out.println("\nENTER CURRENT METER >\n");
    c_meter = scanner.nextDouble ();
    System.out.println ("YOUR CURRENT METER >\t" + c_meter +"\n");
    water_usage = c_meter - p_meter;
    if (water_usage > 0)
    Charges = (water_usage * 1.47+15.00 );
    else
    Charges = 15.00;
    System.out.println("PAPARAN MAKLUMAT BIL");
    System.out.println("====================");
    System.out.println ("----------------------------------------------------------------------");
    System.out.println (" User Type\tCURRENT READING\tPASS READING\t USAGES\tCharges(RM) ");
    System.out.println("\t"+character +"\t " +c_meter +"m3\t " +p_meter +"m3 m3\t"+water_usage +" rm \t" +Charges);
    System.out.println ("----------------------------------------------------------------------");
    }
    }
    }
    }

  2. #2
    kammce's Avatar
    kammce is offline Senior Member
    Join Date
    Dec 2010
    Location
    California
    Posts
    194
    Rep Power
    4

    Default Re: Anyone can help.....

    ... Whats wrong with it? I compiled it and ran it. I get output and I can give input. I see not issues with this program. Try re-compiling it on your computer and running it again on another terminal Session. Maybe you set something to remove output from the file in that session. Or maybe you disabled output from that file. Or maybe you are piping output to a file or another program or another location and that output is NOT being put into Standard Output.
    My API:
    Java Code:
    cat > a.out || cat > main.class

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,250
    Rep Power
    19

    Default Re: Anyone can help.....

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •