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.
immortal321
C# Help: A local variable is already defined in this scope.?
I am brand new to C# programming. And I am struggling to figure out what I have done wrong.
The problem is in my string declaration for the variable that will be returned. The error I receive is "a local variable named 'seconds' is already defined in this scope. I haven't been able to come up with a way to solve this problem. I'm sure it's me being an idiot... but I can't find it.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Mumby_iLab5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void btnConvert_Click(object sender, EventArgs e)
{
int seconds = Convert.ToInt32(txtSeconds.Text);
this.lblOutputMinutes.Text = Minutes();
this.lblOutputHours.Text = Hours();
}
public string Minutes()
{
throw new NotImplementedException();
int seconds = Convert.ToInt32(txtSeconds.Text);
int minutes = (seconds / 60);
int secondsR = (seconds % 60);
string minutesText = "{0:n} second(s) is {1:n} minute(s) and {2} second(s).", seconds, minutes, secondsR; //this is where the error occurs
return minutesText;
}
public string Hours()
{
throw new NotImplementedException();
int seconds = Convert.ToInt32(txtSeconds.Text);
int hours = (seconds / 60) / 60;
int minutes = (seconds / 60) - 60;
int secondsR = seconds - (3600 * hours) - (60 * minutes);
string hoursText = "{0:n} second(s) is {1:n} hour(s), {2} minute(s) and {3} second(s).", seconds, hours, minutes, secondsR; //and also here
return hoursText;
}
private void btnClear_Click(object sender, EventArgs e)
{
//Clears text box and restores labels.
txtSeconds.Clear();
lblOutputMinutes.Text = "Seconds Converted to Minutes";
lblOutputHours.Text = "Seconds Converted to Hours";
}
private void btnExit_Click(object sender, EventArgs e)
{
//Terminates the program
this.Close();
}
}
}
2 AnswersProgramming & Design1 decade agoHas anyone ever purchased anything through the website epathchina.com?
I was looking to get an HDD media player. This is apparently not an item that is easily purchased in the US. This site has some for under $30, but this seems too good to be true. But the site looks fairly legit to me... Has anyone ever used this website successfully? I searched online for reviews and was unsuccessful.
3 AnswersYahoo Shopping1 decade agoHow to turn on a cable outlet without calling the cable company?
I pay for cable, so I'm not trying to do anything illegal. But I have 2 cable jacks in my living room (one on either side of the room). When I had my cable turned on I thought I had asked the technician to turn on all of the outlets when he asked.
I wanted to rearrange the living room and put the TV on the other side of the room, but that outlet does not work. I was wondering if I could manually turn on that outlet (by messing with the box in my closet?) without having to have a technician come out and do it - which would be an enormous hassle.
4 AnswersTVs1 decade agoCompaq Presario notebook with no CD-ROM drive or operating system?
My friend recently gave me his broken Compaq Presario notebook. It's a bit old (Presario 700 series) and it's built for Windows XP. When I turn it on the Compaq logo is seen. Then it goes to a black screen and simply says "Operating System not found." This is what he told me when he gave it to me. I figured I would just pop my Ubuntu disk in and load up that OS, but the notebook has no CD-ROM drive. There is an empty bay on the side that has a little orange tape in it. I assumed this is where the CD-ROM is supposed to be. Nothing seems to be broken, only exposed. But without enough knowledge of laptops, I'm not sure. Also, there is an empty bay on the bottom of the system directly under where the floppy drive is. I don't know what is missing here, either.
The question has 5 parts.
1. Is that the correct location for a CD-ROM drive? And with what little knowledge I've given of this device, would a new drive be able to be placed in there?
2. Where can I get a laptop internal CD-ROM drive?
3. Without an operating system, can a new CD-ROM drive be installed?
4. Without an operating system, can I use a Ubuntu install disk to install linux on this system?
5. And if none of the above will work, is there any other way to get this thing working again? Or would there be an easier way?
I guess you get what you pay for, huh?
3 AnswersLaptops & Notebooks1 decade agoI need help with a song, please...?
It's a thrash/heavy metal band. The only part of it that I can think of (though it is a significant portion of the song) is the line:
RE - SPECT
GIVE IT TO ME.
Help, please.
5 AnswersRock and Pop1 decade agoMy cat has a lump in his cheek...?
My cat has been vomiting on occasion lately. Not very often, but maybe 4 times in the last month. And I wasn't too worried about it because he seemed perfectly healthy otherwise. But then yesterday I was petting him on his chin and I noticed a quite large lump. About the size of a walnut. It's only on the one side. He still doesn't show any other signs of being ill. Though I just recently realized that he seems to scratch himself in that area more often than I see either of my other two cats scratching.
So, now I wonder if I need to take him to an emergency vet clinic. I called around to the vets in my area and they're all booked until next Thursday, and I'm afraid of putting it off that long.
13 AnswersCats1 decade agoWhy didn't Cal Ripkin, Jr receive 100% of the ballots for hall of fame?
So, Cal Ripkin will be inducted this year into the hall of fame after receiving 537 out of 545 votes, which is the 3rd highest percentage of all time.
But it's hard for me to understand why he didn't receive 100% of the votes. Did those 8 people not cast the ballot? Cal Ripkin, Jr played in 19 All-Star games winning 2 all-star MVPs. He was a Rookie of the Year, 2-time MVP, 8-time Silver Slugger winner, and obviously he has the record for most consecutive games played. Plus, he hit 431 home runs, good enough for 37th place; and 3184 hits, good enough for 14th place. And he was part of a world series winning team. And he's renowned as being a great role model.
Given all of this - how could any writer who is casting their ballot for hall of fame - and keep in mind these guys cover MLB - have not voted for him as a hall of famer?
Can someone give me a good reason why Cal Ripkin, Jr does not deserve to be in the hall of fame?
11 AnswersBasketball1 decade agoShould I get a tetanus shot?
I banged my head against a nail that was sticking out of a shelf, on the flat side. It gave me a small scratch on my head, but it barely broke the skin. There was little more than a spot of blood. Is it important for me to go get a tetanus shot?
3 AnswersFirst Aid1 decade agoWhy is Plus or Premium gas better than regular?
What makes Unleaded Plus or Premium better than the regular unleaded? And is it worth the extra 10-20 cents per gallon?
Also, why do certain states have different octane levels? Regular Unleaded is Arizona is 87 while regular unleaded in Colorado is 85.
7 AnswersMaintenance & Repairs1 decade agoSystem Restore?
I have a Dell running Windows XP, and I was hoping to do a complete system restore, so I could start fresh. But XP will only let me roll back to an earlier date of about 2 months ago, and I can't find any other way to restore my system. Does anybody know a way?
4 AnswersDesktops1 decade agoWhat kind of things can a president be impeached for?
Andrew Johnson was basically impeached for firing a cabinet member and replacing him without congress approval. He was not convicted, however.
Bill Clinton was impeached for perjury, obstruction of justice, and they failed to impeach for perjury pertaining to Paula Jones and abuse of power. Which, of course, he was not convicted of any of the charges.
4 AnswersGovernment1 decade agoOldest living creatures on earth...?
I just read about an Alaskan rockfish that is estimated to be 100 years old, and that some experts say it is 157 years old, or some such thing. Which got me to wonder, what are some of the oldest living creatures on earth?
I know sea turtles can live for ages, like 180 years. And humans can live into their 120's, I think. So, other than plants and trees, are there other animals that can live over a century?
11 AnswersEnvironment1 decade agoIn Maple Story - Where can I find a Red Ribbon?
In the game MapleStory I need a red ribbon to finish a quest, and I thought I had some, but I have Pig Ribbons... Where can I find a red ribbon?
2 AnswersVideo & Online Games1 decade agoMy computer keeps shutting down randomly, help!?
Twice in the last two days I've been in the middle of playing a game (different game both times) and my computer just turned off randomly. I do download a lot from online, so I'm afraid it may be a virus, but my Norton AntiVirus hasn't picked anything up. I also checked my power cables and they all seem to be plugged in okay. Does anybody have any ideas?
7 AnswersOther - Computers1 decade agoHelp with a movie Title?
I am trying to remember a movie that I saw once that was kinda like a Bill and Ted or Dude Where's My Car type thing where the main characters go to a physic and she tells their fortune with her breasts and a fake 3rd nipple. I may be totally wrong on any of the details but any help would be great. I remember it being funny and I want my boyfriend to watch it.
Thanks
9 AnswersMovies1 decade agoI need help with the name of a certain song...?
I remember loving this song some time back, but now I can't think of it, or really how it goes... so here's everything I can remember about it, and I'm hoping someone can tell me the name?
It's a alt. rock/punk song from, I'm guessing, the mid to late 90's. I can remember in the video on MTV it was a bunch of high school students, primarily revolving around the relationship with a star of the football team and his girlfriend, who was cheating on some other guy (who I also think was on the football team, but I'm not too sure about that). Also, I remember the "other guy" had long shaggy hair, and the football star had a buzz cut or the like. There were some fairly graphic locker room scenes if I remember correctly.
Also, the song said something about "captain of the football team", or "football star" or some such thing...
Ugh... If you can come up with the name of the song or the band from that description than you are quite brilliant. Thanks!
1 AnswerMusic1 decade ago