Need help please!im getting confused!

Hi,im trying to create a simple prog that would give me lollipops (10p) and doughnuts(20p) enough to spend 1 pound (100p) in random order using math.random and methods...Im getting very confused with
the combination of these and my code according to the book seems fine,but im getting an error of <identifier> expected at the "private double myMoney" line and ')' expected at the same line...
Here's the code:
import java.awt.*;
import java.applet.Applet;
public class Lollipop2 extends Applet {
          private double myMoney (MoneyGiven){
          int MoneyGiven = 100;
          int MoneyPaid = (int)(Math.random() * 2) + 1;
     return MoneyPaid; }
public void paint(Graphics g) {
     if (MoneyPaid = 1 || MoneyGiven = 10 && MoneyGiven >0){
drawLollipop(g, 10, 10, 30, 60);
g.drawString("10p", xPos, yPos);
     MoneyGiven -= 10;}
if (MoneyPaid = 2 && MoneyGiven >0){
drawRing(g, Color.magenta,40,40,30,12);
g.drawString("20p", topX, topY);
     MoneyGiven -= 20;}
private void drawLollipop(Graphics gIn, int xPos, int yPos, int width, int height){
gIn.drawRect(xPos, yPos, width, height);
gIn.drawRect(xPos+width/2, yPos+height, 4,15);
private void drawRing(Graphics gIn, Color ringColor, int topX, int topY, int diameter, int thickness){
gIn.setColor(ringColor);
gIn.fillOval(topX,topY, diameter, diameter);
gIn.setColor(Color.white);
gIn.fillOval(topX+thickness,topY+thickness, diameter-2*thickness, diameter-2*thickness);
gIn.setColor(Color.black);
Can someone please help me???

Im getting very confused with
the combination of these and my code according to the
book seems fine,Nope, your code is not according to the book, starting by the name conventions, your variables should start with lowercase and each word inside the var name should start with uper case and your brackets use is disturbing, the closing brackets should be on its own line.
Besides that:
import java.awt.*;
import java.applet.Applet;
public class Lollipop2 extends Applet {
private double myMoney (/* here you should havae the type of money given, like: int, long, float, double, BigDecimal, etc. */MoneyGiven){
int MoneyGiven = 100; /* here you are reusing the parameter name as a local variable. */
int MoneyPaid = (int)(Math.random() * 2) + 1;
return MoneyPaid; } /* Your method signature is double but you return int, it may give you a warning. */
public void paint(Graphics g) {
  /* Bellow in the condition:
   * 1 - there is no MoneyPaid or MoneyGiven vars anywhere to code to use.
   * 2 - You are using attribution(=) to the variable instead of comparation (==)
if (MoneyPaid = 1 || MoneyGiven = 10 && MoneyGiven
0){drawLollipop(g, 10, 10, 30, 60);
g.drawString("10p", xPos, yPos);
MoneyGiven -= 10;}
if (MoneyPaid = 2 && MoneyGiven >0){
drawRing(g, Color.magenta,40,40,30,12);
g.drawString("20p", topX, topY);
MoneyGiven -= 20;}
private void drawLollipop(Graphics gIn, int xPos, int
yPos, int width, int height){
gIn.drawRect(xPos, yPos, width, height);
gIn.drawRect(xPos+width/2, yPos+height, 4,15);
private void drawRing(Graphics gIn, Color ringColor,
int topX, int topY, int diameter, int thickness){
gIn.setColor(ringColor);
gIn.fillOval(topX,topY, diameter, diameter);
gIn.setColor(Color.white);
gIn.fillOval(topX+thickness,topY+thickness,
diameter-2*thickness, diameter-2*thickness);
gIn.setColor(Color.black);

Similar Messages

  • New to iCloud and need help please with getting it working

    I've got an iPad 2 and an iPhone 5 and have decided that it's about time to set up iCloud on my devices. I have followed the instructions on the website and in the icloud settings on both devices have switched on mail, contacts, calendars, reminders, safari, notes, photostream (my photo stream-on), documents and data, find my iphone, and icloud backup on. I have ensured that both devices have been backed up and automatic downloads on iTunes & App stores have all been switched on.
    I have not yet set up my PC for iCloud.
    My understanding is that icloud will sync new downloads and photos etc so I have just tried taking a picture on my iphone, expecting it to appear in my camera roll on my iPad and nothing has happened.
    Please can someone advise me if I am doing something wrong or how to resolve this.
    Many thanks.

    Welcome to the Apple Community.
    Photostream only syncs photos over Wi-Fi, make sure you are connected to Wi-Fi to begin with.
    Photostream only syncs when the camera app is closed, ensure it is closed.
    Photostream only syncs when the battery is above 20%, try recharging the device
    Try disabling photo stream on your device (settings > iCloud), restarting your device and then re-enabling photo stream.
    If this doesn't help you may need to reset photo stream. You can do this at icloud.com by clicking on your name in the top right corner and then the advanced settings in the pop-up dialogue box that appears.
    Note: disabling photostream and re-enabling it will result in any photos that are currently in the photostream album on your device, that are older than 30 days old, not being added back.

  • HT1222 I am trying like **** to download itunes 10.6.3 (64 bit - Windows 7) and I keep getting "the installer was interrupted before the requested operations for iTunes could be completed.  Your systems has not been modified."  I NEED HELP, PLEASE!

    I am trying like **** to download itunes 10.6.3 (64 bit - Windows 7) and I keep getting "the installer was interrupted before the requested operations for iTunes could be completed.  Your systems has not been modified."  I NEED HELP, PLEASE!

    I got it figured out myself... yaaaaay for me!

  • Bought a new macbook and want to manually manage music onto my iphone 4s but when i click 'manually manage' and then 'apply' i get the message saying it will erase everything already on there. Need help please!

    Bought a new macbook and want to manually manage music onto my iphone 4s (as it is already full of music from old windows laptop) but when i click 'manually manage' and then 'apply' i get the message saying it will erase everything already on there. Need help please!

    Before you sync your iPhone make sure that all the music that was synced to your phonereviously has been copied to your iTunes on the new MacBook Pro. Then when you connect your phone you will be able to either sync all music or select only those playlists that you want on the phone.

  • My iPhone 6 can't find my macbook pro on the airdrop list, although everything is in place, bluetooth, wi fi gets, need help please ?

    My iPhone 6 can't find my macbook pro on the airdrop list, although everything is in place, bluetooth, wi fi gets, need help please ?

    Dear Niel, thank you but my mac is (MacBook Pro (Retina, 15-inch, Early 2013).
    and i can send from it to my iPhone , but not vice versa

  • HT201413 I need help please!!!!! My iPhone 4 s won't charge!!!!! I get error message 21. How can I get around this.

    I need help please I keep getting error messega 21 when i try uploading my iPhone 4 s!!!!!!!!! omg some one please tell me if and how to fix this please. thank you!!!

    Hopefully this link will help you: http://support.apple.com/kb/HT2109

  • After my iphone4S update to 7.0.6, it have a problem that keep searching network then no service show on display. Can't call. I have try check sim card, reset network settings, and restore my iphone. Still not working at all. Need help please.

    After my iphone4S update to 7.0.6, it have a problem that keep searching network then no service show on display. Can't call. I have try check sim card, reset network settings, and restore my iphone. Still not working at all. Need help please.Urgent.TQ

    Izit software or hardware? Confuse:(
    Only can use wifi now.
    Any way thanks guys for ur suggestion:) amishcake and simes

  • I had a problem with my itunes so i had went on itunes website and reinstall itunes for windows and after it complete it said that the feature yoy are trying to use is on a network resource that is unavailable i need help please!!!!!!!!!

    had a problem with my itunes so i had went on itunes website and reinstall itunes for windows and after it complete it said that the feature yoy are trying to use is on a network resource that is unavailable i need help please!!!!!!!!!

    first, head into your Add/Remove programs and uninstall your QuickTime. if it goes, good. if it doesn't, we'll just attend to it when we attend to itunes.
    next, download and install the revo uninstaller http://http://www.revouninstaller.com/revo_uninstaller_free_download.html. use it to clear any existing itunes and/or QuickTime installation configuration information from the PC.
           next download itunes. it worked for me hope this is helpful!!
        oonce you get into the revo uninstallergo thru to delete itunes hit uninstall on the itunes icon then you will go thru to it will tell u the same nmessage about the feature and network hit cancell then go thru and hit scan (make sure bthe advance scan button is pushed) this will take awhile but go thru the list and hit everything associated with itunes. hit delete then install itunes again. it worked for me hope it works for you!

  • I need help please-ipod mini/itunes help

    Hi,I have a computer and a laptop. I would like to add my computer itunes libary to my laptop intunes libary.Both liberies are itunes7. I just cant do it. I need help please. Simple steps or someone on the phone or someone who lives in Wimbledon and could come by and help me,cheers.Conny

    Check these out:
    Getting Music from your iPod to your Computer 3rd party options
    Using One iPod With Multiple Computers
    I hope this helps!

  • HT204380 I can't access my FaceTime and messages through my iPod touch, I need help please!!!

    I can't access my FaceTime and messages through my iPod touch, I need help please!!!

    Using FaceTime http://support.apple.com/kb/ht4319
    Troubleshooting FaceTime http://support.apple.com/kb/TS3367
    The Complete Guide to FaceTime + iMessage: Setup, Use, and Troubleshooting
    http://tinyurl.com/a7odey8
    Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/TS4268
    Using FaceTime and iMessage behind a firewall
    http://support.apple.com/kb/HT4245
    iOS: About Messages
    http://support.apple.com/kb/HT3529
    Set up iMessage
    http://www.apple.com/ca/ios/messages/
    Troubleshooting Messages
    http://support.apple.com/kb/TS2755
    Setting Up Multiple iOS Devices for iMessage and Facetime
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
    FaceTime and iMessage not accepting Apple ID password
    http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/
    Unable to use FaceTime and iMessage with my apple ID
    https://discussions.apple.com/thread/4649373?tstart=90
    For non-Apple devices, check out the TextFree app https://itunes.apple.com/us/app/text-free-textfree-sms-real/id399355755?mt=8
    You posted in the iPad forum instead of the iPod forum. To get answers to your question, next time post in the proper forum. See https://discussions.apple.com/index.jspa  I'll request that Apple relocate your post.
     Cheers, Tom

  • How can I add a new Template to My Templates in Pages? I've read most of the discussions on the subject but it doesn't work for me. By the time I reach the Templates folder, I only see templates for Numbers and not for Pages. Need help, please.  Thanks

    How can I add a new Template to My Templates in Pages? I've read most of the discussions on the subject but it doesn't work for me. By the time I reach the Templates folder, I only see templates for Numbers and not for Pages. Need help, please.  Thanks

    Si vous avez utilisé la commande Save As Template depuis Pages, il y a forcément un dossier
    iWork > Pages
    contenant Templates > My Templates
    comme il y a un dossier
    iWork > Numbers
    contenant Templates > My Templates
    Depuis le Finder, tapez cmd + f
    puis configurez la recherche comme sur cette recopie d'écran.
    puis lancez la recherche.
    Ainsi, vous allez trouver vos modèles personnalisés dans leur dossier.
    Chez moi, il y en a une kyrielle en dehors des dossiers standards parce que je renomme wxcvb.template quasiment tous mes documents Pages et wxcvb.nmbtemplate à peu près tous mes documents Numbers.
    Ainsi, quand je travaille sur un document, je ne suis pas ralenti par Autosave.
    Désolé mais je ne répondrai plus avant demain.
    Pour moi il est temps de dormir.
    Yvan KOENIG (VALLAURIS, France)  mercredi 23 janvier 2011 22:39:28
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • HT4314 Hi i need help please i been playing clash of clans over 13 months. And today o realise what someone using my game Centra. Someone playing on my game Clash of Clans. I been change my Apple ID password, email, but doesn't work. Then I playing game I

    Hi i need help please i been playing clash of clans over 13 months. And today o realise what someone using my game Centra. Someone playing on my game Clash of Clans. I been change my Apple ID password, email, but doesn't work. Then I playing game I can see what someone else trying connecting to my game And I don't know what to do.So if you can help me please? I don't wanna lose my game.

    Contact iTunes
    Contact iTunes

  • Hi i need help please i been playing clash of clans over 13 months. And today o realise what someone using my game Centra. Someone playing on my game Clash of Clans. I been change my Apple ID password, email, but doesn't work. Then I playing game I can se

    Hi i need help please i been playing clash of clans over 13 months. And today o realise what someone using my game Centra. Someone playing on my game Clash of Clans. I been change my Apple ID password, email, but doesn't work. When I playing game I can see what someone else trying connecting to my game And I don't know what to do.So if you can help me please? I don't wanna lose my game. 

    Hello Vaidas Vaidas,
    It sounds like you are noticing someone else is accessing your Clash of Clans data by playing the game and you have tried to reset your Apple ID password. If you are following the steps outlined in this article:
    Apple ID: Changing your password
    http://support.apple.com/kb/ht5624
    What is preventing you from changing your password? Any error messages or prompts?
    Thank you for using Apple Support Communities.
    All the best,
    Sterling

  • I dont know how i got my photos to my ipod touch from my pc and now i wanna delete them but couldn't. so need help. please let me know.

    i dont know how i got my photos to my ipod touch from my pc and now i wanna delete them but couldn't. so need help. please let me know.

    To turn off auto sync - launch iTunes and go to Edit>Preferences>Devices - check the box at the bottom that says - Prevent iPod, iPhones and iPads from syncing automatically. Click OK and then quit iTunes.
    Connect your iDevice to your PC.
    Launch iTunes,
    Click on the device name on the left side of the iTunes Window.
    Click on the Photos Tab in the iTunes window on the right.
    Untick all of the photos or albums that you want to remove.
    Click on Apply in the lower right corner of iTunes
    If you untick or uncheck the Sync Photos heading and then click Apply it will remove all of the photos from the device when it syncs. In this screenshot - I have only certain albums and events selected to sync.

  • After many months of non-use, when I opened Photoshop CS4 Extended, I got an error message 148.3.  "Licensing for this product has stopped working."  I need help, please.

    After many months of non-use, when I tried to open Photoshop CS4 Extended, I got an error message 148.3.  "Licensing for this product has stopped working."  I need help, please.

    Error "Licensing has stopped working" | Windows
    Error "Licensing has stopped working" | Mac OS
    Mylenium

  • Hi, I have this green mark (with pointing arrow looks like a link) on some words show on my window screen when I open a web page, I wonder if it is a virus link or such. Need help how to get rid of it. Thanks

    Hi, I have this green mark (with pointing arrow looks like a link) on some words show on my window screen when I open a web page, I wonder if it is a virus link or such. Need help how to get rid of it. Here's the example:
    WING
    GAMES
    MAJORITY
    Thanks

    If the third link you posted (the link containing the word "majority") does not look like the following then you inadvertently installed adware.
    That particular page should resemble the following:
    The word "majority" in the third paragraph should not be a link and should not have the green icon associated with it.
    To learn how this may have occurred, and how to prevent it from occurring in the future, read How to install adware
    Most so-called "news" websites are nothing more than entertainment outlets that cater to prurient interests, and contain advertisements that leave the user about three clicks away from installing junk. If you decide to frequent those websites, Safari's "Reader" feature helps minimize that exposure.
    Try it:

Maybe you are looking for

  • How do I run HD Media from an External Hard Drive?

    I have a Macbook Pro, with Final Cut 7. I'm editing clips in HD shot with Canon 7d. I have a 250GB external Hard Drive. How do I set it up as my "Scratch Disk" and able to run all the media I'm editing from there too (for Playback, ect). And in the e

  • Mail search not working mavericks

    Mail search function is not working in any of my mail accounts...gmail, godaddy hosted domain or icloud. Tried deleting envelope index files and re-index...still doesn't work.  Bummer to have brand new 15" retina mbp all in at $3800 and have these ty

  • How do I set this up.. a background image in a flash drive as its opened

    Hi.. For a birthday present I want to give my friend 2 tracks and a folder.. I want the background to be an image and the 2 files and the one folder to line up as shown in the pic attached.. I have managed to make the flashdrive be an custom icon and

  • Integrating OID with AD: Import Config/ Synchronization fails

    I am trying to integrate OID with AD. The bootstrap is successful. I added a new entry to the AD after the bootstrap. The sync interval in OID is set to 10 seconds. The Synchronization Status in OID changes, but it is not successful. The updated Sync

  • Hi ,info need on container creation,methods,class,interface....

    hi ppl,           Can anybody give me information on what is and how to create container creation,methods,class,interface....with programs.