Answered step by step
Verified Expert Solution
Question
1 Approved Answer
8. Write a console program that reads two pairs of grid coordinates (X1,Y1) and (X2,Y2) from the user, and then calculates and outputs to the
8. Write a console program that reads two pairs of grid coordinates (X1,Y1) and (X2,Y2) from the user, and then calculates and outputs to the console window the Euclidean and Rectilinear (or Manhattan) distance between the two points. The equations are: Euclidean Distance .(X1-X2). + (n-Y2). Rectilinear Distance- Abs(Xl - X2) + Abs(Y1- Y2) 9. Given the statement DateTime Y = DateTime.Parse("12/1/09 1:00 pm"); give the code statements to do each of the following: a. Display the number of seconds between now and Y b. Set Z (also a DateTime type) equal to exactly 4 weeks prior to Y c. Display the day (e.g. Monday, Tuesday) of week of Y d. Display the day of year of Y 10. Write a console program that does the following: a) Declares a variable D of type DateTime; 2) reads in a datetime value from the user and assigns it to D; 3) Displays the number of minutes from D to the end of the year D occurs in. 11. Given the statement string X"x1wertertdf"; string Y; give the code statements to do each of the following (a). Replace all the "e" characters with "k", and assign the result to Y (b). Display the character position of the first "t" from the 3rd character (inclusive (c). Assign the substring between 4th and 8th characters to Y (inclusive) (d). Change all the characters to upper case, and assign the result to Y (e). Display the position of the first "E" in X (f). Repeat (e) using a case-insensitive search. 12. Given the following string, write a console program to (a) convert the entire string to upper case and assign it to S, (b) extract the substring between the [ and] characters, break up the substring into smaller substrings based on the character, and assign the first element to T string T; String S-"fdgfAgaflarg'sdfng1%]gfg": 13. Given a forward slash "" separated list of values entered by a user on a single line, convert to a string array and output the 2nd and 4th items. Replace any "r" in the 2nd item with
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