Break problem

I'm having trouble finishing this program, I can't seem to figure out whats wrong with it, I keep getting an error message I don't understand. Here's my code so far:
import java.util.Scanner;
public class PickTint
public static void main (String[ ] args)
int letter, colour;
Scanner scan = new Scanner (System.in);
System.out.println ("R Red");
System.out.println ("O Orange");
System.out.println ("Y Yellow");
System.out.println ("G Green");
System.out.println ("B Blue");
System.out.print ("Choose a colour from menu above :");
letter = scan.nextInt( );
colour = letter;
System.out.print ("You chose ");
switch (colour)
case 'R':
System.out.println ("Red");
break;
case 'r':
System.out.println ("red");
break;
case 'O':
System.out.println ("Orange");
break;
case 'o':
System.out.println ("Orange");
break;
case 'Y':
System.out.println ("Yellow");
break;
case 'y':
System.out.println ("Yellow");
break;
case 'G':
System.out.println ("Green");
break;
case 'g':
System.out.println ("Green");
break;
case 'B':
System.out.println ("Blue");
break;
case 'b':
System.out.println ("Blue");
break;
default:
System.out.println ("a non-existent item");
Any advice?

Any advice?yep
1) post using [code] tags2) if you have an error, whether you understand it
or
not, post it here. my psychic powers don't work on
Thursdays, I don't know about anyone elses
3) try and not guess what the problem might be(break
problem) - tell us what's actually going wrong
4) watch the Bikini Bandits movie. you'll never
listen to tool the same way again :-)okay, lets try again....
import java.util.Scanner;
public class PickTint
public static void main (String[ ] args)
int letter, colour;
Scanner scan = new Scanner (System.in);
System.out.println ("R Red");
System.out.println ("O Orange");
System.out.println ("Y Yellow");
System.out.println ("G Green");
System.out.println ("B Blue");
System.out.print ("Choose a colour from menu above
letter = scan.nextInt( );
colour = letter;
System.out.print ("You chose ");
switch (colour)
case 'R':
System.out.println ("Red");
break;
case 'r':
System.out.println ("red");
break;
case 'O':
System.out.println ("Orange");
break;
case 'o':
System.out.println ("Orange");
break;
case 'Y':
System.out.println ("Yellow");
break;
case 'y':
System.out.println ("Yellow");
break;
case 'G':
System.out.println ("Green");
break;
case 'g':
System.out.println ("Green");
break;
case 'B':
System.out.println ("Blue");
break;
case 'b':
System.out.println ("Blue");
break;
default:
System.out.println ("a non-existent item");
} slightly better. now, what's this error you're on about?

Similar Messages

  • Page break problems converting HTML to PDF

    hello,
    i'm using Acrobat Pro 7... yes I know I'll upgrade soon.
    I have a bunch of HTML files that are interlinked, and I want to create one big PDF from them.
    I'm going in through Windows explorer, selecting all the files, right-click, and click on "combine in adobe acrobat"
    it works very well, to combine them all.
    the one problem I'm having is page breaks. there are page breaks in the middle of tables.
    I have seen online a few references to using CSS style and something like this:
    TABLE { PAGE-BREAK-INSIDE: avoid; }
    but it seems to have no affect when I generate the PDF.
    do I need a different tool to make this work? Does Acro 8 or 9 have it? should it work with 7?
    thanks

    This is primarily a HTML feature as I understand it. Acrobat simply provides a PDF just like any other printer and the HTML would have to be set to add page breaks on print as you suggest. This would be the same case as if you printed to paper. I am not sure it is possible, but that is what I would look for, not Acrobat options.

  • Nokia N8 email line break problem

    So, I've only found one other post on here about this problem, with no solution.
    The problem being that when you reply to an email in a hotmail inbox on the N8. Any line breaks (created by pressing return) are ignored and the whole email is sent as one line. The only way to insert a line break seems to be to use the html tag < br/ > which is very inconvenient. Is this a bug or am I doing something wrong.
    Any advice from anyone would be much appreciated.
    dp

    Let's bring this issue again to Nokia's attention. This is very annoying issue, I guess it's a bug. They have to tackle it. It's associated with their client, because if you reject Nokia terms of use, this problem disappears!

  • A break problem in java.

    I am making a geography quiz, where a user can choose from 3 different quizzes: either plate tectonics, rivers or rocks. i have saved the questions in a textfile and their related answers in an array. In my quiz i have a set of questions, and i have done a count down timer, so that the questions should be answered within a specific amount of time. If the user doesn't answer the questions within the specified time, it issues a message saying "time over". My problem is that after it displays the message "time over" it continues to display the questions, and so the user can continue answer them, and this is a bit ridiculous. Even though i used a "break" its still not exiting the loop. To work in a good way, it should stop asking questions, and display the result. Can someone pls help me figure out my mistake? Thanks a lot for the help. :-)
    This is the code:
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    import java.util.Calendar;
    public class GQ extends JFrame implements ActionListener {
        private static final int FRAME_WIDTH = 140;
        private static final int FRAME_HEIGHT = 160;
        private static final int FRAME_X_ORIGIN = 70;
        private static final int FRAME_Y_ORIGIN = 50;
        AnswerStore answerStore = new AnswerStore();
        boolean timeForMore;
        public static void main (String[] args) {
            JOptionPane.showMessageDialog(null, "This is a Geography Quiz");
            JOptionPane.showMessageDialog(null, "Good Luck");
                GQ frame = new GQ();
                frame.setVisible(true);
        public GQ() {
            Container contentPane;
            JButton button1, button2, button3, button4, button5;
            setSize (FRAME_WIDTH, FRAME_HEIGHT);
            setTitle("Geography Quiz");
            setLocation(FRAME_X_ORIGIN, FRAME_Y_ORIGIN);
            contentPane = getContentPane();
            contentPane.setBackground(Color.pink);
            contentPane.setLayout(new FlowLayout());
            button1 = new JButton("Plate Tectonics");
            button2 = new JButton("Rivers");
            button3 = new JButton("Rocks");
            button4 = new JButton("Quit");
            contentPane.add(button1);
            contentPane.add(button2);
            contentPane.add(button3);
            contentPane.add(button4);
            button1.addActionListener(this);
            button1.setActionCommand("b1");
            button2.addActionListener(this);
            button2.setActionCommand("b2");
            button3.addActionListener(this);
            button3.setActionCommand("b3");
            button4.addActionListener(this);
            button4.setActionCommand("b4");
            setDefaultCloseOperation(EXIT_ON_CLOSE);
         public void actionPerformed(ActionEvent e) {
            String ac = e.getActionCommand();
            String[] questions = null;
            String[] answers = null;
            if (ac.equals("b1")) {
                questions = readFile("plate_tectonics.txt");
                answers = answerStore.tectonicAnswers;
            } else if(ac.equals("b2")) {
                questions = readFile("rivers.txt");
                answers = answerStore.riverAnswers;
            } else if(ac.equals("b3")) {
                questions = readFile("rocks.txt");
                answers = answerStore.rockAnswers;
            } else if (ac.equals("b4")) {
                System.exit(0);
             askQuestions(questions, answers);
        public void stopAndShowResults() {
            timeForMore = false;
        private String[] readFile(String path) {
            Scanner s = null;
            StringBuilder sb = new StringBuilder();
            String separator = "\n";
            try {
                s = new Scanner(new BufferedReader(new FileReader(path)));
                while (s.hasNext()) {
                    sb.append(s.nextLine() + separator);
            } catch(IOException e) {
                System.out.println("read error: " + e.getMessage());
            } finally {
                if (s != null)
                    s.close();
        private void askQuestions(String[] questions, String[] answers) {
            int count = 0;
            int point = 0;
            for(int j = 0; j < questions.length; j++) {
                String input = JOptionPane.showInputDialog(null, questions[j]);
                if(answers[j].equals(input))
                    count++;
                    point++;
                    timeForMore = true;
                else if(timeForMore=false)
                    break; // here its not breaking. Is there something wrong here?
                JOptionPane.showMessageDialog(null, "You answered " + count +
                                          " out of " + questions.length +
                                          " questions correctly.");
                JOptionPane.showMessageDialog(null, "Your Geography Quiz score is " + ((point*100)/10) + " % ");
              if(point>=0 && point<=3)
                  JOptionPane.showMessageDialog(null, "You need to Improve");
             if(point>=4 && point<=7)
                  JOptionPane.showMessageDialog(null, "Good");
               if(point>=8 && point<=10)
                  JOptionPane.showMessageDialog(null, "You did Great");
    class AnswerStore  {
        String[] tectonicAnswers = {
            "Hellenic", "destructive", "100km", "Italy", "Wegner",
            "Mariana", "Sicily", "created", "constructive", "Mediterranean"
        String[] riverAnswers = {
            "Gorges", "Meanders", "Levees", "Yes", "Less Economic Developed Countries",
            "crescent shaped lakes", "More Economic Developed Countries", "No", "River Discharge", "No"
        String[] rockAnswers = {
            "40km", "Igneous Rock", "Sedimentary", "Basalt", "Organic",
            "pressure", "Oolites", "Igneous", "dark black", "basalt"
    }Thanks again for help.

    From the language specification:
    http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.26
    At run time, the result of the assignment expression is the value of the variable after the assignment has occurred. The result of an assignment expression is not itself a variable.
    In your code, you have an assignment, not a comparison in your if condition:
                else if(timeForMore=false)When the else if condition is evaluated, timeForMore gets set to false, but then the else if block doesn't evaluate, because the condition's value was false. So the break statement is always skipped. Make it a comparison with == and it will work the way you expect.

  • Adding Subforms on Click + Page Breaks Problem

    Hi all,
    i made a form containing a few Sub forms and Text Fields which grow by the Number of Lines the User writes.
    However, I made one button to add a sub form containing 5 of these text fields
    and it works fine but when it comes to the end of the page and I click on the button again, it doesn't break to the next page, the new sub form is simply added below the last, half cut by the end of the first page...
    So my Question is how do I add a page break after the page is either full or a certain number of those sub forms exist?
    Kind Regards

    I have a similar problem. I have 2 subforms side by side that have independent columns of data. Either one of these subforms may expand onto a second page. I am stumped on how to keep the positioning correct (IE: If the content area flows western style it looks correct on page 1, but if I flow to page 2 the second column ends up on page 2. But if I position the two columns, then page break doesn't work).
    For a single row of data you need to make sure your positioned fields are in a subform that is inside a flowed subform that allows page breaks and adjusts to fit.

  • Large Word document imported into Pages with "Section Break Problems"

    Hi there,
    I am importing a large Word document with many photos (>250 pages) into Pages. Now, the problem is that when using the "page thumbnail" window to the left it marks all my windows with a yellow border.
    This means that I can't duplicate single pages - it will duplicate the whole stuff. Same thing for delete.
    I can go to the last character of each page and insert a "section break". This creates single pages. But it seems a bit odd to me, and with >250 pages, this is quite some work too.
    Any idea what I can do to solve quickly the issue?
    Thanks for any hints!

    Sections are what they say they are natural breaks in the document.
    Each section usually having headers footers and other basic content in common.
    Effectively just like chapters in a book or specifically designed pages in a magazine or report.
    If your text naturally flows from one page to the next then they should stick together.
    If on the other hand you are treating them all like single leaves of paper to be shuffled around, then you need a section break at the end of each page.
    3 ways you can quickly do this:
    1. There is a unique start to each page such as a return followed by a particular word. You can search on this combination replacing it with a section break followed by the word.
    2. You can make a short cut to do this from the keyboard
    3. You can copy a section break and paste it at the end of each preceding page.
    4. You can transfer by copying and pasting the content into a Layout mode document where every page is its own section.
    As with most work, planning, organisation and thinking before you leap, pays off in the long run.
    Peter

  • Column break problem in word 2010

    Hi,
    I have a 2 column document. Some how i feel it has inserted a column break in the middle of page 7 of my word document which consists of 12 pages. It is a reviewed document & tracking is also going on and 'Track Changes: On' message is also visible on
    my progress bar. On page 7 i have a figure also which is one column wide. The text above this figure goes on to next column after 9th line. There is still a 3 line gap between my text & figure. But its moving the text to next column. After the figure it
    shows me the text which should come after the moved text. Please guide me how to fix this problem.
    Zulfi.

    Hi Zak100,
    Thanks for posting in MSDN forum.
    This forum is for developer discussing developing issue involve Word application. Since the issue is more relative to end-user, I would like to move it to
    Word IT Pro Discussions forum.
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.
    Thanks for your understanding.
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Line break problem

    Hi all,
    line breaks that i'm giving in text area's text are not been showed by JSP's simple function recordset.getObject(). for instance, if u know PHP...i want a function that perform task similar to nl2br();
    desperately waiting for replies.
    Regards.

    It is just a parser problem, I think it is quite easy to write one yourself :-)

  • How to solve the auto word break problem in Arabic language Flex project

    Hi, I'm using Flex SDK 3.5 to develop a game in Arabic. Now I have a problem with the auto word break on the TextArea Control.
    The output looks like this (Sorry I can't type arabic, so I use English instead)
    I don't know any A
    rabic text
    The expected outpit should be
    I don't know any
    Arabic text
    My settings of the textarea are fine in English version games. But just didn't work in Arabic. Any idea how to solve this problem? Thanks.

    Hi Rodger,
    Sorry to reopen this thread again. I was puzzled by the data format in Motion-DDK.
    From the Motion-DDK, if u32, i32 and f64 data are passed to and from the controller, a specific format must be followed as below:
    u32:
    u32 cmddata[x] = (WORD) (u32data ?16);
    cmddata[x + 1] = (u16) u32data;
    i32:
    i32 cmddata[x] = (WORD) (i32data ?16);
    cmddata[x + 1] = (i16) i32data;
    f64:
    f64—big endian order cmddata[x] = ((u16) (&f64data)) [3];
    cmddata[x + 1] = ((u16) (&f64data)) [2];
    cmddata[x + 2] = ((u16) (&f64data)) [1];
    cmddata[x + 3] = ((u16) (&f64data)) [0];
    f64—little endian order cmddata[x] = ((u16) (&f64data)) [0];
    cmddata[x + 1] = ((u16) (&f64data)) [1];
    cmddata[x + 2] = ((u16) (&f64data)) [2];
    cmddata[x + 3] = ((u16) (&f64data)) [3];
    My first question: is the "?" symbol means the >> (shift operator) or something else?
    The second question is: if "?" means ">>" in this list, all the u32 and i32 data are always transferred in big-endian order. Is it the only correct way to deliver the i32 and u32 data? Or I can pass the u32 and i32 either in little-order or big-order depending on my platform?
    The last one: could you provide a feasible C code on how to convert the f64 data to u16?
    I first followed the format in the list to convert the f64 data, but met with a lot of compiler errors in VC++. After checked with MSDN, it is said the convert process is double(f64)->long(i32)->unsigned short(u16). But the decimal part of double will be truncated during converting to long...
    So, could you help me with some very simple sample code on the convert process? 
    Thank you for your support!
    Rick
    MSP

  • Line breaks problems...

    Hi!
    In a Flash Interface, users can write and send messages.
    Even if they use "carriage returns" in their message like,
    for example:
    "Hi!
    How are you?
    I feel fine.
    Shall we have dinner tonight?
    Hugs and kisses,
    Jeff"
    the message sent is on only one line like, for example:
    "Hi!How are you?I feel fine.Shall we have dinner tonight?Hugs
    and kisses,Jeff"
    Any solution platform and browser independent?
    Thanks in advance for your tips!

    you'll need to check the problem's cause. almost certainly
    flash is detecting the line breaks. the problem is probably
    occurring in the code that's receiving what flash sends.

  • Dual layer break problem on DVD playback

    Hi,
    I'm on Encore CS5.1
    I've got a dual layer DVD program I'm trying to output but playing stops and reverts to menu at what I believe is the layer break.
    The program is approx 6.5GB in total size. I encoded prior to importing into Encore, at highest MPEG2-DVD quality. I slid quality slider all way over from 4 to 5, among other things to force highest quality. The source files are AVCHD destined for Standard Def DVD.
    It took me a little while to suspect the break as the culprit. I did one burn where the disc continued playing thru the offending spot and I saw that and said to myself: "self, that looks like a layer break to me."  Upon examination it is just about exactly in the middle of this program.
    I suppose I should consider encoding at lower bitrate and burning at slower speed. Can anyone who's had this problem tell me if this will likely fix it, before I re-encode.
    I've also heard about manually setting the spot for the bereak and I chose "manual" not "automatic" but it did nothing to allow me manual control.
    All experienced insights welcomed.
    Thanks
    wsmith

    Imgburn will help get the "best possible" burn by allowing you to select the slowest possible burn speed for the disc brand/model you are using (this is MY opinion... other people say burn at the fastest speed)
    You might Google to see if you can find any reviews of the Ritek brand
    As far as your layer break stoppage... I've only done a couple of dual layer projects, with Encore doing all the work with automatic settings, and have never had a problem... but, I use Verbatim dual layer, not Ritek
    http://www.amazon.com/Verbatim-96542-8x-10x-Recordable-Spindle/dp/B001D8OGOO/ref=sr_1_2?ie =UTF8&s=electronics&qid=1278644298&sr=8-2
    or
    http://www.newegg.com/Product/Product.aspx?Item=N82E16817130040&cm_re=verbatim_dvd%2br_dl- _-17-130-040-_-Product

  • Lenovo Y50 still have the hinge breaking problem?

    Do anyone know if the Lenovo Y50 is still having the screen display hinge breaking or exploding from the base problem?

    My Laptop has just started falling apart about a month after my warranty ended (of course) here is my list of problems that have been happening since my warrenty ended. 1. The part that the screw actually screws into the part that holds the hinge to the laptop has broken off so my screen is being held on by 1 screw very scary as it could fall of any minute. 2. The plastic piece that covers the hinge will pop off everytime I open my laptop and makes a horrible cracking sound when I have to keep opening my laptop to snap back the plastic piece so that I can use my laptop. I am now using scotch tape to fix this for now very embarrasing when gaming with my friends. 3. I have been slowly losing screws on the bottom of my laptop to hold the whole thing togeather I am now down to 8 out of the 12 that are supposed to be there. A screw just recently fell off and it happend to be the last screw that was holding my screen to the laptop so I had to swap some screws around so that my screen was being held on by something. I was looking for a quality gaming laptop I could take to college and I will be heading off to college in a month!  I would not sugguest this laptop and will probably never purchase a lenovo product again as this seems to be a somewhat common problem.

  • Layer-Break Problem

    Hallo
    folgende Fehlermeldung erscheint beim erstellen einer DL Dvd:
    DualLayer - Diese Disc benötigt einen Layer-Break.
    Nach dem durchlesen diverser Foren habe ich nach wie vor keine brauchbare Lösung gefunden. Ein Lösungsvorschlag ist den Layer-Umbruch auf manuell einzustellen. Doch wenn ich dies mache, erscheint kein Einstellungsfenster. Soviel ich weiss, sollte der Layer-Umbruch auf dem Schnittfenster ersichtlich sein? Aber weder bei der Einstellung "automatisch" noch bei "manuell" erscheint der Layer-Umbruch auf der Timeline.
    Die Dvd sollte bald möglichst fertig werden und ich bin langsam aber sicher am verzweifeln.
    Hat jemand eine Idee was das Problem sein könnte? Schon mal besten dank für eure Hilfe....
    viele grüsse
    C.L
    Zusammenfassung meines Projektes:
    - Hauptfilm ProRes 442 HQ, 112min, 20 Kapitel (keine Fehler beim transkodieren)
    - Mainmenu mit "play" und "scene" button, animiertes Video (ProRes 442HQ) als Intro
    - 2 Kapitelmenü mit je 10 VideoButtons
    - Bei Projektprüfung erscheint kein Fehler, erst beim erstellen nach dem transkodieren
    - DVD+R DL, habe mit dem DVD-Laufwerk schon mehrmals DL-Projekte gebrannt. Das DVD-Laufwerk kann also auch nicht das problem sein
    - Disc-Info: 8.14GB verwendet

    Hallo
    Leider konnte ich das Problem nicht direkt lösen. Aber beim erneuten herstellen des gesamten Projektes (auf einem anderen Computer) konnte ich schlussendlich die DVD problemlos brennen.

  • Aggragate and Control Break problem

    According to HELP:
    "Aggregates are displayed after each control break and at the end of the report within the column they are defined. "
    I have report with control break by 1 field.. I've added SUM aggregate function to Orders column.
    For now I can see summary by group but no summary at the end of report.
    Is this know problem?
    Thank you,
    alex

    Alex,
    Well, the help text may be misleading. But aggregates are displayed in both places mentioned, just not simultaneously. It should be easy to see the grand totals by toggling off the control break settings.
    If you want to see both at the same time, I'd add that to Carl's Post 3.1 Enhancement Request thread: Enhancement Request Thread : Post 3.1
    Thanks,
    Marco

  • Page break problem in rtf template

    I have a nested group as follows:
    For each sub-vote sub-vote desc
    - For Each sub-program details....end of for each sub-program
    total for sub-vote
    end of for each sub-vote
    If the sub-vote and all of its detail records won't fit on a page, then I need a page break.
    The fields are set up in a table. I have unchecked the 'allow row to break across page' for all 4 rows.
    I tried drawing a new table around the existing 4 rows, but I can't seem to uncheck the 'allow row to break across page' for the new table. How do I change properties for the 'parent table' - I'm looking for something that is equivalent to 'select parent frame' from report builder.
    I also tried checking the 'keep with next' checkbox on the paragraph/format for each row.
    When I preview/pdf in word, my sub-programs within a sub-vote are still displaying on differrent pages.
    If anyone can make any suggestions, I would greatly appreciate it.
    Thank you.

    I created a new row and then copied the cells (minus the 'for -each' and 'end of for each' cells) as a nested table. Page breaks are now working correctly.
    Thank you.

Maybe you are looking for