Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write the code in C# Write a program which will query the user to type A, S, M, D, or Q, to represent add,
Please write the code in C#
Write a program which will query the user to type "A", "S", "M", "D", or "Q, to represent add, subtract, multiply, divide or quit. The program should next ask the user to input a dms (degrees, minutes, seconds) type value, for example, 135 24 30" In the case of addition and subtraction, the program should request another value of type dms, and then display the result of the addition or subtraction. In the case of multiplication of division, the program should request a double, and then perform the operation. The dms value must be value checked. For the basic 100 points, insure it contains a degree, minute, and second mark, and appropriate values for each part. Degrees and minutes should be ints. Seconds should be a double. You may use a # for the degree symbol if you wish You must create a DDMS class, complete with appropriate fields, properties, and methods. You class must have some constructor methods, a ToString, and a TryParse at minimum It is suggested that you make use of the GetString and GetDouble routines previously discussed, and create your own GetDDMS method in your program.cs file Hints: It is suggested that you store this value internally as just a double, and when requeste print out the value in degrees, minutes, and seconds configuration. You may use the # for degrees when specifying input or, as discussed in class you mar use the degree symbol (ALT-248). This should only affect your TryParse routine Extra Credit: [first +50] At minimum, the DDMS TryParse routine should parse a string with all three components specified. For up to 50 extra points, write the TryParse to accept 1, 2 or a three parts of a dms type value. For example, all of the following should parse: 4 3' 3.5" 123 3.5" 90 23' 15' 17"834 54 second +50 Insure values are normalized for up to 50 points extra. For example 180 90' 90" plus 0should be 181 31' 30" Likewise, values should be normalized to they are always positive. For example 90 45' 20" minus 180 89" 50" should be 269 15' 30 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