Playing around with java

Im fairly new to the whole programing thing, and for starters, i was thinking of using java to create a calculator that uses fractions. How would i go about doing this.
So far, i have managed to create one that uses integers, but i seem to draw a blank with fractions.
Any ideas anyone.

Unless I've missed something significant, Java doesn't have built-in support for fractions. Actually offhand I can't think of ANY language that has built-in support for a fractional number type. (I'm not counting floating points; let's not get into a semantic argument...)
So, assuming you really do mean fractions (numbers expressed as a ratio of two integers) and not just any number system that allows values between integers, you'd have to build support for that. This is a non-trivial task; one really interesting part is dealing with the fact that two fractions can be numerically equal but have different representations (e.g., 3/4 and 9/12). I'd suggest writing this code completely separately from the calculator or any user interface. Write test code to run it. Remember to deal with stuff like greatest common denominator calculations, etc. Then go back and add your code to your calculator program when you're done.
If you really do just mean a number system that can represent values between consecutive integers, then take a look at java.math.BigDecimal.

Similar Messages

  • My charter webmail will NOT load after playing around with add-ons. FREAKING OUT!

    My entire charter webmail page is GREY & BLANK! I don't know what I did but I was playing around with add-ons including AD Block, etc. I have removed anything I added but it is still GREY & BLANK. I can NOT get into my mail. HELP!!!

    I don't think it's your network ...
    Try this...
    From the Safari menu bar top of your screen click Safari > Preferences then select the Privacy tab.
    Click:  Remove All Website Data
    Quit then relaunch Safari to test. If it was a cookies issue, that may help.
    And in case you aren't aware, when you have trouble with sites loading, trying emptying the Safari cache.
    Back to the menu bar, click Safari > Empty Cache
    Or Command + Option + E on your keyboard.
    As for Peer Guardian. Best to avoid third party firewall blockers.
    Your Firewall settings are located in System Preferences > Security & Privacy > Firewall
    Very important to keep your system software up to date. Back to System Preferences > Software Update > Scheduled Check
    Select:  Check for updates.  Best to select Daily from the pop up menu. Then select:  Download updates automatically.
    You'll see a dialog box on the Desktop when there are updates available to be installed.
    These support links may come in handy ..
    Apple - Find Out How - Mac Basics
    Apple - Support - Switch 101
    Apple product tutorials

  • Anonymous people are playing around with my iTunes. How to stop? Help?

    okay since 6 hours ago some creepy people are playing around with my iTunes. I believe its people who live around my building. I have my iTunes on and this anonymous person is playing controlling my library by changing the songs to the ones that the like. I don't know if this has anything to do with iPod or iPhone remote applications. Shouldn't they ask for passwords if they want to get into my library? But it's not!
    I do turn on "Share Library" but I tried something: Usually when you press the red exit X, shouldnt they say "Some other users are on your library, are you sure you want to quit?" But it doesnt ask that.
    I am on wireless and when I turn off my wireless it doesn't happen. Nobody disturbs my library. I recorded some "Quit doing it" audios and put it into my library but they're still doing it.
    I don't know if it's a virus (I need to get a new antivirus). I dont think it's virus though because it also happened to my sister's laptop. She closed her iTunes so the anonymous wont bother anymore. They're still doing it right now to my laptop!!!
    I asked this question on Yahoo! Answers and a person said something about my wireless getting hacked. What should I do????
    How do I make this stop??? HELP PLEASE!!!!!!!!!!!!!
    Please give me step by step instruction because I fail at fixing my computer.
    Message was edited by: XxXdragurlifeXxX

    Anyone hacking your wireless would just obtain access to your Internet connection, not to your computer.
    If someone is actually changing your library, then they almost certainly have access to your computer itself. The Sharing built into iTunes only allows someone to play your shared playlists; other users have no ability to make any changes. It's possible that someone is connecting via iPhone Remote; go into the iTunes -> Devices preference and click the "forget all remotes" button. If someone managed to connect Remote, that should cut them off.
    Otherwise, it's probably not an iTunes problem as such but rather that someone's hacked into your computer. I can't give you step-by-step instructions since there are many possibilities as to how someone might have obtained access to your system. But I'd suggest you start by making sure that you don't have Windows file sharing turned on; if you do turn it off for all shared volumes/folders. The same would apply to Windows remote desktop; you want to make sure that's turned off.
    If none of that helps, you'll probably need to take this problem up on a web site oriented to Windows support since it's, as I said, most probable that someone is hacking into your computer.
    Good luck.

  • I played around with my Dsn server, now my safari doesn't work, I played around with my Dsn server, now my safari doesn't work

    I played around with my DSN Server- now my internet is slow and does not allow me on certain pages.

    You played with your DNS where? In network settings in System Preferences or on the router?

  • Is there a way to re set Lightroom to original settings, I have been playing around with it and got somewhere that I don't know how to get out of...not particularly computer savvu

    Is there a way to re set Lightroom to original settings, I have been playing around with it and got to a place I don't know how to get out of. Not very computer savvy

    To begin, quit Lightroom
    On Windows do the following
    Click the Windows start button and in the search box type:-
    %appdata%\adobe\lightroom
    Then press the Return\Enter key
    That will take you to the Lightroom folder (see image below)
    Select the Preferences folder and hit delete to send it to the recycle bin.
    Close the Lightroom folder and re-start the Lightroom program.

  • Playing around with cfschedule, getting a time limit error - even with requesttimeout

    Hello, everyone.
    This isn't critical, I'm just playing around with the cfschedule tag.  But it's still annoying to get a time limit error, even with the requesttimeout attribute set to 10800.
    <cfschedule action="run" task="Collection_Daily_I" requesttimeout="10800">
    Less than one minute after loading the page, I get:
    The request has exceeded the allowable time limit Tag: cfhttp
    ^_^

    I tried something else here. I noticed that on the last circuit you posted you had a resistor tied from ground to the clock line in addition to the one tied back to VCC. This would be R4 in the origianl schematic. I also noticed that in this circuit I saw no double tripping of the clock signal but it did have a sloping rising edge. I am assuming this is what you are refering to as being dirty. Not a clean square wave by any means.
    I removed this extra resistor from the clock line and re-added the inverter and this seemed to clean up this slope. I do, not know what  purpose you may have had for this resistor but I believe that to be causing the sloping edge. I was incorrect about the inverter. I just know that in the original configuration I didin't get the double clocking when it was removed, but I failed to notice the sloping of the edge of the signal. Now with this new information I hope this will get it the way you want it.
    I will repost the circuit with my modifications. Let me know what you think. Just so you will know I am using asll default settings with the exception of the digital setting which is set to REAL.
    Here it is:
    Kittmaster's Component Database
    http://ni.kittmaster.com
    Have a Nice Day
    Attachments:
    ring_glitch possible solution_again1.ms10 ‏888 KB

  • I have iTunes on my work PC, can i transfer that file to my home laptop as dont find  the time to play around with it at work?

    I have iTunes on my work PC, can i transfer this file with all of my purchases and music i have in my library to my home laptop as finding at work i just dnt have the time to play around with iTunes. My wife has iTunes on my laptop with her purchases and her library though, will this be an issue also ? Can i have hers and mine iTunes on our single home laptop?

    Hello victoriak13,
    Thanks for using Apple Support Communities.
    Please see the support article below to learn more about iTunes Store movie rentals.  You can not move the rental from one computer to the other, but can sync it with an iOS device.
    Watch your movie on the device you used to rent it. If you rented the movie on your computer, you can move it to an iOS device or Apple TV (1st generation). To do this, connect the devices and sync using USB. When you move a rented movie from your computer, it will disappear from your computer’s iTunes library. You can move the movie between devices as much as you want, but you can only have it on one device at a time.
    FAQs about renting movies from the iTunes Store
    http://support.apple.com/kb/HT1657
    Take care,
    Alex H.

  • Play movie with java

    Hey,
    Im searching for a way to play a movie with java (without using JMF or javafx, these are media players only?),
    I want to play a movie in my app. how do i do this?

    I don't know, but JMF is not as inflexible as you imagine it to be. Why not ask in the forum dedicated to JMF?
    [http://forums.sun.com/forum.jspa?forumID=28]

  • I was playing around with the size of my window and now I can't get it back to the standard size, any suggestions?

    I was playing aaroound with the size of my window and now I can't get it back to standard size. Any suggestions?

    If you're using Lion, you can resize by dragging from any corner, in Leopard and lower it can only be resized from the bottom right hand corner.

  • Silly me. I was playing around with the virtual keyboard; found the international keyboard list. I turned on the Russian/Cyrillic keyboard.  Surprise, surprise, now everything is in Russian, and I can't see how to restore everything to English.  Help!

    Silly me. I was playing around on the settings portion of my I-Pad2, when I found the international keyboard section. I reset the keyboard to Russian to see what it would look like.  Now, the keyboard is in Russian, and so are all the settings elements.  I can't see how to get it all back into English.  Help,

    http://support.apple.com/kb/HT4051

  • Playing mp3s with java

    Does anyone know how to do this? I can only make java play windows default sounds (chime etc).
    Cheers
    ARB

    Hey PhHein,
    what brings you back to the JDC(or SDC as its now known)? I havn't seen you leave the "Discuss the JDC Website" forum, since the Water Cooler fell.

  • Text is running together on some pages and not others. i've tried no squint and playing around with text options in tools. I can't strike a good balance.

    I can't seem to figure out how to have a full screen experience with larger text and everything is in proportion. Either the right end of lines are chopped off, or lines of text are running into each other and out of boundaries.
    == This happened ==
    Not sure how often
    == I installed FF earlier this evening. I've had FF before and my gripe was the inability to set a certain magnification. I found the no squint add on and it seems very good, but somewhere I'm getting stuck. I've been fiddling with no squint, font options in tools and size and resolution settings for my monitor.

    i'm also having major CPU problems w/ FF 29.0.1. when i restart the app it calms down again but after loading tabs it steadily climbs up to 100% after not too long. i have checked out the 2 CPU links/articles above and do all the basic troubleshooting and tips, but with all the FF tools & add-ons isn't there some sort of CPU monitor that has the ability to display which extensions/scripts are hogging the CPU? Activity Monitor on Mac just shows the total used by the app. it's impossible in my case to efficiently disable dozens of add-ons & scripts, restart, and test each one by one b/c it can take several hrs before the CPU starts to spike high again. i have no time for this.
    thanks

  • While using the computer the wi fi dropped out and it can longer find any networks. I have played around with the air port etc , still have no networks and can't connect to internet. Please help

    Hi I am having Wi fi connectivity issues , while using my computer the wi fi dropped out , I can no longer connect and no networks come up. I have tried looking into the air port, trying manually to connect to the desired network with no success , it says the Wi fi is turned on. I am at a loss to why it will no longer connect, please if you have any suggestions,as I tried to ring apple support but my warranty has expired this is my first major issue since I purchased it in 2009.
    Thanks

    My 4s i-phone which is 2 years old cannot find any wi-fi networks not even my home network... I had the same problem two months ago but i turned off the i-phone for 8 hours and then it was okay... Now it happened again.... I tried to restart the modem but whilst my laptop is connected regularly, my phone still cannot find any wi-fi networks... I restart the i-phone, i reset it, i chose reset network settings, reset all settings, i turned it off for a whole day in case it was overloaded, i turned on the airplane mode and turned it off again, i put it into the freezer for 10 minutes within a zipped bag but 3 days now and i still cannot be connected to my home wifi... I went to the technician today and he told me that it means that wi-fi is broken and that i need to change it with a charge of 70 euro but i have to give my phone for 10 working days so as to be fixed... I am so frustrated and i don't know if i want to give 70 euro for wifi since i don't know if it would make the same problems again... 

  • Hello, I have a MacBook Pro from 2011 and I accidentally while playing around with it deleted everything off my hard drive and I need to know how I can re install an operating system. Would I have to download it.

    Someone please help me
    I'm not sure what I should do to re install an operating system would it be possible to install mavericks
    I don't have the operating system backed up

    That's not good. OS X Recovery requires a high speed broadband connection as noted here > About OS X Recovery
    Check your download speed here >  Speedtest.net - The Global Broadband Speed Test
    Message was edited by: CS

  • I downloaded the web developer plugin and a bunch more....was just playing around with my site externaly with the develper trying to figure it out. long story short, my page view got messed up and i wanted it back normal so

    ... i unistalled all the add ons and even updated to firefox4 then back to 3.6. my site is still fine on the other computers in the house but on mine i still cant view it. the pictures are gone...formating is off...whats going on? thanks

    This method is slow and ridiculous ...
    Yep. So don't use it, use the "piano roll" view - you have a lot more control over the lenghts of your notes and the exact beginning. Enter the notes by holding down the Apple key and clicking and dragging (the onscreen keyboard can only be used in "record" mode). Use the same mode to modify imported midi tracks.
    There are no solo strings in GB, but you should have a string ensemble and some basic choir.

Maybe you are looking for