Question: Microsoft Visual C#: An Introduction to Object-Oriented Programming, 7th Edition. 2017 Chapter 11, page 531 - 532 Please keep it as simple as possible. I
Microsoft Visual C#: An Introduction to Object-Oriented Programming, 7th Edition. 2017 Chapter 11, page 531 - 532
Please keep it as simple as possible.
I need help adjusting these programs to look exactly like the screenshots posted for problems 2 and 3, here's what I have:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using static System.Console; namespace SwimmingWaterTemperature { class Program { static void Main(string[] args) { const string QUIT = "999"; string temp; double degrees; bool isAccepted; Write("Enter temperature or {0} to quit >> ", QUIT); temp = ReadLine();
while (!temp.Equals(QUIT)) { Write("Enter another temperature or {0} to quit >> ", QUIT); double.TryParse(ReadLine(), out degrees); try { isAccepted = DetermineAcceptableTemp(degrees); if (isAccepted) WriteLine("{0} degrees is comfortable for swimming.", degrees); else WriteLine("{0} degrees is not comfortable for swimming.", degrees); } catch (ArgumentException e) { WriteLine(e.Message); WriteLine(); }
}
}
private static bool DetermineAcceptableTemp(double degrees) { bool accepted; if (degrees >= 70 && degrees 212) throw (new ArgumentException());
return accepted; } } }
and the second one
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using static System.Console; using static System.Math;
namespace FindSquareRoot { class Program { static void Main(string[] args)
try { Write("Enter a number: "); num = Convert.ToDouble(ReadLine());
if (num
the results for both should match the screenshots EXACTLY;


.
CWINDOwS)system321cmd.exe Enter temperature or 999 to quit 25 Value does not fall within the expected range. Enter another temperature or 999 to quit 25e Value does not fall within the expected range. Enter another temperature or 999 to quit > 55 55 degrees is not comfortable for swimming Enter another temperature or 999 to quit > 75 5 degrees is comortable for swimming. 999 Enter another temperature or 999 to quit Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
