Write a code in C# that finds the smallest ID of a subject taught by the most teachers without using any Linq Lib's elements, such as OrderBy, OrderByDescending, etc:
We know about the teachers at a school, what lessons they have and when. We identify the teachers, the subjects, the days of the week and the time slots in a day with ID numbers. Write a program that determines the subject that is taught by the most teachers.
Input
The first line of the standard input contains the count of lessons (1≤L≤800), the count of teachers (1≤N≤100), the count of subjects (1≤M≤100), the ID of a teacher (1≤T≤N) and the ID of a day (1≤D≤5), separated by spaces. The next L lines contain 4 integers separated by spaces: the ID of the teacher (1≤TID≤N), the ID of subject taught (1≤TS≤M), day (1≤Day≤5), and time slot (0≤Time≤8) of a lesson. For example, 3 7 2 1 means that the third teacher teaches the seventh subject on the second day of the week in the first time slot.
Output
The first line of the standard output should contain the ID of the subject that is taught by the most teachers. If there is more than one solution, give the smallest ID.
Example:
Input
8 3 4 1 1
1 1 1 6
1 1 2 2
1 2 1 3
2 1 2 2
2 2 3 1
3 4 1 2
3 2 1 4
3 3 2 1
Output:
2
Step by stepSolved in 4 steps with 3 images
- Write a C#program that uses a class called ClassRegistration as outlined below: The ClassRegistration class is responsible for keeping track of the student id numbers for students that register for a particular class. Each class has a maximum number of students that it can accommodate. Responsibilities of the ClassRegistration class: It is responsible for storing the student id numbers for a particular class (in an array of integers) It is responsible for adding new student id numbers to this list (returns boolean) It is responsible for checking if a student id is in the list (returns a boolean) It is responsible for getting a list of all students in the class (returns a string). It is responsible for returning the number of students registered for the class (returns an integer) It is responsible for returning the maximum number of students the class is allowed (returns an integer) It is responsible for returning the name of the class. (returns a string) ClassRegistration -…arrow_forwardWrite a C++ Program using classes, functions (recursive and otherwise), arrays and other C++ commands for a friendly game of BlackJack (no bets), according to the rules in Wikipedia. The program would ask if the user wants to play a game and draw the cards. Depending on the drawn cards, the game would progres according to the rules. When the game ends, the program asks if the user wants to play again. You can use a Joker of any card type as a Wild Card valued up to the highest rated card in the deck needed to complete the card hand, if applicable; if not, the player decides the value of the Joker for their card hard (user's hand or program' hand). The game will keep running as long as the user states so.arrow_forwardThe Java code must have the structure as shoen in the picture: Develop with Java programming language a calculator (console application) that takes a number, a basic math operator ( + , - , * , / , % ), and a second number all from user input, and have it print the result of the mathematical operation. The mathematical operations should be wrapped inside of functions. Note: Do please use the provided source code template to implement your solution. The purpose of this problem is not only to assess the students' ability to build a valid implementation but also to assess the ability to read the Java code. Input: On single line a number, a basic math operator ( + , - , * , / , % ), and a second number all from user input. Output: On new line result of the mathematical operation. In the case of "Division by zero" you must printout the text message "Error". Example 1: 4 + 812 Example 2: 4 * 832 Example 3: 4 % 20 Example 4 4/0 Error Example 5: 4-10 -6arrow_forward
- Design ADT for a cave and a cave system. An archeologist should be able to add a newly discovered cave to a cave system and to connect two caves together by a tunnel. Duplicate caves—based on GPS coordinates—are not permitted. Archeologists should also be able to list the caves in a given cave system. Specify each ADT operation by stating its purpose, describing its parameters, and writing a pseudocode version of its header. Then Java interface for a cave's methods and one for the methods of a cave system. Include javadoc-style comments in your code. Java programarrow_forwardCreate a C++ address book using the following information: The address should contain a Person class. string firstName; string middleName; string lastName; Each person’s detailed address should be provided as follows: int block; int unit; int floor; string street; string city; string country; int postalCode; Write appropriate getters/ setters and test your implementation.arrow_forwardIn C, what does the malloc() method do? Group of answer choices Dynamically allocates a block of memory with the specified size. Releases a block of memory with the specified size. Reconfigures a block of memory with the specified size. Determines the amount of memory used by a given structure variablearrow_forward
- Write a C++ Program using classes, functions (recursive and otherwise), arrays and other C++ commands for a friendly game of BlackJack (no bets), according to the rules in Wikipedia. The program would ask if the user wants to play a game and draw the cards. Depending on the drawn cards, the game would progres according to the rules. When the game ends, the program asks if the user wants to play again. You can use a Joker of any card type as a Wild Card valued up to the highest rated card in the deck needed to complete the card hand, if applicable; if not, the player decides the value of the Joker for their card hard (user s hand or program' hand). The game will keep running as long as the user states so.arrow_forwardImplement a C++ program for a RESTAURANT that has multiple branches, and each branch has menus of food items, their stock and a list of customers. A branch may have for example a breakfast menu and lunch menu with different food items, and the stock (available quantity) of each food item in the branch. Also, the branch will have a list of regular customers and their contact information to contact them for offers and new food items. Class Names Data and Member Functions Food Data Members: ID, Name, Calories, Price Member Functions: getID, getName, getCalories, getPrice setID, setName, setCalories, setPrice Stock Data Members: ID, Food, Stock Member Functions: getID, getFood, getStock setID, setFood, setStock Customer Data Members: ID, Name, Phone Member Functions: getID, getName, getPhone setID, setName, setPhoe Menu Data Members: ID, Name, foodList Member Functions: getID, getName, getFoodList setID, setName Branch Data Members: ID, Address, menuList, stockList, customerList Member…arrow_forwardjavascript Need help defining a function frequencyAnalysis that accepts a string of lower-case letters as a parameter. frequencyAnalysis should return an object containing the amount of times each letter appeared in the string. example frequencyAnalysis('abca'); // => {a: 2, b: 1, c: 1}arrow_forward
- Create a social network, Chirper, that lets the user add new Chirps and like existing Chirps. It's lonely because only one person can add and like messages -- so there's really not much "social" about it. At least you can practice using objects, references, and function overloading in C++! Here's an example of how this program will run You can "chirp" a new message to Chirper, or "like" an existing chirp, or "exit". What do you want to do? chirp What's your message? This is my first chirp! Chirper has 1 chirps: 1. This is my first chirp! (0 likes) You can "chirp" a new message to Chirper, or "like" an existing chirp, or "exit". What do you want to do? like Which index do you want to like? 1 Chirper has 1 chirps: 1. This is my first chirp! (1 likes) You can "chirp" a new message to Chirper, or "like" an existing chirp, or "exit". What do you want to do? chirp What's your message? Second chirp is the best chirp. Chirper has 2 chirps: 1. This is my first chirp! (1 likes) 2. Second chirp…arrow_forwardIn C++ Create a new project named lab9_1 . You will need to implement a Course class. Here is its UML diagram: Course - department : string- course_num : string- section : int- num_students : int- is_full : bool + Course()+ Course(string, string, int, int)+ setDepartment(string) : void+ setNumber(string) : void+ setSection(int) : void+ setStudents(int) : void+ getDepartment() const : string+ getNumber() const : string+ getSection() const : int+ getStudents() const : int+ print() const : void Create a sample file to read from: CSS 2A 1111 35 Additional information: The Course class has two constructors. Make sure you have default values for your default constructor. Each course maxes out at 40 students. Therefore, you need to make sure that there aren’t more than 40 students in a Course. You can choose how you handle situations where more than 40 students are added. Additionally, you should automatically set is_full to false or true, based on the number of…arrow_forwardIn C++ Create a new project named lab8_1. You will be implementing two classes: A Book class, and a Bookshelf class. The Bookshelf has a Book object (actually 3 of them). You will be able to choose what Book to place in each Bookshelf. Here are their UML diagrams Book class UML Book - author : string- title : string- id : int- count : static int + Book()+ Book(string, string)+ setAuthor(string) : void+ setTitle(string) : void+ print() : void+ setID() : void And the Bookshelf class UML Bookshelf - book1 : Book- book2 : Book- book3 : Book + Bookshelf()+ Bookshelf(Book, Book, Book)+ setBook1(Book) : void+ setBook2(Book) : void+ setBook3(Book) : void+ print() : void Some additional information: The Book class also has two constructors, which again offer the option of declaring a Book object with an author and title, or using the default constructor to set the author and title later, via the setters . The Book class will have a static member variable…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education