Need help with printing a random number.

So far I have...
* @(#)SlotMachine.java
* SlotMachine application
* Dylan Bailey
* @version 1.00 2008/11/19
// import scanners and random
import java.util.Scanner;
import java.util.Random;
public class SlotMachine {
    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String again = "n";
    int randomNum1, randomNum2, randomNum3;
    System.out.println("Slots Game!");
    Random gen = new Random();
    randomNum1 = gen.nextInt(10);
    randomNum2 = gen.nextInt(10);
    randomNum3 = gen.nextInt(10);
    System.out.println("Slot rolled: " + randomNum1 + randomNum1 + randomNum1 );     
}hah just kidding i fixed it.
But now what i need to do is an do while statement. I need to compare if 2 or 3 of the numbers are the same.
How do I go about this?
if what?
Edited by: Dylan.Bailey on Nov 19, 2008 10:31 AM

Wait lol that was just my example....
So far i have got....
     if(randomNum1 ==  randomNum2 && randomNum1 == randomNum3)
          System.out.println("JACKPOT! Congradulations!");     
       else{
            if((randomNum1 ==  randomNum2 && randomNum1 == randomNum3))
       But this is not working :(

Similar Messages

  • I need help with printing labels.  please

    I need help with printing labels.  thanks in advance

    Welcome to Apple Support Communities.
    In Address Book, first select a name or group of names to print.
    Then File, Print, select Style, Mailing Labels, then Layout to select a specific target label (such as an Avery number), or define your own...

  • Need help with Printer Setup conventions

    I can't get my Brother printer to print from one computer--but it prints okay from the other computer on my network. I need to know the conventions for the Printer Setup Utility.
    There's a checkbox by every printer on the list. What does it mean when the checkbox is grayed out?
    Some printer names appear in bold. What does that mean?
    Thanx.

    Thank you for your reply. I appreciate your help in this and just want to understand what you're saying.
    As I say, the printer is displayed in the print dialog box but the checkbox is grayed out. I'm assuming that when you say "...it can't find/see them now," you mean the print dialogue can't see them (the drivers). Your last sentence confuses me. You say, "Do you maybe have Printer Sharing enabled & they aren't actually directly connected? If so you have to reboot after turning it off." A little confusion about your antecedents here. What isn't actually connected? The printer? So I have to reboot after turning it off, "it" I suppose is the printer, is that right? I will try that. So turn printer off, reboot, turn printer on. Right?
    I will describe my problem. l thought that if I understood why the checkbox was grayed out I might see what my problem was. If you want me to start another topic I can do that.
    Problem: I have a network with 2 computers and the Brother
    multifunction fax/printer. I'm using an Apple airport hub. The printer
    and one computer (Mac tower) are connected to the airport base via
    ethernet. The 2nd computer (Apple laptop) is on the wireless network.
    Until recently i could print from both computers. Now I can't print from
    the tower. But I can still print from the laptop.
    When I try to print from the tower I get an error message that says, "Cannot print from current printer." I have rebooted, reinstalled printer drivers, checked cables, deleted printer from printer list and re-added printer all to no avail. But as I say, I can still print from the laptop which is using Airport. So the printer prints, the hub connects to the printer okay (ethernet) and I know the tower connects to the hub (I can ping the printer okay from the tower.)
    I am conversing to Brother support via email and their first suggestions I have already tried. Perhaps there's some problem in the network, but I can't figure it out. Worse yet, now when I go to the Network preferences I get an error message which says, "Your network settings have been changed by another application." THIS ERROR MESSAGE WON'T GO AWAY! I can click 'okay' but it reappears. I have to force quit the System Preferences to get out. If you can help with any of these problems I surely appreciate it.

  • Need Help with Print a Report

    Hi,
    I am building a database application in Java and now i need to print some reports ....
    I need to get the data from the database .. do some calculations , and then print in on paper.
    I checked online and got some tools like JasperReports, jfreereports, ReportCat, etc. so I was wondering if somebody can suggest whats the best.
    In my report I will have to print more than one table on one page.
    for example:
    if I have 4 Invoices. then i will have 4 tables .. one for each invoice.. and each table will contain
    the elements for that Invoice.If all can't fit on one page then it needs to go next page.
    I would like to do all this stuff in Java without using any reporting tool ... but I am not really sure how this can be
    done .. can someone give me an idea ... as per how this can be done .. will really appriciate all the help.
    Thanks in advance,
    sandsouza

    Hi,
    Can somebody please help me with this.
    Thanks in advance
    sandsouza

  • Need Help with Printer Please

    I am a new MAC user. So please, if you have a solution for me, speak slowly. (LOL)
    I have the new G5. Bought the Epson printer to go with it. It's the CX4200.
    I loaded the software for it. But can't get it to print. It seems the computer won't or can't find it in their list of printers.
    Ok, so I go to a Word Doc., for example. And select print. The window says that I need to select a printer. I hit the arrow down button and there's my printer listed. So I choose that, but still won't print. Seems I have to go down to another line in the same box and find the printer in this long list. There are many Epsons listed but not mine, which is the CX4200.
    And darn-it, tech support on the phone is closed at 6pm!!!??? I sure hope to see a reply soon. I really need to print something tonight.
    Thanks for any help you can provide.
    My personal e-mail is
    [email protected]
    Thanks!
    Cary
    PS: This process asked me to choose an OS for my G5. I have no idea what my OS is. All's I know is I have a G5. Gosh, I feel soooo dumb!

    What have you done so far?
    I suggest you connect it via a usb  cable first.  Once you get the printer working, move to wifi.  You will have to use an existing printer usb cable or purchase a cable.  Be sure to get the correct cable.  Ask for help.
    The warrenty indicates there is phone support.  Give HP a call.
    Warranty
    One-year limited hardware warranty; 24-hour, 7 days a week phone support
    Robert

  • Need help with rounding up a number

    In my codes, there is a loop and when I cfdump the value, it
    looks like this:
    2.0,.3.0,4.0, all the way to 32.0, etc
    I need to use these number in a For Loop from="1"
    to="#ThisNumber#" but first I need to round it up so ThisNumber
    will come out as a whole number and not with the dot zero
    Is there a function in CF that can do this? Please help!

    alecken wrote:
    > In my codes, there is a loop and when I cfdump the
    value, it looks like this:
    > 2.0,.3.0,4.0, all the way to 32.0, etc
    > I need to use these number in a For Loop from="1"
    to="#ThisNumber#" but first
    > I need to round it up so ThisNumber will come out as a
    whole number and not
    > with the dot zero
    > Is there a function in CF that can do this? Please help!
    >
    A quick glance at the documentation for mathmetical functions
    turns up
    int(), floor() and ceiling() depending on how you would like
    to round
    different types of numbers.

  • Need help with printing edocs with a laserjet1320. Wont print large jobs. installed 10.7 update.Help

    i am trying to print 50 page(5mb) document package on legal paper and the printer is printing one page at a time. I am using a macbook pro  10.7 and I have installed the update. however, it seems as though the computer is not correctly communicating with the printer. A four page job was no problem. I believe these printers are capable of high volume printing. Can I reinstall the firmware? Adobe acrobat will not even communicate with the printer. It just says "waiting for printer to become available." Using "preview", it sends the job to the printer, however, it is printing about 5pages per minute. It is connected through a usb cable. thanks for your help.
    Randy

    Randys714 welcome to the forum
    Your laserjet1320 is a commercial product. I will suggest posting in the forum for HP Business Support as well for yet a better chance at finding a prompt solution.
    You may find the commercial Laserjet board here.
    http://h30499.www3.hp.com/t5/Printers-LaserJet/bd-p/bsc-413
    Thanks;
    RobertoR
    You can say THANKS by clicking the KUDOS STAR. If my suggestion resolves your issue Mark as a "SOLUTION" this way others can benefit Thanks in Advance!

  • Need help with printing black and white pdf print at higher quality.

    We are a machine shop and many of our customers supply their prints for the tooling we need to make in .PDF file formats.  The problem is that some of the files are NOT of great quality.   They seem very faint.  I can view them on my computer no problem and when I zoom in, the quality is good, but whey they print, the dimensions and lines are very faint.   I have been pounding my head to come up with a way to improbe the quality in the following characteristics:  contrast, line quality, darker dimensions and lines, etc.   But I just cannot get anywhere.  Is there anyone that could give me some insight into how to do this.   If so, he or she would have my undying gratitude (which probably is not worth much, but sounds good!)
    The other thing is that some of our customers send their prints in .TIF or .TIFF file formats.  Is there any way to convert them to PDF and get good quality?  These .TIF and .TIFF files are a little worse than others. 
    Thanks ahead of time!
    Yok33

    I am going to try these suggestions immediately!  Thank you so much for the information. Wish me luck!
    Thank you and have a GREAT day!
    Steve Yokom
    Manager
    Northern Precision Inc.
    Phone:  989-736-6322
    Email:  [email protected]

  • Need help with printer sharing over ethernet

    I'd like to share the printer hooked up to my Mac Pro via USB with a MacBook in the same room. The MacBook is connected to my Mac Pro via ethernet cable (no router or switch; just a direct connection).
    I have enabled "Printer Sharing" on my Mac Pro.
    However, I'm not sure what to do from here. When I open up "Network" in System Preferences, and click on "built-in ethernet" it says "inactive". When I go to "Print and Fax Preferences" and attempt to add the printer connected to the Mac Pro, nothing shows up.
    I know I'm not understanding a key point here. If you could help me out I'd appreciate it. The goal is to allow the MacBook to use Airport to connect to the Internet, but to have access to the USB printer connected to my Mac Pro via ethernet (long story why this is necessary, but it is.)
    Thanks.

    Thanks for your offer to help.
    The printer is indeed connected to my Mac Pro via USB and is working perfectly.
    As I stated in the original post, printer sharing is enabled in System Preferences on my Mac Pro. There is an ethernet cable going from the ethernet 2 port of my Mac Pro to the ethernet port of my MacBook.
    The missing element was that I had not established a network connection between the two Macs. From the Macbook's Finder I chose "Go>Network" and then selected my Mac Pro. After I entered my username and password, I was connected to the Mac Pro.
    At this point I was then able to see the USB printer connected to the Mac Pro in the MacBook's "Print & Fax preferences".
    However, I still have one problem. When I add the printer on the MacBook, it chooses "generic postscript driver" even though I have recently installed the proper driver on the MacBook. Why would this be the case?

  • Need help with a simple prime number output program

    ok, the teacher asked for a program to output the first 90 prime numbers and i have been able to do that so far. but now he is asking for the numbers to be printed in a grid of columns and rows. specifically 9 across and 10 down.
    im stumped. what should i do 0_o
    so far, this is my program:
    package primetest;
    public class Main {
    public static void main(String args[]){
    int num1,num2;
    int flag=0; //Checks to see if the number in question is prime or not
    for(num1=1;num1<=463;num1++)
    flag=0;
    for(num2=1;num2<num1;num2++) //Remove the num2<=num1 and let it be as shown
    if(((num1%num2)==0) & num2!=1) //Thus you can remove the third condition
    flag=1; //Flag set to indicate that the number is prime
    if(flag==0)
    System.out.println(num1);
    }

    Congratulations, your code compiles, runs, and appears to produce correct output. (I didn't check every result.) That's far more than most students manage.
    I'd recommend that you separate generating the values from printing them. Can you store primes in an array and then pass that array to another method that prints them out according to your assignment's requirements?
    The good news is that you've solved a good chunk of the problem already. You only have the printing to worry about.
    I'd improve on your class naming. Main? C'mon. How 'bout PrimeFinder or something with a bit more imagination. Names matter in programming. If you gave me this class I'd have to look at the source code to figure out what Main did, but PrimeFinder gives me a hint just from the name.
    Move that stuff out of the main() method and into one of its own. Maybe you can pass in the upper limit over which you want the method to search for primes and return an array of values.
    %

  • New to Mac, need help with printing

    in my xp i could says that i want to print page 1-3 of the 20 pages in a document. i don't know how to do this with a mac. i also want to print fast draft, at least that is what it is called in xp. i want to set it so the mac tells my printer to use the least amount of ink in printing a doc. or i want to print
    black and white instead of color. but this is not shown when i want to print a document from the safari. when i press preview after i press print it opens another application. help. thanks again.

    i figured it out. sorry for the post. the help in safari gave printing webpages. that helped

  • I need help with printing photo collages

    I've made several collages with different apps such as Diptic & PicFrame on my ip4s and I have uploaded them onto my desktop.  I have attempted to print the collages through Walgreens however, the pics are usually cropped or don't fit no matter how I edit them using the Wlagreen photo editor.    I would like to print these on 4X6 or 8X10.  Any suggestions?  Thanks. 

    Use a different provider, or print them out yourself. Nothing we can do to assist you with walgreens

  • New modem, need help with printer

    I have an iMac 27" and a Motorola model, just switched out from an old one to a new one. Internet is running great now, but my printer won't recognize my printer wirelessly. I know I have to put in a password code, just can't figure out where in the world to put it on my HP C309A. Anyone know where it should go?
    TIA,
    Connie

    Thanks for your offer to help.
    The printer is indeed connected to my Mac Pro via USB and is working perfectly.
    As I stated in the original post, printer sharing is enabled in System Preferences on my Mac Pro. There is an ethernet cable going from the ethernet 2 port of my Mac Pro to the ethernet port of my MacBook.
    The missing element was that I had not established a network connection between the two Macs. From the Macbook's Finder I chose "Go>Network" and then selected my Mac Pro. After I entered my username and password, I was connected to the Mac Pro.
    At this point I was then able to see the USB printer connected to the Mac Pro in the MacBook's "Print & Fax preferences".
    However, I still have one problem. When I add the printer on the MacBook, it chooses "generic postscript driver" even though I have recently installed the proper driver on the MacBook. Why would this be the case?

  • Need help with printer

    Hi got a HP PSC750 all in one new ink but i do know its hasnt got the right power supply for it, whats going on is as soon as you turn the power on it comes on says initalize for about 5 seconds then truns off and repeats its self.
    Would this be the cause of wrong power supply or not thanks. 

    The one and only time I had to install a printer on me mac I did almost exactly the same thing, but with a Samsung printer. I found that the apple printer driver system is very finiky about getting the order of events right, otherwise it wouldn't search the hdd and find the driver.
    My recommendation is basically to download the print driver, click the driver to start the installation wizard, reboot to put the apple into a known state, then open the apple printer configuration whatsit and install the printer.
    I wasted a day figuring this out, so I wrote up the steps I took on this page:
    http://www.de-minimis.co.uk/projects/SamsungSCX-4100_***MacOSX/index.html
    Good luck.
    I note that the robotic morality comittee has starred out part of the above URL. It should read:
    S C X - 4 1 0 0 _ c u m _ M a c O S X
    c u m = perfectly good latin for "with"!

  • Need help with printer friendly

    I would like to create a new template for printer friendly mode. I would like the text to appear just as large and in the same locations in printer friendly mode just as it appears on the form before clicking the print button .Could someone please lead me in the right direction on what to do. Please take into account I am not a HTML guru.
    Thanks

    Hello
    I would like to know how to have a printer friendly page print according to my printer preferences. Currently when I print I am left with what appears to be pieces of graphics around a report as well as not printing in duplex mode as the printer preferences define.
    I too am not an HTML programmer, are there additional setups to check aside from the "Printer Friendly" checkbox?
    Thanks for any help

Maybe you are looking for

  • Error while trying to redploy orabpel.ear

    Hi , I as facing some issues. The orabpel link doe snot show up inder oc4j_soa. I did the follwoing stpes Stop SOA Suite :opmnctl stopalll BPEL Console 1. Backup and edit $OC4J_HOME/applications/orabpel/console/WEB-INF/web.xml 2. Delete $OC4J_HOME/ap

  • How to control the call to a data control using portlet parameter

    hi, i'm using a web service data control on my portlet application. I'd like to know if there's a way where in the data control will not be called when the portlet is loaded,unless the portlet parameter is specified. thanks in advance! Rian

  • What is use of Capital & Manual Event in Oracle Capital Projects?

    Hi Dina / Experts, Can anyone explain me the real application scenario or use where Capital Event or Manual Event will be in used? As per my understanding it is used for assigning and allocating unprocesses asset lines to Asset. But I am not sure. Yo

  • PHP 5.1.4 Installation Error

    I'm installing PHP 5.1.4 on RH 2.1 AS with below Kernel Version $ uname -a Linux auohsjohn11 2.4.9-e.49orags1enterprise #1 SMP Mon Oct 25 16:01:00 PDT 2004 i686 This is being installed as part of 10gAS Application Server 10.1.2.0.2, which I believe h

  • Two folders for one artist??? Help me please!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    Ok, im having trouble with my ipod 5G 60 gig. On my itunes, I made every artist the same spelling ( eminem has 5 songs and). But when i put it on my ipod 60gig, it makes two folders of eminem and biggie smalls. The songs are in the same artist folder