Home / Expert Answers / Computer Science / exercise-1using-coral-pseudocode-design-the-logic-for-a-program-based-on-the-following-requirements-pa705

(Solved): Exercise 1Using Coral Pseudocode, design the logic for a program based on the following requirements ...



Exercise 1

Using Coral Pseudocode, design the logic for a program based on the following requirements:

Create the logic for a program that performs two different arithmetic functions using the following parameters:

  1. Design two user-defined functions named mult() and div() to:
    1. Accept two parameters
    2. Return one variable
    3. Function mult() should multiply the two values from the parameter list and return the value back
    4. Function div() should divide the two values from the parameter list and return the value back
    5. Both functions should abide by the rules of mathematics. If a function fails the rules of mathematics, output the message "Invalid" before returning back a result of zero.
  2. Design the Main() program to:
    1. Set no parameters or return variables
    2. Set three float local variables
    3. Prompt the user for values for two of the local variables
    4. Pass user input variables to methods named mult() and div() and save the value to a local variable
    5. Output the result of the calls to mult() and div()
student submitted image, transcription available below

Exercise 2

Using Coral Pseudocode, design the logic for a program based on the following prompt:

  • Design the Main() program to:
    • Create the logic for the Main program that continuously accepts a user’s birth month and year.
    • Verify the month entered by the user is valid and exit the loop when an invalid entry is given.
    • Test this out by using birth dates both before and after the month of the current month.
    • Declare variables that have the value of the current month and year should be set to June (6) for the current month and the current year should be set to 2021.
    • Pass the Users birth month and year as well as the current month and year in the function call.
    • Displays the result of the calculation with the output "The user is X years old."
  • Design the ageCalc() function to:
    • Accept the arguments in the parameters from the function call in the Main() function.
    • Return back the calculated age to the calling program.

Example Input

1 2000 12 2000 15

Example Output

For example, if the current month is June (6) and the current year is 2021, then the output would look like:

The user is 21 years old.
The user is 20 years old.

student submitted image, transcription available below
Using Coral Pseudocode, design the logic for a program based on the following requirements: Create the logic for a program that performs two different arithmetic functions using the following parameters 1. Design two user-defined functions named mult() and to: 1. Accept two parameters 2. Return one variable 3. Function mult() should multiply the two values from the parameter list and return the value back 4. Function should divide the two values from the parameter list and return the value back 5. Both functions should abide by the rules of mathematics. If a function fails the rules of mathematics, output the message "Invalid" before returning back a result of zero. 2. Design the Main() program to: 1. Set no parameters or return variables 2. Set three float local variables 3. Prompt the user for values for two of the local variables 4. Pass user input variables to methods named mult() and and save the value to a local variable 5. Output the result of the calls to mult() and Using Coral Pseudocode, design the logic for a program based on the following prompt: - Design the Main() program to: - Create the logic for the Main program that continuously accepts a user's birth month and year. - Verify the month entered by the user is valid and exit the loop when an invalid entry is given. Test this out by using birth dates both before and after the month of the current month. - Declare variables that have the value of the current month and year should be set to June (6) for the current month and the current year should be set to 2021 . - Pass the Users birth month and year as well as the current month and year in the function call. - Displays the result of the calculation with the output "The user is X years old." - Design the ageCalc() function to: Accept the arguments in the parameters from the function call in the Main() function. - Return back the calculated age to the calling program. Example Input 1200012200015 Example Output For example, if the current month is June (6) and the current year is 2021, then the output would look like: The user is 21 years old. The user is 20 years old.


We have an Answer from Expert

View Expert Answer

Expert Answer



We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe