Given the following custom class myclass, which of the following statements are TRUE? Select all that apply. class myClass: def _init_(self, code, name): self.code = code self.name = name self.roster = [] def enrol(self, 1st: list[strl) -> None: "*" Add each element of to the roster once. for item in 1st: if item not in self.roster: self.roster.append (1st)
Q: IN JAVA Which is true? A. Private members can be accessed by a class user B. A mutator is also…
A: A. is CORRECT as Private members can be accessed by a class user B. is INCORRECT as mutator is also…
Q: Write java code files as follows: 1. Generic interface Road with the following methods: getName…
A: code :-- // interface definations interface Road{ // two methods declration String getName();…
Q: Which of the following allows duplicate entries? Group of answer choices A.Map B.List C.None…
A:
Q: A generic class is defined below. Complete the program as told by the comments. public class Sample…
A:
Q: HashMap is a parameterized class. List those of its methods that depend on the types used to…
A: HashMap: hashmap contains on array of Node and a node is represented as a class that contains…
Q: apartmentList is a pointer to the first node in a linked list of nodes. Use this for Parts a, b, and…
A:
Q: Considering the ObjectToClone class below, write a clone method for the class which will return a…
A: If we wаnt tо сreаte а deeр сорy оf оbjeсt X аnd рlасe it in а new оbjeсt Y then…
Q: Given the following code, mhat will the output be? Will the code compile and execute? If so. what…
A: We need to provide output based on code provided;
Q: Given the following custom class myClass,which of the following statements are TRUE? Select all that…
A: option1 : statement is incorrect a we can initializes in constructor without needed to passed as…
Q: Given the following code and assuming ArrayStackis a generic class: bool ArrayStack::doSomething() {…
A: pop() the pop() operation removes the element from the stack and deallocates the memory space.…
Q: When a child class implement a method with same signature of parent class, then the method is www O…
A: Overloading is the concept when two or more methods in one class have same method name and different…
Q: Write java code files as follows: 1. Generic interface Road with the following methods: getName…
A: Road.java ================ //creating generic interfacepublic interface Road<T> { public…
Q: Consider a class that keeps track of the students in a session. An object of this class will have…
A: Given, • Total number of students• Total number of scholarships awarded• Scholarships per student•…
Q: In main(), prompt the user for two items and create two objects of the ItemToPurchase class. Before…
A: In main(), prompt the user for two items and create two objects of the ItemToPurchase class. Before…
Q: A Book struct has been created for you below. Add an instance method on Book called description that…
A: The solution for the above given question is given below:
Q: Given a generic Bucket class, select each of the following that are possible (e.g., exhibit correct…
A: Answer: ii and iii public void setField1( T field1 ){ ... } and public T getField1(){ ... }
Q: Need help writing the following method: getWaitlistedStudents() – returns an array of Students in…
A: From the sample code given, it can be seen that waitlist is a linked list of type students. To…
Q: This is for pygame Text Class The Text class inherits from Drawable and it will be used to display…
A: Instructions for the Text class:Import the Drawable class and pygame module.Create a class Text and…
Q: Given the following class, which of the methods below are valid hashCode() methods for the class?…
A: The correct option along with the explanation is given below.
Q: Given the following custom class myClass, which of the following statements are TRUE? Select all…
A: Python is an interpreted program, object-oriented language, high-level programming language with…
Q: Write a constructor for the IceCreamCup class. The constructor takes the name, and a List of Flavor…
A: Constructor for IceCreamCup class.
Q: (You should complete Self-Check 8.26 before answering this question. Go back to that exercise and…
A: Error1: Declare the attributes private String firstName,lastName;private char middleInitial; Error2:…
Q: Now, in order to make all of this legal, we must have a way to compensate the musical artists for…
A: Below find the solution !!
Q: answer choices 1. All of these iterate through data. 2. HashMap 3. Appendable
A: Explanation: Java HashMap is a hash table-based Map implementation for Java. A Map is a collection…
Q: Given the following custom class myClass, which of the following statements are TRUE? Select all…
A: Following statements are TRUE: - The method enrol is incorrect because it doesn't properly add…
Q: #Q-1 Shyam is a salesforce developer in a multinational company. you have to help him to write a…
A: Given: -
Q: Create class Invoiceltem with following instance variable and methods. Instance variables:…
A: Class is a prototype or abstract data type and it is a new data type defined to store the values of…
Q: QUESTION 5 Suppose there is a class named anotherClass that has an array attribute named books of…
A: GIVEN:
Q: Given the following custom class (myclass, which of the following statements are TRUE? Select all…
A: Below are the answers with explanation:
Q: Code a generic class called Location that describes a point in the xy plane. The Location class…
A: Algorithm : Location class Step 1 : a generic class is created with two parameters <X,Y>.…
Q: Given the following custom class myclass, which of the following statements are TRUE? Select all…
A: Source Code: when I run this code it showing me that invalid syntax.
Q: Write a class named IceCreamcup that implements the Customizable interface. The class should have…
A: Write class named IceCreamCup that implements Customizable interface having the following private…
Q: Below I have a sample class written in java and have several methods. I have only written the…
A: For user: public interface User { public double getname () {} public string getID ()…
Q: Create the Singly Linked List after having executed the following methods. Each item must have a…
A: A Singly Linked List is unidirectional. Each node stores the reference to the next node. Since we…
Q: APEX, Salesforce Desgin the test class for the below method. and Apply the proper asserts to get…
A: Solution as per the given information
Q: Please write a class in Java that contains the following two public methods: aboveBelow accepts two…
A: Answer: Java Source Code: 1. aboveBelow: import java.util.*;import java.io.*; class Main{ public Map…
Q: What is the best first step to include in your implementation of equals(Object o) anytime you…
A: equals() Method helps to compare two Objects. It accepts an object as it’s parameter and then…
Q: [JAVA] Please provide comments to my code import java.util.HashMap; public class Items { private…
A: Find the commented code below
Q: Consider the following code. Replace the tags_??1_and_??2_, respectively, by filling in the text…
A: Question 1: _??1 : foo Explanation: If two interfaces contain a method with the same signature…
Q: Java provides a mechanism that enables a program to be executed from the command line, as an…
A: AS PER GUIDELINES I CANNOT ATTEMPT ALL Java runtime execution is basically used to execute the…
Q: Write a class called BasicPricer. Your class should have the following: A private field called…
A: Below is the required code in java and sample output:
Q: Given the following custom class myClass, which of the following statements are TRUE? Select all…
A: I'm providing the answer to above question, which is incorrect & which is correct as well as…
Q: Hi, can i please get assistance with the following Java class to read data below? Add anything…
A: *** I have made a small change inside the Book class.It's been highlighted in bold*** Book class:…
Q: Which of the following generic class headings is NOT correct, assuming that Vehicle and Laptop are…
A:
Q: Which of the following generic class headings is NOT correct, assuming that Vehicle and Laptop are…
A: Dear Student, Option 1 - You can multiple parameters which extends a class or implements an…
Q: reate the Singly Linked List after having executed the following methods. Each item must have a…
A: Create a class Node that has two credits: information and next. Next is a pointer to the following…
Q: Given the following custom class myClass , which of the following statements are TRUE? Select all…
A: Given class has 3 attributes code, name and roster. -------------- Statement 1 is incorrect. Because…
Q: How can we retrieve the value of hitPoints without allowing any other class to change its value? a)…
A: In the statement #1, we have to import the Pokemon class in go package and the statement for this is…
Q: Given the following custom class myClass , which of the following statements are TRUE? Select all…
A: Given class has 3 attributes code, name and roster.--------------Statement 1 is incorrect. Because…
Q: Creates a class called CourseClass with 6 attributes: a. name: the course name; b. maxStud: a…
A: Java program to accept the Student detail in the CourseClass using different attributes. We have use…
Step by step
Solved in 2 steps
- Given the following custom class myClass ,which of the following statements are TRUE? Select all that apply. class myClass: def _init__(self, code, name): self.code = code self.name = name self.roster = 0 def enrol(self, 1st: list[str]) -> None: """ Add each element of to the roster once. I" II II for item in lst: if item not in self.roster: self.roster.append(lst) n The attribute roster cannot be defined, since it's not a parameter of the initializer. The method enrol is correct. n The method enrol is incorrect because it doesn't properly add elements to the roster. The method enrol is incorrect because it doesn't properly ignore duplicate string elements. The method enrol is incorrect because it doesn't return anything. The initializer is incorrect as it creates more attributes than are passed. n The command print(c.roster) prints the list roster, where c is an instance of myClass. n The command print(c.roster) prints a memory address, as _repr__ or __str__ aren't defined. ---Please written by computer source What will the application do? Display a set of at least 6 cars (at least 3 new and 3 used) along with Add and Quit options Let the user select one of the cars. Ask if they want to buy the car. If they enter yes, remove it from the list. If they want to add another car to the list, get the details, create a new instance of the appropriate class (Car class for new cars, or UsedCar), and add it to your data collection. Keep looping until they choose to quit. Build Specifications If your instructors tells you to work in pairs, stay with your assigned pair for this lab. Create a class named Car to store the data about a car. This class should contain:Data members for car details A string for the make A string for the model An int for the year A decimal for the price A no-arguments constructor that sets data members to default values (blanks or your choice) A constructor with four arguments matching the order above Properties for all data members An…Exercise 2. Create a Book class where: Each book contains the following information: book title book Author name, barcode (as fong integers), and book topic. o Implement an appropriate constructor(s) and all necessary get/set methods. Test Book class: o Create diffcrent book objects (at least 5 hooks) and store them in a LinkedList sorted by book barcode value Generate a unique random integer value for the barcode. Iterate through the LinkedList and print out the books' details O Create a second LinkedList object containing a copy of the above LinkedList, but in reverse order.
- Task 4. Utility classes Implement a Menu-Driven program of ArrayList class using the above scenario and perform the following operations. Create an object of ArrayList class based on the scenario with explanations of the method Create a method that will allow inserting an element to ArrayList Class based on the scenario. The input field must be validated as Create a method to delete specific elements in the ArrayList with explanations of the methodCRS Given the following custom class myClass, which of the following statements are TRUE? Select all that apply: Esignments class myClass: uizzes def init_(self, code, name): self.code self.name = name self.roster- [] code odules def enrol (self, 1st: list[str]) -> None: "" Add each element of to the roster once. for item in 1st: if item not in self.roster: self.roster. append (1st) O The attribute roster cannot be defined, since it's not a parameter of the initializer. O The method enrol is correct. O The method enrol is incorrect because it doesn't properly add elements to the roster. A The metnod enrol is incorrect because it coesr't properly ignore duplicate string elements, O The method enrolis incorrect ause it sn't returm anything C The initializer is incorrectas it creates more attrisutes than are passed. The command printc roster) prints the list roster, where c is an instance of myClass. The command print(c roster prints a memory address. as repr or strill brert defined.Write a statement to create an array, named productList, in a supportive class, with a size of TEN and a data type of String: Question 7 (Mandatory) Write an invoke statement for the currentCircle object from the Circle class, to the behavior setCircleRadius, that invokes validateRadius in the parameters, which passes input in the parameters: ); Question 8 (Mandatory) Write a test condition for a selection structure that tests the values of the Strings named, userName and borrowedUserName, where case matters and the results will be -1, 0 or 1: Question 9 (Mandatory). Write a test condition for a selection structure that tests the values of the Strings named, userName and borrowedUserName, where case does not matter and the results will be true or false:
- Given the following custom class myClass , which of the following statements are TRUE? Select all that apply. class myClass: def _init_(self, code, name): self.code = code self.name = name self.roster = [] def enrol(self, 1st: list[str]) -> None: """ Add each element of to the roster once. for item in 1st: if item not in self.roster: self.roster.append(1st) O The attribute roster cannot be defined, since it's not a parameter of the initializer. O The method enrol is correct. O The method enrol is incorrect because it doesn't properly add elements to the roster. O The method enrol is incorrect because it doesn't properly ignore duplicate string elements. O The method enrol is incorrect because it doesn't return anything. O The initializer is incorrect as it creates more attributes than are passed. O The command print(c.roster) prints the list roster, where cis an instance of myClass. O The command print(c.roster) prints a memory address, as _repr_ or_str_ aren't defined.Design a class called Post. This class models a StackOverflow post. It should have properties for title, description and the date/time it was created. We should be able to up-vote or down-vote a post. We should also be able to see the current vote value. In the main method, create a post, up-vote and down-vote it a few times and then display the the current vote value.Create a server class called Course and a class called Student Class Student a string called studentid a string called firstName a string called lastName the Student class will have a 3 parameter constructor with parameter for id, first name and last name of the student. it will also contain getter methods for all instance varibales and a toString method that returns the id, first name and last name Class Course a string called courseName an array of Student objects called studentArray an int called numberOfStudents A Course object: can be created using a 1 paramter constructor(the name of the course) you can add students to the course using an addStudent method which has 1 paramter consisting of a new Student object. whenever a new student is added to the course, numberOfStudents is increased you can drop a student(remove a student from the array of Students) from the course usinf a dropStudent method which has 1 parameter consisting of a String representing the id of the Student…
- Creates a class called CourseClass with 6 attributes: a. name: the course name; b. maxStud: a maximum number of Student into the CourseClass; c. nbStud: the current number of Student into the CourseClass. When a CourseClass is created, the number nbStud is equal to 0; d. Student Stud[]: an array of Student. The size of this array is equal to maxStud; e. CourseTeacher: the Teacher (of type Teacher) responsible of this course; f. LabTA: The TA (of type TA) responsible of the course's Lab; Add the following methods: e. Constructor: able to create a CourseClass with maximum 10 Students; f. overload the operator += (Student): able to add a Student to the CourseClass. The Student will be added to the Stud array. You need to be sure that an available space exits (uses the function assert); g. find(StudentName): this method allows to find a Student by his Name. If it exists, the Student will be displayed, else, am error message will be displayed; h. display: this method aims to display all…Observer pattern The PhoneModel class stores a phone number as a list of digits, and the Keypad class has this method: public void simulateKeyPresses(int numKeyPresses)(0 that allows the user to enter digits one at a time then save each digit in the list. The Screen wants to respond to each key being entered. Make the model notify the observers whenever a new digit is entered for the phone number. The first observer prints the newest digit out to the screen The second observer prints "Now dialing 12345678901.." out to the screen (where the number is the number the model has). Only the Screen class can print to the screen The model must be decoupled from the Other classes.#ClubMember classclass ClubMember: #__init_ functiondef __init__(self,id,name,gender,weight,phone):self.id = idself.name = nameself.gender = genderself.weight = weightself.phone = phone #__str__ functiondef __str__(self):return "Id:"+str(self.id)+",Name:"+self.name+",Gender:"+self.gender+",Weight:"+str(self.weight)+",Phone:"+str(self.phone) #Club classclass Club: #__init__ functiondef __init__(self,name):self.name = nameself.members = {}self.membersCount = 0 def run(self):print("Welcome to "+self.name+"!")while True:print("""1. Add New Member2. View Member Info3. Search for a member4. Browse All Members5. Edit Member6. Delete a Member7. Exit""") choice = int(input("Choice:")) if choice == 1:self.membersCount = self.membersCount+1id = self.membersCountname = input("Member name:")gender = input("Gender:")weight = int(input("Weight:"))phone = int(input("Phone No.")) member = ClubMember(id,name,gender,weight,phone)self.members[id] = memberelif choice == 2:name = input("Enter name of…