Question
Using C#: 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
Using C#:
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
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 4 th 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="fdgfAgaf[arg^sdf^sf%]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 f.
14. Given DateTime Y= DateTime.Parse("12/1/05 1:00pm"); and, double Z =43.546; , write the Console.WriteLine() statements necessary to output the following (the underlined values must come from Y and Z):
a. Dec. 1, 2005 was a dark and stormy day. It was a cold 44 degrees.
b. Meet me at 1:00PM on Thursday, December 1 at the clock tower. Bring $43.55 with you
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