Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be 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.
Raul P
Java: What's the best way to make sure a string contains only a specified range of values?
Alright, so my program has 6 textfields in it that are supposed to receive 1 capitalized letter grade in each one.I grabbed the text from the text fields and concatenated them all to 1 string and did a replaceAll to get rid of all spaces.
So in my program I need to validate that this string only contains some sequence of A,B,C,D,E, and F. Is there a more efficient way of doing this other than my current process:
for (int i = 0; i<combined.length(); i++)
{
if (combined.charAt(i) != 'A' || combined.charAt(i)!= 'B' || and so on... )
Thanks for any tips!
1 AnswerProgramming & Design1 decade agoProve whether this is true or false: 3|jk then either 3|j or 3|k?
So basically the question in English is: if 3 divides into (j*k), then either 3 divides into j or 3 divides into k. Prove whether or not this is true.
Not sure on how to go about actually using a proof. I have a feeling this is true though as I can't think of any number combo to make it false. Any walkthroughs or tips on this problem? Thanks
Also, what about replacing 3 with 4. Same concept here as well I assume. Different results?
2 AnswersMathematics1 decade agoC programming help using file streams?
So I have thid .dat file filled with integers, words, and spaces. I want to read through that file and write out just the integers to a new file. I can do that part fine with some basic fgetc and isdigit functions.
However, in the file I'm writing to, I want to add a space character after every integer. How do I do this? I get weird symbols in the file when I attempt to do this.
Thanks for any tips.
2 AnswersProgramming & Design1 decade agofile opening and editing help in C?
Hi, I had a question involving opening,reading, and editing a text file in C
I have to edit a certain text file to only have in it integers and spaces. The text file looks something like this:
1 shuttle 3 idol 3 turkey 9 spoken 3 idol 3 4 5 ten
So, to open it looks something like this I guess:
FILE* fp = fopen("file.txt","r+") ;
while (!feof(fp))
{
and then after that I am confused on what to do next.
Any help is appreciated!
1 AnswerProgramming & Design1 decade agoTaking amtrak from DC to champaign,IL with a stop at Chicago union station- how is my luggage handled?
So I'm getting ready to head off for university again in Champaign-Urbana on Wednesday, but taking the train instead of flying (prices got outrageous over the last couple years!). Will be taking an Amtrak train from DC union station to Chicago Union station, where I then switch trains (like 8 hours later in the day) to then travel to the campus.
I'll have 2 pieces of checked-in luggage and 3 smaller carry-ons most likely.
So how will my 2 pieces of checked-in luggage be handled between stops. Do I personally need to take care of it, or is it done automatically by Amtrak to where I don't even have to lift a finger?
Also, is there a place to store my carry-on luggage at Chicago union station while I wait half a day. Would love to walk around Chicago during the wait period, but not with 3 pieces of carry-ons! What are my options there?
Thanks for any information!
4 AnswersRail1 decade agoC++ class question concerning private members?
So are private members of a class simply variables to the public functions of a class?
For instance, I have an array as a private member of Class Matrix
Class Matrix
{
private:
private_array[ROWS][COLS]
Now I have a function in my public class that fixes values to each position in that array using the usual double for loop with i's and j's.
private_array[i][j] = whatever
Is that allowable? Is my array that I defined in the private class simply like a variable that is local to my public function of the same class?
Many thanks!
1 AnswerProgramming & Design1 decade agoDifferentiation question: what is an exponential raised to a constant?
Like say I have this: ln(x^2 -1) = ln(x) + C where C is any constant. When I take the exponential on both sides, I get x^2-1 = x*e^(C)
Would e^C just be some other non-specific constant like say D?
Thanks!
2 AnswersMathematics1 decade agoHow to pick a decimal integer value contained in a string and print out its real decimal value in C?
Hi there, I have a string that contains "r3". I want to just grab the 3 out of the string and return the decimal value of 3. How would I go about doing that?
Thanks!
2 AnswersProgramming & Design1 decade agoVery hard factorization problem?
show that:
(zx^2) - (xz^2) - (yx^2) - (zy^2) + (xy^2) + (yz^2) = (y-x)(z-x)(z-y)
I have no idea on how to begin to solve this. I've tried working backwards, but that does nothing for me unfortunately.
Any helps/hints? Many thanks
3 AnswersMathematics1 decade ago