Question

In: Computer Science

I need this written in C # ASAP Write a C# console program that continually asks...

I need this written in C # ASAP

Write a C# console program that continually asks the user "Do you want

to enter a name (Y/N)? ". Use a "while" loop to accomplish this. As long as the user enters

either an upper or lowercase 'Y', then prompt to the screen "Enter First and Last Name: " and

then get keyboard input of the name. After entering the name, display the name to the screen.

Solutions

Expert Solution

Please find the code , output below.

using System;
class Name {
static void Main() {
string firstname , lastname;
char ans='Y';
Console.WriteLine("Do you want to enter a name (Y/N)?");
ans=Console.ReadLine()[0];
while(ans=='y' || ans == 'Y'){
Console.WriteLine("Enter First and Last Name:");
firstname=Console.ReadLine();
lastname=Console.ReadLine();
Console.WriteLine("Your name is "+firstname+" "+lastname);
Console.WriteLine("Do you want to enter a name (Y/N)?");
ans=Console.ReadLine()[0];
}
}
}


Related Solutions

Write a C# console program that continually asks the user "Do you want to enter a...
Write a C# console program that continually asks the user "Do you want to enter a name (Y/N)? ". Use a "while" loop to accomplish this. As long as the user enters either an upper or lowercase 'Y', then prompt to the screen "Enter First and Last Name: " and then get keyboard input of the name. After entering the name, display the name to the screen. --- Create a Patient class which has private fields for patientid, lastname, firstname,...
Write a C# console program that continually asks the user "Do you want to enter a...
Write a C# console program that continually asks the user "Do you want to enter a name (Y/N)? ". Use a "while" loop to accomplish this. As long as the user enters either an upper or lowercase 'Y', then prompt to the screen "Enter First and Last Name: " and then get keyboard input of the name. After entering the name, display the name to the screen.
Write a C# console program that continually asks the user "Do you want to enter a...
Write a C# console program that continually asks the user "Do you want to enter a name (Y/N)? ". Use a "while" loop to accomplish this. As long as the user enters either an upper or lowercase 'Y', then prompt to the screen "Enter First and Last Name: " and then get keyboard input of the name. After entering the name, display the name to the screen.
In C#, write a console-based program that asks a user to enter a number between 1...
In C#, write a console-based program that asks a user to enter a number between 1 and 10. Check if the number is between the range and if not ask the user to enter again or quit. Store the values entered in an array. Write two methods. Method1 called displayByVal should have a parameter defined where you pass the value of an array element into the method and display it. Method2 called displayByRef should have a parameter defined where you...
A program written in C that asks for the distance to be entered and then prints...
A program written in C that asks for the distance to be entered and then prints the fare A transportation company has the following rates For the first 100 miles                                                       20 cents a mile For the next 100 miles                                                       a) + 10 cents per mile over 100 miles For the next 100 miles                                                       b) + 8 cents per mile over 200 miles more than 300 miles                                                          c) + 5 cents per mile over 300 miles Write a program that asks...
Coding in C++: For this verse, you need to write a program that asks the user...
Coding in C++: For this verse, you need to write a program that asks the user to input the inventory id number (integer) and the price (float) for 5 inventory items. Once the 5 inventory items are input from the user, output the results to the screen. Please ensure you use meaningful names for your variables. If your variables are not named meaningfully, points will be deducted.
I need a c# console program that lets a player choose to play poker or black...
I need a c# console program that lets a player choose to play poker or black jack against the computer.
Program should be written in Java a) Write a program that asks the user to enter...
Program should be written in Java a) Write a program that asks the user to enter the approximate current population of India. You should have the computer output a prompt and then YOU (as the user should enter the population.)  For testing purposes you may use the value of 1,382,000,000 from August 2020. Assume that the growth rate is 1.1% per year. Predict and print the predicted population for 2021 and 2022. The printout should include the year and the estimated...
Write equivalent LLVM IR for the following SimpleC program. I need the answer ASAP please if...
Write equivalent LLVM IR for the following SimpleC program. I need the answer ASAP please if possible int x; int y; read x; y = x + 1; print y;
C# I need working code please Write a console application that accepts the following JSON as...
C# I need working code please Write a console application that accepts the following JSON as input: {"menu": { "header": "SVG Viewer", "items": [ {"id": "Open"}, {"id": "OpenNew", "label": "Open New"}, null, {"id": "ZoomIn", "label": "Zoom In"}, {"id": "ZoomOut", "label": "Zoom Out"}, {"id": "OriginalView", "label": "Original View"}, null, {"id": "Quality"}, {"id": "Pause"}, {"id": "Mute"}, null, {"id": "Find", "label": "Find..."}, {"id": "FindAgain", "label": "Find Again"}, {"id": "Copy"}, {"id": "CopyAgain", "label": "Copy Again"}, {"id": "CopySVG", "label": "Copy SVG"}, {"id": "ViewSVG", "label": "View...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT