Question
C# programming Requirements: In this exercise you are to state the correct ordering of two given strings, formatted with Name: in front of them. First
C# programming
Requirements:
In this exercise you are to state the correct ordering of two given strings, formatted with Name: in front of them.
First you must request and receive name A:
What is name A?
Next you must request and receive name B:
What is name B?
The user will always enter the names with Name: at the beginning of both name A and B. In the three examples below, {A} and {B} are placeholders for these inputs.
If name A precedes name B, you are to write:
{A} Precedes {B}
If name A is equal to name B, you are to write:
{A} Equals {B}
If name A follows name B, you are to write:
{A} Follows {B}
An example of the full console output is:
What is name A?
Name: Amy
What is name B?
Name: Matthew
Amy Precedes Matthew
What is name A?
Name: Amy
What is name B?
Name: Matthew
Amy Precedes Matthew
Note that the user inputs the entire "Name: Amy" and "Name: Matthew" lines.
Use the following skeleton as a basis for your program:
public class StringOrder
{
enum Order { Precedes=-1, Equals=0, Follows=1 };
public static void Main()
{
Console.WriteLine("What is name A?");
}
}
Don't forget to add a Console.ReadLine() at the end of the program so it doesn't close automatically when debugging.
Do not use if statements or switch statements.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started