Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
MapleKingdom
I can probably help you with iPods And electronic problems :P
Beginner C++ question on 'const' keyword.?
Just wondering when and where 'const' should be used.
Are there downsides to using const where it isn't exactly needed? For example, does it somehow take up more memory off the heap/stack?
Also a quick second question.
My book would give function headers that look something like:
someType function(param1, param2, ...) const { .....
return someTypevar;
}
Would the 'const' in this case mean that the object returned by this method/function be unchangeable?
My teacher also told me that when overloading operator methods such as +=, -=, *=, or /=, that we should leave the const out while we should leave const in the header when the operators are +,-,*,/. Why in this case should const be left in.
Sorry if this seems like a beginner question. Coming into C++ from a background in Java and 'const' is new to me.
2 AnswersProgramming & Design3 years agoBeginning C++ question on references and pointers?
I m just starting out in C++ from a background in Java.
Would
"int* a = new int[10]; "
mean that a is a pointer to an array of size 10?
then what would this mean?
for (int i = 0; i < 10; i++){
*(a+i) = 5;
}
Since a is a pointer, would this be changing the memory location address it s storing or the value at that location?
1 AnswerProgramming & Design3 years agoHelp on a physics problem (Centripetal acceleration)!?
"You are playing tetherball on the playground with your friend. Tetherball is played with two people and a ball attached to a rope. The other end of the string is attached to the top of a pole. The people hit the ball back and forth trying to wrap the rope around the pole.
Half a second after you hit the ball, the ball breaks from the rope, it is underground circular motion 1.50m away from the pole with a centripetal acceleration of 6.00 m/s^2 and has a height of 2.00m above the ground. How far from the pole is the ball when it lands on the ground?"
It s part of my exam prep book but it only gives the answer and I m not entirely sure how to lead up to the answer. Any help is appreciated!
1 AnswerPhysics4 years agoNeed help clarifying limits question for Calculus. (Not really a question about calculus, more so on simplifying equ.)?
The definition said "the sequence of a converges to limit, L, provided that the terms of sequence a can be made arbitrarily close to L by taking n sufficiently large. More precisely, sequence a has the unique Limit L if given any ε > 0, it is possible to find a positive integer N (depending only on ε) such that l a - L l < ε
whenever n > N. "
The problem example confused me, not exactly the concept.
It stated that
lim n / (n - 1), as n goes to infinity, to equal 1.
It then gave that ε = 0.001 and to find the value of N that satisfies the conditions of the limit definition.
so by that definition I was given,
abs( (n / (n - 1)) - 1) < 0.01.
I added 1 to both sides and broke the fraction into two parts but... the example did things differently and I don t understand how it got there.
it converted (n / (n-1)) - 1 into 1 / (n - 1). and solved from there. Any help is appreciated.
1 AnswerMathematics4 years agoJava programming question: How do I use insertion sort to sort items in descending order using compareTo?
I have no idea where to start.
Usually, sorting primitive data types,
I would only need to use <, > but compareTo only gives me if it's less than, equal, or greater than each other.
Would I need to implement a while-loop within a for-loop?
2 AnswersProgramming & Design4 years agoQuestion about Java programming: How do I implement the 'Iterable' interface?
So to provide some context:
I wrote a class that functions like an ArrayList of 'Object' objects using a singly-linked LinkedList. From this ArrayList class we're supposed to implement the Iterable interface but looking at the provided :
http://docs.oracle.com/javase/7/docs/api/java/nio/...
I'm confused on how I am supposed to implement this interface.
Any videos or written explanations would be appreciated.
2 AnswersProgramming & Design4 years agoQuestion about Java programming: How do I implement the 'Serializable' interface?
The assignment said for me to implement the interface into a couple of pre-existing classes we had done beforehand but when I change my class header to implement the interface, it compiles without a problem even though I did not implement any method headings.
Does this mean that the interface doesn't have any methods to define?
If so, how does this interface work if it doesn't have any possible methods?
1 AnswerProgramming & Design4 years agoQuestion on Java Programming: How should I correctly implement and define the 'Clone' method from the 'Cloneable' interface?
So I understand that it would return an object whose instance variables are equal to the calling object's and this would work fine for instance variables whose types are immutable (String, wrapper class types, primitives, etc.) but for mutable, it opens up the possibility of privacy leaks.
So let's say an object of 'SomeClass', called "example", has 2 instance variables, one int and one of 'MutableType'.
So it'd look like
public class SomeClass{
private int number;
private MutableType type;
}
Would I do something like
SomeClass newObj = example.clone();
And then do...
newObj.setMutableType(MutableType e){
type = e.clone();
}
//Assuming that 'MutableType' has implemented the clone method correctly also to prevent privacy leaks.
I'm still relatively new to Java and confused about how to implement the clone method correctly to prevent privacy leaks. Any help would be appreciated.
1 AnswerProgramming & Design4 years agoQuestion about Generics in Java (Super vs. Extends).?
I m reading Absolute Java 6e by Walter Savitch for reference.
Let s say that SomeClass is a class and SomeInt is a interface.
In Ch14.2, Savitch says how...
<T extends SomeClass> would only allow class types that are of or descendants of SomeClass . And <T extends SomeInt> would only allow classes that have implemented SomeInt correctly.
In chap 16.1, Savitch states that "To specify that the wildcard type be an ancestor type of some class or interface, use super rather than extends .".
I m confused here. It sounds like extends and super accomplishes the same thing in this context. What is the difference?
1 AnswerProgramming & Design4 years agoHow does deep sea life exist?
Just wondering.
If deep sea pressure can bend iron, how do organisms survive the immense amount of pressure that's on them?
I understand some things like how whale's have lungs that collapse safely which allows them to dive deeply but what accounts for the survivability of marine life that live much deeper?
2 AnswersBiology4 years agoNeed help with how I could convert a fraction with a decimal to one that has only whole numbers.?
Writing a little program to format fractions first then utilize them in another program that functions as a mixed number/fraction calculator.
I got most of it done but and got this portion working actually but it does seem redundant.
So for example, it would convert "4.2/2" to 21/10.
Initially, I multiply both numerator and denominator component by 1000 then just cast both numbers as integer types.
It works but I feel like there'd be a better way. Also occasionally a large denominator might appear that would render the ( x 1000) step useless.
Any thoughts or algorithms I should look up?
1 AnswerProgramming & Design4 years agoCompany sent me a product by mistake what do I do?
I contacted them about it and they appreciated that I notified them and they said there would be a deeper look.
I know from the Federal Trade Commission that anything sent by mistake is technically mine to keep (I plan on giving the product back).
But I was wondering what would happen if I just simply refused to send it back to them?
3 AnswersLaw & Ethics4 years agoJava coding: How to use "&" and "|" ?
So in my textbook, it covers the "And" and "or" for Boolean expressions which are "&&" and "||" but I've come across a single "&" and "|" and it doesn't entirely describe what they do.
I'm kind of confused and explanations online don't seem to suffice.
Could anyone explain what they are and give a basic example of when/how to use them?
2 AnswersProgramming & Design4 years agoThoughts on the "Non-binary" or "I identify as a ____" topics regarding gender?
Recently, there's been an uproar of people
"self-identifying" as another gender.
Thoughts on the whole thing?
Personally, I don't have a problem with it, but the topic does confuse me. I hope I don't offend anyone but I don't exactly get the whole "I believe I was born as the wrong gender" thing. No intention to offend anyone, just curious.
What are your thoughts on this?
7 AnswersLesbian, Gay, Bisexual, and Transgender4 years agoHelp with a Calculus problem involving integrals.?
The problem is on the image attached.
I don't see anyway to start solving this problem. Please help.
2 AnswersMathematics4 years agoHelp on a calculus problem involving the volume of a solid with known cross-sections.?
The problem is
"The solid with a semicircular base of raiud 5 whose cross sections perpendicular to the base and parallel to the diameter are squares".
I got an answer but it is exactly 1/2 of the correct answer.
With the description, the equation is y = sqrtOf(25 - x^2).
And since the cross sections are squares, it's y^2 = 25-x^2.
Taking the integral of this function I got 25x - (x^3/3). With function being even, I can evaluate the integral from 0 to 5 and multiply the result by 2.
Doing so I got 500/3 but the correct answer is 1000/3.
Is there a step I'm missing? because I can't seem to figure out why my answer is only half of the correct.
3 AnswersMathematics4 years agoTrigonometry/Calc question?
My math professor posted a notice for an upcoming calc final.
He said
"
Class,
If you get an indefinite integral that contains root(sin^2(x)) or some other trigonometric function, in principle that is equal to the absolute value of the trigonometric function, i.e., root(sin^2(x))=|sin(x)|.
However,although it is incorrect in general, in the final exam if you get an indefinite integral that contains such a root, you can ignore the absolute value, i.e., root(sin^2(x))=sin(x). Do thing only if the integral is indefinite!
This will lead to a correct answer assumption that the trig function is positive on the interval of interest.".
Not entirely sure what he's trying to say.
Like if the trig function is positive on the interval, why does it matter if I have the absolute value sign or not? Also why does this only apply to indefinite integrals? Might be misreading things but I don't entirely get what he's trying to say.
1 AnswerMathematics4 years agoCalculus related problem. Need someone to check my thought process.?
Going over some past material for a final coming up. It's been a while so I want to see if I'm doing the steps correctly.
"A person is holding a gun 2 meters above the ground and fires a bullet straight up. It takes 10 seconds for the bullet to reach its highest point, g = 9.8m/s^2"
a(t) = -9.8
v(t) = integralOf (a(t)) = -9.8t + C
v(10) = 0 = -98 + C, C = 98
s(t), the position, = integralOf(v(t))
= -4.9t^2 + 98t + 2
3 AnswersMathematics4 years agoQuestion about this midpoint approximation problem (Calculus)?
In our online homework, I've stumbled across a problem which seems very tedious to solve out even with a calculator available and I'm wondering if there's a possible shortcut.
The problem is the integral of sin(pi * x) (dx) with the limits of integration being 3 and 6.
The subinterval is n = 25... which is where I find it to be very tedious.
(6-3)/25 = 3/25 = delta X which tells me that the x points are
75/25, 78/25, 81/25 and so on. It'd be very annoying to plug in the midpoint of each set of plots into the function...
2 AnswersMathematics4 years agoHelp with calculus (integrals).?
We were going over homework solutions and ran out of time before we went over this. I've tried to figure it out myself but I'm not entirely sure
Integral of ( sqrt(x^2 -1)/x^3)
from -2 to -7.
It should look something like this
I started off with using trig substitutions with x = sec and went from there but it got really messy and I'm not entirely sure if that's the right way to approach it.
2 AnswersMathematics4 years ago