Results 1 to 4 of 4

Thread: fix bug ! Help

  1. #1
    XSkyline is offline Member
    Join Date
    Nov 2014
    Posts
    8
    Rep Power
    0

    Default fix bug ! Help

    how to fix my program
    this is program about parking almost done


    Java Code:
    import java.util.*;
     class Parking
     {
        public static void Parking (String args[])
        {
            
            Scanner snip = new Scanner (System.in);
            System.out.println("Enter entrance time:");
            int timeHours;
            int timeMin;
            timeHours = snip.nextInt();
            timeMin = snip.nextInt();
            System.out.println("Enter exit time:");
            
            int timeHours1;
            timeHours1 = snip.nextInt(); 
            int timeMin1;
            timeMin1 = snip.nextInt();
            int enterTotalHours;
            int exitTotslHours;
            int total;
            int totalX;
            
            
            enterTotalHours = timeHours*60+timeMin;
            exitTotslHours = timeHours1*60+timeMin1;
            total = exitTotslHours - enterTotalHours;
             
            if (total<120){
            }
            if (total<120){
            }  
            if (total> 60){
            }  
               
             totalX = total - 120;
            while(timeMin>0){
                int count;
                timeMin1=total;
                break;
        }  
            
        
        if ((timeHours/25)+(timeHours1/25)+(timeMin/60)+(timeMin1/60)!=0)
            System.out.println("Error Ileegal Data");
        else if(timeHours1*60+timeMin1<timeHours*60+timeMin)
        System.out.println("Exit time must precede enter time");
        else
        System.out.println ("Total charge is "+timeMin1+" $");
    }
    }
    first hour is free
    and after the first hour every minute you'll need to pay.

    the second hour is 3 dollars
    that means that if your car was Parikng 120 minutes you'll pay only 3 dollars

    for the third hour you'll pay 1 dollar every 15 minutes

    after 18:00 o'clock you'll pay only one time 10 dollars now matter for how long you'll be parking

    it need to look like this:


    when i inside the the number

    Enter entrance time:
    20 15
    Enter exit time:
    21 30

    i get Error Ileegal Data
    why!!!?!?!?
    tnx for help
    Last edited by XSkyline; 11-11-2014 at 04:53 PM.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,001
    Rep Power
    33

    Default Re: fix bug ! Help

    Please copy the full text of the error message and paste it here. It has important info about the error.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    XSkyline is offline Member
    Join Date
    Nov 2014
    Posts
    8
    Rep Power
    0

    Default Re: fix bug ! Help

    nter entrance time:
    20 15
    Enter exit time:
    21 30
    Error Ileegal Data
    this is what i get
    and i need to see how much i need to pay =/

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,001
    Rep Power
    33

    Default Re: fix bug ! Help

    That looks like a message that is printed inside of the posted code. Look at the code and see why it is printed. What are the values of the variables that control the printing of the message?
    If you don't understand my response, don't ignore it, ask a question.

Posting Permissions

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