Results 1 to 3 of 3
  1. #1
    orgmiri is offline Member
    Join Date
    Sep 2012
    Rep Power

    Question please check my work..and please help me..I am newbie

    A parking garage charges a $2.00 minimum fee to park for up to three hours.The garage charges an additional $0.50 per hour for each hour or part thereof in excess of three hours.The maximum charge for any given 24-hour period is $10.00. Assume that no car parks for longer than 24 hours at a time. Write an application that calculates and displays the parking charges for each customer who parked in the garage yesterday. You should enter the hours parked for each customer. The program should display the charge for the current customer and should calculate and display the running total of yesterday's receipts. The program should use the method calculateCharges to determine the charge for each customer.

    import java.util.Scanner;

    public class exercise2Method {

    public static void main(String[] args){

    Scanner input = new Scanner(;

    System.out.print("pleasa input total time: ");
    double totalTime = input.nextDouble();

    System.out.printf("Volume is %f\n", calculateCharges( totalTime ));
    public static double calculateCharges( double totalTime ){

    double addHour = totalTime - 3.00;
    double totalAddHour = addHour * 0.5;
    double total = totalAddHour + 2;

    if( totalTime <= 3.00 ){
    System.out.println("you must pay RM 2.00");


    if( totalTime > 3.00 ){
    System.out.printf("you must pay RM "+ total);

    if( totalTime >= 24 ){
    System.out.printf("you must pay RM 10.00");

    return totalTime;


  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power

    Default Re: please check my work..and please help me..I am newbie

    What questions do you have regarding this code? Please be as specific as possible.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    Default Re: please check my work..and please help me..I am newbie

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

Similar Threads

  1. applet call dll work in Win2000 but not work in WinXP
    By manhcuongtin4 in forum Java Applets
    Replies: 1
    Last Post: 07-14-2011, 01:45 PM
  2. Can someone check this over?
    By Phyxed in forum New To Java
    Replies: 2
    Last Post: 03-29-2011, 09:07 AM
  3. Don't know what to check for
    By Chasingxsuns in forum New To Java
    Replies: 8
    Last Post: 08-26-2009, 05:59 AM
  4. pls check it
    By aRTx in forum New To Java
    Replies: 0
    Last Post: 03-24-2009, 02:35 PM
  5. Check box tag
    By elizaabru in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 08-26-2008, 02:37 PM

Posting Permissions

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