Stacks and Queues Q4 (R15.25 and R15.26) - Read section 15.6.4 about using a sta
ID: 3600308 • Letter: S
Question
Stacks and Queues Q4 (R15.25 and R15.26) - Read section 15.6.4 about using a stack to traverse a maze. Write out the order of letters encountered in the maze on page 714 of Big Java using a stack (R15.25) and a queue (R15.26) Exceptions Q5 (R11.8) Why don't you need to declare that your method might throw an IndexOutOfBounds exception? Q6 (R11.10) What happens if an exception does not have a matching catch clause? Algorithms Q7 (Chapter 5 problem 4 from the MSD textbook) Consider the following outline of a program See book for details). Assuming that n is the problem size, what would be the critical section of this program? Why?Explanation / Answer
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Programs { public class Student { public string First { get; set; } public string Last { get; set; } public int ID { get; set; } public List Marks; public ContactInfo GetContactInfo(Programs pg, int id) { ContactInfo allinfo = (from ci in pg.contactList where ci.ID == id select ci) .FirstOrDefault(); return allinfo; } public override string ToString() { return First + "" + Last + " : " + ID; } } public class ContactInfo { public int ID { get; set; } public string Email { get; set; } public string Phone { get; set; } public override string ToString() { return Email + "," + Phone; } } public class ScoreInfo { public double Average { get; set; } public int ID { get; set; } } List students = new List() { new Student {First="Tom", Last=".S", ID=1, Marks= new List() {97, 92, 81, 60}}, new Student {First="Jerry", Last=".M", ID=2, Marks= new List() {75, 84, 91, 39}}, new Student {First="Bob", Last=".P", ID=3, Marks= new List() {88, 94, 65, 91}}, new Student {First="Mark", Last=".G", ID=4, Marks= new List() {97, 89, 85, 82}}, }; List contactList = new List() { new ContactInfo {ID=111, Email="Tom@abc.com", Phone="9328298765"}, new ContactInfo {ID=112, Email="Jerry123@aaa.com", Phone="9876543201"}, new ContactInfo {ID=113, Email="Bobstar@aaa.com", Phone="9087467653"}, new ContactInfo {ID=114, Email="Markantony@qqq.com", Phone="9870098761"} }; static void Main(string[] args) { Programs pg = new Programs(); IEnumerable studentQuery1 = from student in pg.students where student.ID > 1 select student; Console.WriteLine("Query : Select range_variable"); Console.WriteLine("Name : ID"); foreach (Student s in studentQuery1) { Console.WriteLine(s.ToString()); } Console.ReadLine(); } }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.