Category "methods"

Is there a way I can break up into more than 2 classes

I am wondering how/if I could possibly break this up into multiple classes but keep the values across objects to pass between both. I am unable to get things wo

how to use if statement in main to Create an object with user input and to use a method on the objects

I'm working on an exercise, where I need to create a subclass that has 2 constructors (1 is empty and sets the values as 0 the other one is getting the values.

Is there "@Deprecated" annotation for methods in .aidl files?

Is there a corresponding "@Deprecated" annotation-syntax for methods in .aidl files? I want to mark a method as deprecated, add a new method and promote the use

How to fix/ learning help understanding basic method and classes, Java code and word Problem

I'm struggling on this problem, given that I'm probably making a basic mistake or I haven't got a clue what I'm doing. platform being a Zybook the problem rea

c# two parameters in one parameter in a method

I would like to make one method like this: public void SomeMethod(int myInt,<float or double or MyClass> myFloatorDoubleorMyClass) { } And not only with

How do I avoid NaN?

I understand it's because the program thinks I'm dividing by O, but I'm not sure how to fix it in the program. The program works fine, though. It outputs the av

How do I return the final discounted price instead of the discounted amount off?

I am creating a method that takes a percent as a parameter and decreases the price by that percent. public void lowerPriceBy(double percent){ price = price/

Can we actually do rspec testing on ruby if my methods don't have parameters?

I have a method but doesn't have a parameter, for example def goodbye puts "" puts "Thank you, #{name} for using our service." puts "Good luck with

Calling a native C++ method from C++/CLI

I'm developing Wordle in C++ using a .net graphic interface with visual studio. I have a file.h that contains a class "WordDatabase", and I need to use one of t

Method parameter auto completion for a class instance

I am trying to get auto completion of method parameter names for class instances but can't quite figure it out. Take this example class: class Abc: def meth

Vue JS: reactive syntax

While I was trying to grasp reactivity fundamentals and its syntax I've encountered following problem. Consider this snippet: const app = Vue.createApp({ dat

Call a Java method using MySQL triggers

I'm writing an application that retrieves data from a table in a MySQL database and displays it in a JTable. Whenever an insert/update/delete operation is made

Does the .includes method in JavaScript loop through the array and case O(n)?

Does the .includes method cause O(n^2) when run with another loop such as in this simple example? function myFn(){ let age = people.map(person => {

How do I capture inputs from a system.out.println to compare if they match? [duplicate]

I am a first year studying app development and I have a login and registration assignment. But Im struggling to make a method where it checks

How to remember if a method mutates the original array?

I know I can find a list of mutator methods on MDN, still, in practice I always forget if methods like push() or reverse() mutates the original array or creates

How can I program a while loop that waits for my input in Android?

My question is simple. What method can I use to tell my program that a button is pressed? I'm trying some codelines but its not really working (I tryed with isP

Any difference between str.capitalize() and str.title()?

Is there any difference in str.title() vs str.capitalize()? My understanding from the docs is that both methods capitalize the first letter of a word and make t

Javascript forEach Method

Am getting undefined error. var fruits = ["apple", "orange", "cherry"]; document.getElementById("demo").innerHTML = fruits.forEach(myFunction); function myFun

Cannot execute method in an NSPanel from a separate NSWindow in Objective-C

I have a MacOS Objective-C project with a parent NSWindow and an NSPanel containing a TableView whose delegate and data source is a class called TableController

I need to decrease a value of the property only from specific class objects

I have three classes and two of them inheriting from an Animal class, Carnivore class should have method to decrease health by 50 if I call the method on Herbiv