Results 1 to 4 of 4
  1. #1
    golfgators is offline Member
    Join Date
    Oct 2016
    Posts
    2
    Rep Power
    0

    Default Need help on writing this program

    Need assistance on writing and understanding how to write the attached.

    You will have a main loop that serves as a menu. You display the menu and prompt user for selection.
    4. You will call 1 of 4 methods if the input is 1-4. Terminate program if input is 9. Otherwise display an error
    message and resume the loop.
    5. Factorial method
    a. Set up an input validation loop to prompt user for a number.
    b. If number is not 1-7 display an error and continue loop.
    c. If valid, write a simple for loop to calculate n!. For n=3, this means n! = 1 x 2 x 3 = 6.
    d. Exit the method after calculating factorial.
    e. Hint 1: set initial total to 1 and loop starting with 1 and continue looping while loop counter < n+1.
    f. Hint 2. Write a test program to only calculate factorial–No input loop. Define n with various values and run.
    6. Range method
    a. Prompt user for a number.
    b. If number < 50 display the number entered is less than 50.
    c. If number > 50 display the number entered is greater than 50.
    d. Otherwise display number entered equals 50.
    7. Logic method
    a. Prompt the user for gender and then marital status.
    b. Write a series of If statements to evaluate the input and display the result according to the table below.
    c. Hint. Write a nested if, one for Male and the other for Female. This allows copying the if statement within
    the male block to the female block and only change the result displayed.
    Marital Gender Code
    M M 1
    M F 2
    M ? 66
    F M 4
    F F 5
    F ? 77
    ? ? 88
    8. Millennial method
    a. Prompt the user for year born. Subtract the year from 2016 to get age.
    b. If the age is less than 35 then display the person is a millennial otherwise display the person is not a
    millennial.
    c. You MUST use the ? Conditional statement format for above.
    9. When finished, compile your program.
    10. Fix any compile errors and recompile until no errors.
    11. Run the program.
    Last edited by golfgators; 10-23-2016 at 08:52 AM.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,422
    Blog Entries
    7
    Rep Power
    28

    Default Re: Need help on writing this program

    'help' and 'assistance' imply that you have attempted to solve your problems yourself, but you have failed. We don't see any attempts to solve this stuff yourself; all we see is a homework dump ...

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

  3. #3
    golfgators is offline Member
    Join Date
    Oct 2016
    Posts
    2
    Rep Power
    0

    Default Re: Need help on writing this program

    Jos,

    your right, it is homework dump. I need guidance on how to work and write program. Text book in a paper weight.

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,422
    Blog Entries
    7
    Rep Power
    28

    Default Re: Need help on writing this program

    Quote Originally Posted by golfgators View Post
    your right, it is homework dump. I need guidance on how to work and write program. Text book in a paper weight.
    OK, you start and we'll try to help you out; basically, you have to implement four methods for points 5), 6), 7) and 8). You call each of those methods in your switch, described in 4).

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

Similar Threads

  1. I need help with writing this program!!!
    By tdhubb2012 in forum New To Java
    Replies: 3
    Last Post: 03-02-2015, 06:36 PM
  2. HELP :( I am writing a NewtonRaphson program.
    By sithclone3 in forum New To Java
    Replies: 12
    Last Post: 07-17-2014, 07:10 AM
  3. help in writing a program?
    By baldy100 in forum New To Java
    Replies: 3
    Last Post: 01-10-2013, 04:06 PM
  4. Help with writing my own program
    By DMarsh12 in forum New To Java
    Replies: 4
    Last Post: 12-30-2011, 03:34 AM
  5. Due Tommorow Writing a Program Please Help
    By gallimaufry in forum New To Java
    Replies: 4
    Last Post: 10-23-2008, 03:15 AM

Posting Permissions

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