Question 7. Assuming a Circle class contains a single instance variable radius and the setters, getters and constructors are all defined, what is the value of result when the following client code is executed? Circle c = new Circle (4) ; 2 Circle d- c; d. setRadius (d. getRadius () + 2); int result = c. getRadius (); 3 4 А. О В. 2 С. 4 D. 6 E. None of the above
Q: What is the output of the following code? public interface finalExam { int x = 10; void…
A: The code snippet declares an interface finalExam with x=10 and two abstract methods finalMethod()…
Q: Which of the following allows duplicate entries? Group of answer choices A.Map B.List C.None…
A:
Q: An Electronics Shop wants to keep track of its inventory. It needs to save information about each…
A:
Q: Define a class Line that has four private instance variables: (x1, y1) and (x2, y2), representing…
A: I am using java programming to solve the question.
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: Answer the following questions: a. Is fl instanceof Fruit? b. Is fl instanceof Orange? c. Is fl…
A: In given hierarchy, Fruit is Base Class. Apple, Orange are inherited from Fruit and GoldenDelicious,…
Q: Class Student needs to create different constructors, but only have the initialization of instances…
A: Here we have given an example to create different constructors
Q: Given the following Person class, write a Boolean method called somethingsWrong() to determine if…
A: Question given: A scratch code of a class and it's methods is given. Define a new method boolean…
Q: Consider the following code. Replace the tags _??1_ and _??2_, respectively, by filling in the text…
A: _??1_= ',' So the statement becomes: interface myInterface extends A,B{ } _??2_=trim interface…
Q: 1)a pytest can be implemented as a method in a class a ) true b) false 2) a rule of thumb is that…
A: Given statement true or false
Q: is needed to create a new instance of the class? O A field O An instance attribute OA constructor A…
A: A class is a collection of attributes and methods which act as a template to create different…
Q: Project, with two attributes; projectNo (int) & location (string). Add the following: a…
A: 1- In this assignment require, three classes Person, Supervisor, and App with constructor, toString,…
Q: QUESTION 9 What are the different visibility modifiers? Differentiate between them. QUESTION 10…
A: 9. The visibility modifiers are listed below: Public Protected Private Default or internal
Q: Design a program using Java - Apache NetBeans. With the following enum class: public enum Day {…
A: Given: public enum Day {SUNDAY, MONDAY, TUESDAY, WEDNESDAY,THURSDAY, FRIDAY, SATURDAY}
Q: Does a constructor have any means of indicating to a client that it cannot correctly set up the new…
A: THE ANSWER IS
Q: 1. A class with no access modifier can be accessed by package-mate classes without being imported.…
A: Find the answer with explanation given as below :
Q: What type of relationship exists between someMeth in class A and someMeth in class B? class A{…
A: Over riding and overloading are complementary things.
Q: For which of these visibility modifiers, the attributes and methods of a super class be accesse from…
A: Dear Student, Void is not a visibility modifier , We can access the attributes and methods of a…
Q: What is the output of the following code? public interface finalExam { int x = 10; void…
A: Hello student. Warm welcome from my side. Hope you are doing great. I will try my best to answer…
Q: Write a Java program to calculate the area of square and rectangle. Initialize the side of the…
A: According to the question below the Solution: Output:
Q: consider the following code snippet: class A{ public: A0{ class B: private A{ B); }; main0{ B *b =…
A: Definition: Constructor: It is an object oriented programming language that is based on the…
Q: using Java, create a class where the user will receive a notification if they have been inactive for…
A: MainActivity.java package com.example.comeback; import android.app.Activity; import…
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: For this exercise, you will be given a project file digital_pet containing two (2) classes, the…
A: Since you are not mentioning the programming language, here we are using Java to complete the…
Q: QUESTION 5 Suppose there is a class named anotherClass that has an array attribute named books of…
A: GIVEN:
Q: Create a class AccessPoint with the following attributes: x - a double representing the x…
A:
Q: Given the following custom class (myclass, which of the following statements are TRUE? Select all…
A: Below are the answers with explanation:
Q: Given the following class definition: public class CountModel implements Runnable { public enum…
A: So we have to implement run() Method 1) which execute until its status attribute is set to STOPPED…
Q: You are working on the project in which you have to create the apex code in which your task is to…
A: Brief Introduction: Dynamic Identifier helps developers to create flexible applications by giving…
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: CHALLENGE 7.14.1: Mutators, accessors, and private helpers. ACTIVITY 351188 2286286.qx3zay7 Jump to…
A: I give the output ,screenshot as the evidence ,code in text form
Q: Please complete the following tasks: Write a class “Actor” that contains two attributes with the…
A: As language not defined doing it in Java Programming Language.
Q: Q# A program that has no graphical user interface and only takes input through the command line only…
A: Note: Since the Question is multiple one. We are advised to do only first question. Kindly post…
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: constructors for two JavaScript object classes
A: Given :- In the above question, suppose we have written constructors for two JavaScript object…
Q: Given the classes below, what are the class types of instance sc? Check all correct answers. -1…
A: OOP or Object-Oriented Programming is a software model that is designed around data or objects…
Q: Given the classes below, what are the class types of instance yt? Check all correct answers. -1…
A: When multiple classes are involved and their parent-child relation is formed in a chained way then…
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: creating more than one Scanner instance that read the input from the console potentially causes…
A: Scanner: It is used to read the input from the console. Syntax: Scanner input=new…
Q: I asked the following question 2 days ago, and you have just sent the java code (racket trajectory)…
A: import java.awt.*; // for Graphics import java.io.*; // For reading file public class…
Q: Create a method that will ask the user to enter a day of a week and the program should tell the mood…
A: Below is the required code in java:
Q: Given the classes below, what are the class types of instance m? Check all correct answers. -1…
A: Concepts used in the above program: Inheritance: It is OOP concept where one class inherits all the…
Q: 2. Using the BasketballTeam class above, write a complete demo driver class on the next page, which…
A: 1.create a main function to execute the class2.Creating two teams for the match3.Runs the loop 40…
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: A constructor that takes an existing user as well as a new userID. * It should create a new user…
A: As, you have not provided the implementation information of the twitteruser class. i just did the…
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…
Find the attached file.
Step by step
Solved in 3 steps
- Define a class Job which has three property (name, salary, description) and two behavior (getSalary, getLengthOfName) 1- Write two constructor method for the following class? 2- Implement following interface?Write a complete program for the description given below. Consider a Billing class that implements an interface Payable having a method getTotalPayment Amount(). Besides this, you have a Doctor class with private instance variables (docID, docName, and docFee) and a public getDoc() method, Patient class with private instance variables (pName, pID. pDisease), Medicine class with private instance variables (medID, medName, medQty, medPrice), and Medical Test class with private instance variables (testID, testName, testPrice). Each of these classes has the toString() method to display the information of its object. The Billing class is having "Has A" relationship with the other four classes (Doctor, Patient, Medicine, and MedicalTest) mentioned above. The getPayment Amount() method of Billing class returns the total billing amount that includes doc fee, medicine cost, and medical test fee that a patient has to pay. After implementing these classes, you are required to do the following in…Using JAVA Language Consider a Billing class that implements an interface Payable having a method getTotalPaymentAmount(). Besides this, you have a Doctor class with private instance variables (docID, docName, and docFee) and a public getDoc() method, Patient class with private instance variables (pName, pID, pDisease), Medicine class with private instance variables (medID, medName, medQty, medPrice), and MedicalTest class with private instance variables (testID, testName, testPrice). Each of these classes has the toString() method to display the information of its object. The Billing class is having "Has A" relationship with the other four classes (Doctor, Patient, Medicine, and MedicalTest) mentioned above. The getPaymentAmount() method of Billing class returns the total billing amount that includes doc fee, medicine cost, and medical test fee that a patient has to pay. After implementing these classes, you are required to do the following in the driver class: Create an ArrayList of…
- Consider the following code snippet. 1. /* 2. * The Student class models a student with a name, age 3. * and a faculty in which is currently enrolled in. 4. */ 5. public class Student 6. { 7. // private instance variable, not accessible from outside this class 8. private String firstName; 9. private String lastName; 10. private int birthYear; 11. private String faculty; 12. 13. // The constructor with the. correspondent parameters. 14. public Student(String first, String last, int birthYear, String faculty) 15. { 16. this.firstName= first; 17. this.lastName = last; 18. this.birthYear = birthYear; 19. this.faculty = faculty; 20. } 21. } 1. Implement an accessor method that returns the age of the student given as parameter the current year. 2. Implement a new method called printDetails, taking the currentYear as a parameter, that prints the full name, age and faculty of the student in the following way: Full name: Donald Duck Age: 24 years Faculty:…using Java, create a class where the user will receive a notification if they have been inactive for a week. Make sure each class has at least two attributes (instance variables) and two methods, plus a constructor to initialize any attributes as needed. Once you have written the classes, use the JUnit features in NetBeans to create unit tests for your two classes.In python how do you: Complete the FoodItem class by adding a constructor to initialize a food item. The constructor should initialize the name to "None" and all other instance attributes to 0.0 by default. If the constructor is called with a food name, grams of fat, grams of carbohydrates, and grams of protein, the constructor should assign each instance attribute with the appropriate parameter value. The given program accepts as input a food item name, fat, carbs, and protein and the number of servings. The program creates a food item using the constructor parameters' default values and a food item using the input values. The program outputs the nutritional information and calories per serving for both food items. Ex: If the input is: M&M's 10.0 34.0 2.0 1.0 where M&M's is the food name, 10.0 is the grams of fat, 34.0 is the grams of carbohydrates, 2.0 is the grams of protein, and 1.0 is the number of servings, the output is: Nutritional information per serving of None:…
- For this exercise, you are given a Team superclass with a BaseballTeam and FootballTeam subclass. Take a moment to examine these classes and the instance variables and methods in each. In the TeamTester class, you will see three objects declared and instantiated using the Team, FootballTeam, or BaseballTeam classes. For each object, use a print statement to print out any public method that returns information that is available for that particular object, including the toString. For example, the dolphin object is a FootballTeam object. One of the pieces of information that can be printed is the getTies() method, so you will call that method in your TeamTester file: System.out.println(dolphins.getTies()); Do this for all the methods that each of the objects can call. Hint: Remember, for the program to compile and run, Java looks for methods to exist in certain classes. ================================= public class Team { private String name;private String location;private int…package1 and package2 are instances of the Box class. Attributes length, width, and height of both package1 and package2 are read from input. Then, scaling_factor1 and scaling_factor2 are read from input. In the Box class, define instance method scale_measurements() with self and one integer as parameters to: Assign attribute length with length's current value multiplied by the integer parameter. Assign attribute width with width's current value multiplied by the integer parameter. Assign attribute height with height's current value multiplied by the integer parameter.Is there a different way of doing this problem? Question: Create a class AccessPoint with the following attributes: x - a double representing the x coordinate y - a double representing the y coordinate range - an integer representing the coverage radius status - On or Off Add constructors. The default constructor should create an access point object at position (0.0, 0.0), coverage radius 0, and Off. Add accessor and mutator functions: getX, getY, getRange, getStatus, setX, setY, setRange and setStatus. Also, add a set function that sets the location coordinates and the range. Add the following member functions: move and coverageArea. Add a function overlap that checks if two access points overlap their coverage and returns true if they overlap. Add a function signalStrength that returns the wireless signal strength as a percentage. The signal strength decreases as one moves away from the access point location. Test your class by writing a main function that creates five access…
- Write the Boat class in Java Eclipse. A Boat has a registered name, a number of cabins, and a length.a) Define the instance variables (data fields).b) Include 2 constructors (default and one that receives the Boat registeredname, number of cabins and its length as an input).c) Write accessors (getters) and mutators (setters) methods for the instancevariables on your own. Verify/correct the answers with the help of Eclipse.We have two classes, Person and Employee. Both have a field, firstName. We have instances of these objectsPerson p and Employee e. Both p and e have the same value for firstName, specifically, p.firstName = “joe”and e.firstName = “joe” Which of the following statements is necessarily true? Group of answer choices 1. p.equals(e) will return true because they contain the same firstName. 2. We don’t know if either class will have an equals method. 3. There is not enough information to tell what p.equals(e) will return. 4. p.equals(e) will return false but p == e will be true.Consider this scenario, a mehtod in some class needs to access a data field in another class, here are two possible implementations: public class Process { /* * Check if student qualifies for financial help */ void check(Student student) { //.... } /* * Check if student qualifies for financial help */ void check(double studentGPA) { //.... }} In class Process, which check method you think is better, why? In other words, should we pass the object to the method or just the data member it needs? Disucuss the Pros and Cons of each approach (if any). Assume class Student has a mehod called getGPA( ).