Need a little help coding math for an iphone app...

I am having trouble coding the following for an application that has to do with math calculations for an iphone application. I was hoping for at least someone to point me in the right direction/
I have two text boxes, and I want the application to add the two together. Then with a picker slider I want to be able to select a percentage of that number. Than multiply it by another number 1-30 on a picker slider. and then produce the product in another text box.
If you need more details please let me know... thanks

The following assumes "text boxes" means instances of UITextField, and these have been declared as textField1 and textField2 (we'll also assume you've ensured the text is numeric or coaxed the user into cooperating):
// get the two numbers and add them together
NSString *digits1 = textField1.text;
NSString *digits2 = textField2.text;
int n1 = [digits1 intValue];
int n2 = [digits2 intValue];
int nTotal = n1 + n2;
// we now assume two instances of UISlider declared
// as percentSlider, inited to 0-100, and multSlider
// inited to 0-30
// get the slider settings and compute answer
int nPercent = round(percentSlider.value);
int nMultipier = round(multSlider.value);
float fResult = nTotal * nMultiplier * (float)nPercent/100;
// assume instance of UILabel to display result
label.text = [NSString stringWithFormat:@"%2.2f", fResult];
I didn't build a test bed for the above so be aware it's not working code, but hope it helps.

Similar Messages

  • Need a little help in settings for RAID-0 please

    Hey folks I am trying to over-come some issues and I believe my raid settings are not right. In BIOS what should they read like. I have 2 drives.
    Raid -Enable (got that one right )
    IDE Primary Master Raid-Enable or Disable?
    IDE Primary Slave Raid-Enable or Disable?
    IDE Secondary Master Raid-Enable or Disable?
    IDE Secondary Slave Raid- Enable or Disable?
    SATA1 Raid-Enable or Disable?
    SATA2 Raid-Enable or Disable?
    SATA2 Raid-Enable or Disable?
    SATA3 Raid-Enable or Disable?
    SATA4 Raid-Enable or Disable?
    Thanks for the time and help folks.
    System spec.
    Athalon 64 X2 3800+ Manchester
    Motherboard: MSI KN8-F nForce 4 SLI (MS 7185)(red board)
    Cooling: ARTIC
    Memory: 1 GB Kingston CAS 2.5 value ram (2x512 dual channel DDR400-PC3200 -BIOS set at 2T)
    Video Card: SAPPHIRE X1800XT 256
    Harddisk: 2 Seagate Barracuda 7200.8 in raid 0
    CD/DVD Drive: Sony 810 dl dvd burner/MEMOREX 16X16 DVD DUAL LAYER
    CRT/LCD Model: Samsung 19 SyncMaster
    Case: Antec SonataII
    Sound Card: X-FI FATLITY cambridge dolby digital amp&speakers
    PSU: 450 watt True Power inc. with case
    Software: XP SP2
     

    Quote from: nascarmike on 29-January-07, 07:10:51
    When I reset BIOS they came back all enabled ( primary and secondary and all 4 SATA. How do I determine which channels are in use? Also which area in BIOS allows me to change from 64 to 16K? I'm a little lost noob (or due to age maybe some Alzimers?)thanks in advance.
    RAID is disabled by default.
    Enable SATA as RAID for channels where are your HDD detected: (example: if you are connected your SATA disks to SATA1 & SATA2, configure RAID for  SATA1 & SATA2.)
    after raid is enabled, and configured property leave BIOS (SAVE AND EXIT) you will need to setup your raid configuration, by pushing F10 to enter Raid setup after post:
    hit F10 when menu popup to enter RAID utility.
    •     Now select Striping, Mirroring, Striping+Mirroring, Spanning.
    •    Next push the tab key, and select the striping block size you want.
    •    Push the tab key again, and select the hard drives you want to include in the Raid array.
    •    Then push F7 to save and finish the Raid array.
    Choice Stripping mode for RAID mode and add both HDDs to array. select "Striping Block" to 16k.
    then hit F7 when you done. at next menu make your array bootable by selecting array and hit "B":
    config with "Y" when asked.
    NOTE: Information on both Disk will be lost.

  • Need a little help new to mac

    Need a little help I'm new to Mac.. i have had my ibook for over a year now and i like it a lot, but some times my usb post dies on my for a couple days maybe weeks. Ill have my ipod connected and when i go to plug in a flash drive. It doesn't detect my ipod anymore and my usb port don't work. it says that they were "removed improperly" and now they are not working again..i have tried to reinstall the whole os again and that doesn't work i don't have the hardware test disk so i don't know what could be the problem i know its not the logic board is there any test i can do to it to find out the problem its an ibook late 2001... there is no reset button on it. i tried to hold in the space bar and now when i boot up i get prompt to this screen that shows the world and then a folder with a ? mark but then after a few sec it boots right up im a mess need some help

    +it says that they were "removed improperly"+
    You have to go to the iPod's icon on your computer (or the flash drive's icon), select it and eject it there before removing it. Otherwise, data can be corrupted and/or lost. Repeatedly removing it without ejecting it from the desktop can cause it not to be recognized any longer.
    If your iBook is a "late 2001" model. It should have a reset button. Check out the chart here to make sure which model iBook you have:
    http://support.apple.com/kb/HT1772?viewlocale=en_US
    +i get prompt to this screen that shows the world and then a folder with a ? mark but then after a few sec it boots right up+
    It's trying to find a network volume from which to boot.
    Once it's booted up, go to System Preferences > Startup Disk, and select your Mac OS X startup volume. Then close System Preferences. The next time you start up, it should start up without looking for a network volume.

  • Greetings,   I need a little help. I have a WRT54G Wirele...

    Greetings,
    I need a little help. I have a WRT54G Wireless Router, and it worked well for years with my Alcatel DSL Modem (Bellsouth/ATT).  The modem went out and it was replaced with Westell Modem.  When I bypass the router I have no problem connecting to the Internet, however when I connect the router--no connection.  I thought it would not be a problem swapping the modem out.  I am running XP with Norton Internet Security and Anti-virus.  I have disabled Norton and do not believe that to be the problem.  Do I have to reconfigure the router?  If so, can I do it with the original install CD?  (I am disabled and the original CD/instructions/box is in the attic and I cannot get it easily.)  I have read several different threads, but they do not specifically address my problem.  Any assistance is appreciated.  Eddy

    Many Westell modems are actually "modem-routers" and they use the same 192.168.1.1  address space as your WRT54G.  This is the root of your problems.
    Try the settings at this URL.
    http://www.dslreports.com/faq/6323
    Note that the "WAN" port on the BEFSR41 in the example is the same as the "Internet" port on your WRT54G.
    Please let me know whether or not this worked for you.

  • Need a little help with dial setup on CME

    I've got a CME I'm using for testing and I think I need a little help figuring out the proper config to get the system to accept numbers I dial and have those numbers be passed on to an Avaya system (including the leading 9 for ARS in Avaya) via H.323 IP trunks.   I have it working well for internal 5 digit extension calls across the H.323 trunks and I also have it working well for some types of outside calls that gets passed on to the Avaya and then the Avaya dials the call out to the PSTN.   My only real problem is, I can't figure out how to correctly configure CME to examine the digits I'm dialing and only send the digits once I'm finished dialing....not as soon as it sees an initial match.
    What's happening is this.  I can dial local numbers in my area as 7 digits or 10 digits.  The phone company doesn't yet force us to dial area code and number for local calls (10 digits).  I can still dial 7 digits.   But...if I put an entry in CME that looks like this....
    (by the way, the 192.168.1.1 IP is not the real IP address, that's just an example, but the rest of this entry is what I really have entered in CME)
    dial-peer voice 9 voip
    description Outside 7 Dig Local Calls Via Avaya
    destination-pattern 9.......
    session target ipv4:192.168.1.1
    dtmf-relay h245-alphanumeric
    no vad
    ...Then it will always try to dial out immediately after seeing the first 8 digits I dial (9 plus the 7 digit number I called)...even though I have a speicifc entry in the system that accounts for calls to 9 plus area code 513.  I would have assumed that if I put the specific entry in for 9513....... it would see that and wait to see if I was actually dialing something to match 9513....... instead of 9.......   Understand what I mean?   Because 9513....... is more specific than 9....... but it still tries to send the call out immediately after seeing the first 8 digits I dialed.
    dial-peer voice 9513 voip
    description Outside 10 Dig Local Calls Via Avaya
    destination-pattern 9513.......
    session target ipv4:192.168.1.1
    dtmf-relay h245-alphanumeric
    no vad
    ...BUT...here's the interesting thing.  If I trace the 10 digit call in Avaya, I see that the number being presented to the Avaya PBX is only the first 7 digits of the number....not the full 10 digits...BUT I see a few more of the digits I dialed (like the 8th and 9th digits) after the call is already setup and sent to the PSTN.  It's like the CME is trying to send the rest of the 10 digits I dialed, but at that point it's already too late.   It setup the call as a 7 digit call (9 plus 7 digits), not 10 digit like I wanted.
    I'm more familiar with how to setup dialing in the Avaya via ARS.  My background is Avaya, not Cisco, so this dial-peer config is a little difficult for me until I understand the reasoning of how it examines the numbers and what I should do to make it wait for me to finish dialing....or to tell the system that what I'm dialing will be a minimum or a certain amount of digits and maximum of a certain amount of digits, like the Avaya does.  I just need some pointers and examples to look at :-)   I think I've almost got it....but I'm just missing something at the moment.
    Just so you understand, the call flow should be like this:  Cisco phone registered to CME > CME to Avaya via H.323 trunks > Avaya to PSTN via ISDN PRI trunks connected to Avaya.  I have to be sure I send the 9 to the Avaya also, because 9 triggers ARS in the Avaya. 
    Thanks for your help

    Here is a good document that explains how dial-peers are matched in the Cisco world:
    http://www.cisco.com/en/US/tech/tk652/tk90/technologies_tech_note09186a008010fed1.shtml#topic7
    In your case, it is variable length dial plan you are trying to implenent. To fix it, you need to add a T to force the system to wait for more digits to be entered if there is any.
    dial-peer voice 9 voip
    description Outside 7 Dig Local Calls Via Avaya
    destination-pattern 9.......T
    session target ipv4:192.168.1.1
    dtmf-relay h245-alphanumeric
    no vad
    dial-peer voice 9513 voip
    description Outside 10 Dig Local Calls Via Avaya
    destination-pattern 9513.......
    session target ipv4:192.168.1.1
    dtmf-relay h245-alphanumeric
    no vad
    You can also configure the inter-digits timeout using the command timeouts interdigit under telephony-service.
    Please rate helpful answers!

  • Need a little Help with my new xfi titanium

    +Need a little Help with my new xfi titanium< A few questions here.
    st question? Im using opt out port on the xfi ti. card and using digital li've on a windows 7 64 bit system,? I would like to know why when i use 5. or 7. and i check to make sure each speakear is working the rear speakers wont sound off but the sr and sl will in replace of the rear speakers. I did a test tone on my sony amp and the speaker are wired correctly becasue the rear speakers and the surrond? left and right sound off when they suppose too. Also when i try to click on? the sl and sr in the sound blaster control panel they dont work but if i click on the rear speakers in the control panel the sl and sr sound off. Do anyone know how i can fix this? So i would like to know why my sl and sr act like rears when they are not?
    2nd question? How do i control the volume from my keyboard or from windows period when using opt out i was able to do so with my on board? sound max audio using spidf? Now i can only control the audio using the sony receiver.
    Thank you for any help..

    /Re: Need a little Help with my new xfi titanium? ?
    ZDragon wrote:
    I'm unsure about the first question. Do you even have a 7. system and receiver? If you just have 5., you should be able to remap the audio in the THX console.
    I do have a sony 7. reciever str de-995 its an older one but its only for my cpu. At first i didnt even have THX installed because it didnt come with the driver package for some reason until i downloaded the daniel_k support drivers and installed it. But it doesnt help in anyway.
    I have checked every where regarding the first question and alot of people are having problems getting sound out of there rear channels and the sound being re-mapped to the surround right and the surround left as if there rear left and rear right.
    I read somewhere that the daniel_k support drivers would fix this but it didnt for me and many others.
    For the second question i assumed it would be becasue of the spidf pass through and that my onboard sound card was inferior to the xfi titaniums. But i wasnt sure and i was hopeing that someone would have a solution for that problem because i miss controlling the volume with my keyboard.

  • Need a little help with syncing my iPod.

    I got a new macbook pro for cristmas and a few cds. After i tried to sync my ipod to itunes i put a symbol next to each song that i got from other cds saying that they were downloading but they werent. Also the cds i downloaded to my ipod for the first time didnt appear at all. Need help.

    /Re: Need a little Help with my new xfi titanium? ?
    ZDragon wrote:
    I'm unsure about the first question. Do you even have a 7. system and receiver? If you just have 5., you should be able to remap the audio in the THX console.
    I do have a sony 7. reciever str de-995 its an older one but its only for my cpu. At first i didnt even have THX installed because it didnt come with the driver package for some reason until i downloaded the daniel_k support drivers and installed it. But it doesnt help in anyway.
    I have checked every where regarding the first question and alot of people are having problems getting sound out of there rear channels and the sound being re-mapped to the surround right and the surround left as if there rear left and rear right.
    I read somewhere that the daniel_k support drivers would fix this but it didnt for me and many others.
    For the second question i assumed it would be becasue of the spidf pass through and that my onboard sound card was inferior to the xfi titaniums. But i wasnt sure and i was hopeing that someone would have a solution for that problem because i miss controlling the volume with my keyboard.

  • Quality Playback-.need a little help

    Quality Playback….need a little help
    I’ve posted in the Premiere forums too, because I’m not sure where my issue is in converting .MOD files, the export of edited footage from Preimere Pro CS4 or if it’s in Encore.
    The quality just does not seem that good, I know it’s not HD quality, but it should be better than what I have.  Seems over pixilated especially around objects.
    Here’s my steps
    Convert .MOD files using Mpeg Streamclip to a .DV file format
    Settings Compression DV (DV25)
    Standard NTSC 720 x 480 29.97 fps
    Aspect 16:0
    Everything else is default
    Import to Premiere Pro CS5
    Edit footage
    Export to quicktime .mov file
    NTSC DV Widescreen
    720 x 480 quality 100%
    codec is DV25 NTSC
    Import .mov files to Encore CS5
    Build menus and playlists
    Export with default settings approximately 1hr 45min of edited video
    Thanks
    MAB

    Bill
    Thanks for your help and patience.
    I posted a screen shot of the mov export settings I was using.  I’m going to try Ann’s conversion method on the mod files to see if that improves things.
    You asked about the Encore transcoding, what do you mean by that, are there other settings in Encore that I need to set?
    I have an 1hour 45 min of video in my Encore project, burning to a 4.7 DVD.  Encore says it’s using 3.3bg, which seems low.
    MAB

  • I need a little help

    hi i need a little help making a java applet rpg with log-in, chat, etc. and i dont really know to much about it and dont understand applet programming too much. If anyone could help, it would be appreciated. Also, since i am fairly decent at making/improving websites, if you help me i could make a website for you or improve one you already have. You can email me if you want to help at "[email protected]"

    Don't just give up. Like I said, start small.
    I've never heard of any pre-made RPG java classes.
    Why don't you poke around on SourceForge or some java-centric project site or one of the java gaming sites. Maybe someone has written all these libraries already, although you may have trouble using these classes if you're not familiar with programming in general and java in particular. Or do a Google search.
    But using a specialized API is a lot easier if you know how to use the general API (i.e., j2se).
    Another option of course is not to use java at all. Many commercial games come with an editor; you may find it easier to get one of those and do a mod.

  • Need a little help.... not major....but am unsure I have...

    Need a little help.... not major....but am unsure I have the 2.4 GHz Wireless-G Broadband Router Model WRT54G version 2 I had bought some time ago (over year and a half) and never really had it hooked up since I have been moving from place to place. Now that I'm retired and staying in one place I'm ready to set up. I find myself having "several" power adaptors and not sure which is the correct one. Can anyone tell me if all the broadband routers had the Linksys name and/or logo on them? None of the adapters I have do. I want to use a proper adapter so as not to damage....are there any specs that would be helpful so that one of these adapters would work? Also I'm running WindowsXP Sorry to bother you folks with a dumb question as I'm sure there are others with far more important questions and concerns. Although I can't tell other than the end going into the unit fits, I do have one Class 2 Transformer which might be the one it's about 1 1/2 inches thick, about 2 inches tall with following written information: Model 49-12-1000D CUI Inc Input AC 120V 60Hz 20W Output DC12V 1000mA Appreciate any help you can give.....I believe my unit is an older one based on version so there may have been a "fatter" adapter then than now.

    The power adapter output should be 12V, 0.5A(so 6W power rating)

  • Need a little help please    Airport Express

    Need a little help please.
    I am trying to set up a wireless network at my home using Airport Express.
    I have a regular phone line running in to I assume the modem. From there, there is an Ethernet cable running from that box to the back of the PC. My question is, I think, which of those do I unplug and plug into the Airport Express, the one on the back of the PC or the one that is in the back of the modem, or is this totally wrong.
    Any help would be appreciated…
    Thanks
    In advance…
    PS I have the manual but to me it is not very clear…

    Your connection sequence would look like this:
    Internet > Modem > AirPort Express >>>wireless to your computers.
    This means that you would unplug the cable that is now connected at the back of your PC and move that connection to the AirPort Express.
    Open Macintosh HD > Applications > Utilities > AirPort Utility
    Click Continue to follow the guided setup. On the third page, you will choose the option to "Create a wireless network" and continue the setup.

  • I have iPhone 4.I uprage it to IOS 5.1.1 and i can't go into it because i have no service.A  little help,please ? :/, I have iPhone 4.I uprage it to IOS 5.1.1 and i can't go into it because i have no service.A  little help,please ? :/

    I have iPhone 4.I uprage it to IOS 5.1.1 and i can't go into it because i have no service.A  little help,please ? :/, I have iPhone 4.I uprage it to IOS 5.1.1 and i can't go into it because i have no service.A  little help,please ? :/

    Your phone is carrier locked to a carrier other than the one you are trying to use.
    It was apparently hacked to unlock it prior to your attempt to update. Updating has re-locked it to the original carrier.
    Contact them and find out what their policy is.

  • HT201365 How helpful is the find my iPhone app?

    How helpful is the find my iPhone app?

    The app itself is for locating another iOS device (with the Find my iPhone service set up on it) from the device the app is installed upon.
    For that purpose it is very helpful.

  • Steps to take for developing iPhone app

    I have IMHO a brilliant idea for an iPhone app (I know, I know, and what else is new?:)
    But seriously I want to pursue it. I'm am by no means a programmer of any sort. (However, I'm toying with the idea of studying programming). That said, to get this first baby off the ground I plan to hire a programmer to realize my concept for me. It involves audio, and I will be able to create all the audio content myself(I'm a music/audio professional). I can also create all or most of the necessary graphics/artwork myself (I'm a former graphics pro).
    So, how do I start? What do I need to have in place to talk to a programmer? Should I create a dummy using still graphics and my audio content as a demo? I can even make a video demo of how it would work.
    What are the best resources for finding a competent (and cool) programmer. Just doing a search yields so much information it's overwhelming. I'd rather work with a creative person as one on one as possible, and not ship it off to some impersonal place. What should I expect to pay?
    Lastly, (as a total programmer beginner) is it nuts to think I could learn to program the app myself in a reasonable amount of time given that I have very specific and detailed ideas on how it would work?

    If you honestly have to ask whether or not you could do it yourself then you probably can't. Get an NDA and write up a detailed specification of everything you want the application to do, how you want it to be done, and what it should generally look like. Some general UI mock ups are always a plus. Be prepared to be told that certain things cannot (or should not) be done.
    Don't hire anyone from rentacoder.com. It is a veritable hotbed of international incompetence (and incoherence) and their service agreement's promises of security and arbitration will be broken in the event that a dispute should arise because there is not a single member of Exhedra Solutions' staff who even knows what a Mac looks like let alone how to test a deliverable on one. They will waste months of time promising you services they have no intention of providing and then ultimately tell you to pick a number between 1 and 10 to decide how much money you should be awarded. They're a joke of a company run by an aging frat boy cougar magnet whose experience begins and ends at Visual Basic and they bank on the fact that 99% of their clientele has no working knowledge of US law and can't sue them--especially not when they give the Florida Secretary of State the address of a vacant lot as their official registered agent for service of process.
    Find a real person who lives in your country and speaks your language and contract with them directly. Expect to offer anything in the range of $50-$200/hr depending on the type of work involved and your geographic location. Don't bother with any promises of links on websites, equity shares, profit percentages or portfolio pieces in lieu of payment unless you're talking to some gullible high school kid. These things are all as worthless as they sound.

  • Looking for an iPhone App developer

    Hi,
    I'm looking for an iPhone app developer, preferably in the UK, to work with me on a couple of reference apps. Drop me a line if you'd like more information; [email protected]
    Cheers
    Phil

    Possibly Sketchbook Pro or Express from the Mac App store.
    https://itunes.apple.com/us/app/sketchbook-pro-6/id553377898?mt=12
    https://itunes.apple.com/us/app/sketchbook-express/id404243625?mt=12

Maybe you are looking for

  • How many songs can you fit on 8GB ipod touch?

    Hi - I am trying to decide between the 8GB or 32GB and whether it is worth paying the extra money for the 32GB. Thanks.

  • Download paused

    I prepurchased a book.  I received notification that it was available and attempted to download it.  It is now permanently paused in my library and won't budge.  I did manage to download it on my phone. 

  • My shuffle turns off frequently when fully charged - have reset it but it's still a problem

    MY shuffle turns off frequently for no apparent reason. It's fully charged. I've reset it several times but it keeps happening.

  • 2nd time capsule

    I am considering getting a second time capsule - both to extend my wireless network, and to use for time machine backup on a new macbook pro. The airport documentation suggests that extending the wireless network is straightforward. Does anyone have

  • Post learning followup

    Guys need your advice on following : Any behavioral session is incomplete without a follow-up action plan that the 'learner' sets for self with a targeted deadline. These elements could be varied from 'being assertive to being a team player to improv