Question: Please Write a program that accepts five names. It computes the lowest and highest names and display them. pseudo code: // Constant for the number

Please Write a program that accepts five names. It computes the lowest and highest names and display them.

pseudo code:

// Constant for the number of names.

Constant Integer MAX_NAMES = 5

// Variables

Declare String name, lowest, highest

Declare Integer count

// Get the first name.

Display "Enter the first name."

Input name

// Since this is the only name entered so far,

// it is both the lowest and highest (alphabetically).

// Assign the name to lowest and highest.

Set lowest = name

Set highest = name

// Get the rest of the names and keep the lowest and highest.

For count = 2 To MAX_NAMES

// Get the next name.

Display "Enter the next name."

Input name

// Determine whether this is the lowest or highest name.

If name < lowest Then

Set lowest = name

Else if name > highest Then

Set highest = name

End If

End For

// Display the first and last names.

Display "First: ", lowest

Display "Last: ", greatest

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!