Search:

Type: Posts; User: Norm

Page 1 of 2 1 2

Search: Search took 0.13 seconds.

  1. Replies
    51
    Views
    3,134

    Re: car rental (project)

    That is normally done with a loop. The while loop is the best choice.
  2. Replies
    51
    Views
    3,134

    Re: car rental (project)

    Describe when you want the loop's execution to continue and when you want it to end?
    Since the posted code uses a break statement, you could use the value: true as the condition
    so that the loop...
  3. Replies
    51
    Views
    3,134

    Re: car rental (project)

    Please explain what happens when the code is compiled and executed.
    What do you need help with?

    Also please fix the indentation of the statements to show what is inside the while loop:


    ...
  4. Replies
    51
    Views
    3,134

    Re: car rental (project)

    Yes that is what a loop does.

    Begin loop
    step 1
    if input <= 4, exit loop
    // input > 4 so loop back to step 1
    end loop

    Another way to exit a loop is by using the break statement.
  5. Replies
    51
    Views
    3,134

    Re: car rental (project)

    Are you asking about validating a user's input?

    Here is one way to use a loop to validate user input:
    Begin loop
    prompt for user's input
    read user's input
    test user's input
    if input is valid...
  6. Replies
    51
    Views
    3,134

    Re: car rental (project)

    That appears to ask you to write the programs steps so I could help you with any you are having problems with.
    If you have the list of steps and are having problems with one, post the step and ask...
  7. Replies
    51
    Views
    3,134

    Re: car rental (project)

    Does it compile without errors?
    Does it execute and produce the desired results?
    Have you tested it with different values to see what it does with good and bad input?
  8. Replies
    51
    Views
    3,134

    Re: car rental (project)

    Which step in the list of steps are you talking about?
    Pick one step and ask some specific questions about whether to use filereader or writer when coding that step.

    The steps listed so far...
  9. Replies
    51
    Views
    3,134

    Re: car rental (project)

    Which step in the list of steps for the program are you asking about?
    I don't see anything in the list about writing files.
    If there are supposed to be files written, could you complete the list...
  10. Replies
    51
    Views
    3,134

    Re: car rental (project)

    Step 3 has too many parts. It should be broken up:
    3) program ask you "Enter the number of days" ,
    4)after the user has typed in the number,
    5)the program should switch the number of the car for...
  11. Replies
    51
    Views
    3,134

    Re: car rental (project)

    You have skipped over completing the steps that were listed in post#29.

    Please update that list with the added steps I recommended and any you think are needed.

    For example you say: it should...
  12. Replies
    51
    Views
    3,134

    Re: car rental (project)

    Ok, that's a start.
    Where does the program read the first user input?

    What should the program do after it shows the message: "pls try again"

    What should the program do after step 3: type the...
  13. Replies
    51
    Views
    3,134

    Re: car rental (project)

    See the example in my post#24
    A list of the steps the program would take to solve the problem written in English.

    Here is another example for the steps in program development:
    1) design the...
  14. Replies
    51
    Views
    3,134

    Re: car rental (project)

    Please list the program design steps so we can see what you are working on and be able to write the statements for the step you are working on.
  15. Replies
    51
    Views
    3,134

    Re: car rental (project)

    Ok, those are java statements.

    What design do you have for what the program should do? The steps in a design are not java statements.
    They would be short phrases describing what the code would...
  16. Replies
    51
    Views
    3,134

    Re: car rental (project)

    Back to doing some design work BEFORE writing any code.

    What steps does the program need to take to solve the problem?
    Make a list first and check that the steps will work.
    Then start at the top...
  17. Replies
    51
    Views
    3,134

    Re: car rental (project)

    Use an if statement to test if the number is valid.
    What should the code do if it displays a message that says: "pls try again"?
  18. Replies
    51
    Views
    3,134

    Re: car rental (project)

    Please explain why you think there is a problem.

    Have you read the tutorial about switch statements: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html



    Note: The posted...
  19. Replies
    51
    Views
    3,134

    Re: car rental (project)

    Put it after where you have obtained the user's input
    and before where you need the value associated with the user's input.
  20. Replies
    51
    Views
    3,134

    Re: car rental (project)

    The posted code has lost all its indentations. Statements should not all start in column 1.
    indent the statements to show there logical nesting.
    Inside class - indent 3
    inside method indent 3...
  21. Replies
    51
    Views
    3,134

    Re: car rental (project)

    What are the choices for "kind of car"?
    Can you use a String for each kind
    or a digit/letter (1 for 2-seater, 2 for truck, 3 for 4-door, etc)?
  22. Replies
    51
    Views
    3,134

    Re: car rental (project)

    Can you explain what needs to be done for that?

    Please edit your post and wrap your code with code tags:



    **YOUR CODE GOES HERE**


    to get highlighting and preserve formatting.
  23. Replies
    51
    Views
    3,134

    Re: car rental (project)

    Before worrying about what classes and methods to use you need to make a design for the program.
    Once you have a list of the steps then worry about how to implement those steps.


    Which step in...
  24. Replies
    51
    Views
    3,134

    Re: car rental (project)

    Is the program supposed to have a GUI window with input fields, display areas and buttons
    or will it use a command prompt to get user input and display results?

    If it uses the command prompt...
  25. Replies
    51
    Views
    3,134

    Re: car rental (project)

    The questions you posted look like what the program would ask the user. It appears to be an exact copy of the first post.

    I was asking you for what java programming questions you have about how...
Results 1 to 25 of 26
Page 1 of 2 1 2