Thread: Need help on writing this program

1. Member
Join Date
Oct 2016
Posts
2
Rep Power
0

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. 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

3. Member
Join Date
Oct 2016
Posts
2
Rep Power
0

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. Re: Need help on writing this program

Originally Posted by golfgators
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

Posting Permissions

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