3 Description of methods to be written
Before starting to code, look at the public tests to understand how your class will be used and your methods will be tested.
In the starting code in your CVS repository each method in the Quuly class that you have to write just throws an exception (an UnsupportedOperationException). Remove the exception and write each method.
3.1 Quuly (int maxVisits)
The Quuly constructor should initialize a new Quuly object (that has whatever fields you need it to have). When it is first instantiated. a Quuly object) is not storing any students, and no one is in office hours. As mentioned above, in our simulation of Quuly a student is only able to come to office hours a certain number of times per day: this can vary between different Quuly objects though (in the real Quuly this limit is configurable for each course). The value of maxVisits gives the maximum times that each student can come to office hours in a day in the new Quuly object.
If the value of maxVisits is zero or negative then 1 should just be used instead. (An office hours object that does not allow students to ever come to office hours would be useless.)
3.2 boolean addStudent (String newStudentName, Integer newStudentID) Students can come to office hours for a course after they have been entered into the Quuly system for it. This method should add a student with name newStudentName and ID newStudentID to its current Quuly object and return true. The number of students who are in the course that the current Quuly object is being used to store will increase by one. Note that student IDs are unique, SO two students can't have identical IDs. As in real life. different students can have the same names, but their IDs must be unique in a Quuly object. So if there is already a student in the course (i.e., a student already being stored in the Quuly object) whose ID has the same value as newStudentID the new student should not be added. and the method should just return false without changing anything. It should also return false without changing anything if either parameter is null. or newStudentName is an empty string (students must have nonempty names), or newStudentID is not greater than zero.
The way that students are stored in a Quuly object is up to you, subject to the constraints in Section so be sure to read that section carefully.
Your code should allow multiple Quuly objects to be created and manipulated simultaneously, and their data should not conflict. One Quuly object stores its own students, who may have the same IDs as those in another Quuly object (because a student can be taking more than one course that uses Quuly). and adding a student to one Quuly object has no effect on the students in any other Quuly objects.
3.3 int numStudents(
This method should return the number of students being stored its current Quuly object, meaning how many were added by earlier calls to addStudent () (and have not been subsequently removed).
3.4 boolean addStudentToQueue (Integer id)
student has been added to a Quuly object they can come to office hours, which is what receive this method help in simulates. Once a This method should add the student with ID id to the quene of students waiting to office hours, and return true. However, if id is null or there is no student with ID id who is being stored in were subsequently removed) then the method should return false without changing anything. the Quuly added object but (meaning that no student with that ID was added by an earlier call to addStudent (), or they
A student cannot be waiting for help in office hours more than once simultaneously. SO if the student with ID id is already in the queue they should not be added again, and the method should also just return false.
Lastly, as discussed above, a student can only come to office hours a maximum number of times per day in a course using Quuly. If the student with ID id has already joined the queue the maximum number of times- meaning the value of maxVisits that was passed into the constructor (or 1 if it was zero or negative) then the student should also not be added to the queue and the method should also just return false.
The way that students in the queue waiting for help in office hours are stored is up to you, subject to the constraints in Section , SO be sure to read that section carefully.
If the student (with the same ID) is also being stored in other Quuly objects, adding them to the queue in one Quuly object does not affect them in other Quuly objects.
3.5 int queueSize()
This method should return the number of students who are waiting for help in office hours in the current Quuly object, meaning that they are in its queue. The result will be zero or more, and will be zero before any successful calls are made to addStudentToQueue (). The maximum value that the method can return will be the same as the number of students currently in the Quuly object (the value returned by numStudents ()), if every student in the course is currently waiting for help in office hours (office hours will be busy in that case).

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

package quuly;

import java.util.ArrayList;

* @author
public class Quuly {

    private class Student {

       private String name;
       private int id;
       private int visit;

       public Student() {
            name = "";
            id = 0;
            visit = 0;

       public Student(String name, int id) {
   = name;
   = id;
            visit = 0;

       public String getName() {
            return name;

       public int getId() {
            return id;

       public void setName(String name) {
   = name;

       public void setId(int id) {
   = id...

By purchasing this solution you'll be able to access the following files:

for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats