Beginner question regarding switch statements with arrays....

Doing a little project for my beginner's object oriented programming course. I've written the following code, but the switch statement won't recognize my array values....I'm required to use a switch statement in my program, which will count various character types in an external file....any insight is appreciated.
import java.io.*;
public class MyProg
  public static BufferedReader inFile;
  public static void main(String[] args)
    throws IOException, StringIndexOutOfBoundsException
    String line;
    inFile = new BufferedReader(new FileReader("TME5Part1.dat3"));
      char UpperCase[]= {'A','B','C','D','E','F','G','H','I','J','K','L','M',
                                      'N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};          
      char LowerCase[]=     {'a','b','c','d','e','f','g','h','i','j','k','l','m',
                                      'n','o','p','q','r','s','t','u','v','w','x','y','z'};
      char Digit[]= {'0','1','2','3','4','5','6','7','8','9'};
      char EndMark[]= {'!','.','?'};
      char MidMark[]= {',',':',';'};
    char symbol;                                                            
    int upperCaseCt = 0;                                             
    int lowerCaseCt = 0;
    int digitCt = 0;
    int endMarkCt = 0;
    int midMarkCt = 0;
      int spaceCt = 0;
      int otherCharCt = 0;
    line = inFile.readLine();          //read first line (priming read)
    while (line != null)               // Loop until end of data (empty line)
      for (int count = 0; count < line.length(); count++)  // Loop until end of line
        symbol = line.charAt(count);                    
            for (int i=0; i<=25;i++)                              
                    char uppercase=UpperCase;               //get array values for i
                    char lowercase=LowerCase[i];
                    if (i<=9) {char digit=Digit[i];}               
                    if (i<=2) {     char endmark=EndMark[i];     
                                        char midmark=MidMark[i];
                    switch(symbol)                                             
                              case uppercase : upperCaseCt++;
                                        break;
                              case lowercase : lowerCaseCt++;
                                             break;
                              case digit          : digitCt++;
                                             break;
                              case endmark     : endMarkCt++;
                                             break;
                              case midmark     : midMarkCt++;
                                             break;
                              case ' '          : spaceCt++;
                                             break;
                              default          : otherCharCt++;
                                             break;
          line = inFile.readLine();                                   
     System.out.println("Number of uppercase letters = "+upperCaseCt);               
     System.out.println("Number of lowercase letters = "+lowerCaseCt);
     System.out.println("Nubmer of digits = "+digitCt);
     System.out.println("Number of end punctuation marks = "+endMarkCt);
     System.out.println("Number of mid punctuation marks = "+midMarkCt);
     System.out.println("Number of spaces = "+spaceCt);
     System.out.println("Number of other characters = "+otherCharCt);
I was trying to do it this way rather than "case 'A':
case 'B':
case 'Z:" for each type of 'symbol'.
Unfortunately, the switch statement is required or this would be easier with arrays and for loops...I'm not sure if my code is even possible. Thanks in advance =)
Edited by: RiTarDid

RiTarDid wrote:
For sure it is the most straightforward way, but my curiosity is getting the better of me....I will most likely submit the program with the longer (value-by-value) switch method, as I haven't found anyone who can tell me how to properly reference an array value in a 'case'.Well, you can do this (basically):
switch(some_array[some_index]) {
    case 'a':  blahblah
    case 'z':  blahblah
}What you can't do is this:
switch(some_scalar_value) {
  case a_whole_array:  blahblah
  case a_whole_another_array: blahblah
}Because the latter isn't what "case" means.
If you want to do something like the latter, use if/else statements. Here's a dirty little industry secret: people seldom use switch/case. if/else is a lot more common.
Actually that dirty little secret isn't really particular dirty or particularly secret. It is, however, little.
I just recall a suggestion to use arrays for any group that is more than 10 values in size;Well...sort of...
You should use the expression of data that's appropriate for what the data is. If it's a collection of data of the same kind and an ordering, then an array or a java.util.List makes sense. If it's data that is of the same kind but no ordering and no duplicates are allowed, use a java.util.Set. (Etc. on this front.) If it's a collection of un-alike data, but which belongs in associated groups (e.g., a user's name, age, height, and whether s/he's married) then you should create a class that represents that logical grouping. Etc. If you have more than 10 individual data that can't be grouped or collected somehow, then chances are you need to rethink what's happening.
so I wanted to see if an array could be employed for comparisons with the 'switch' statement. The program is simple enough, I'm just trying to flex my problem-solving muscle in different ways. :)
thanks for replying, hope I can get a definite "yes, it can be done this way" or "no it can't" if there's anyone out there who knows.....The problem is that your example is contrived. So you can do a variety of things that fit into the contrivance, but they'd be weird things.
In practice, you'd want to use the character classification methods in Character, if you wanted to characterize a bunch of characters. Or maybe a regular expression. There's no need to keep an array of characters to match against if you want to determine whether a particular character is upper case. In fact, that's the wrong way of doing things, because Character.isUpperCase is more likely to tell whether any character (not just stuff that's also an element of ASCII) qualifies as upper case.

Similar Messages

  • Beginner question regarding 32-bit mixing and mixdown workflow

    Hello
    I have a beginner question regarding 32-bit mixing and mixdown.
    If I edit some 16Bit, 44.1kHz Stereo WAV Files and put them into multi-track view to do crossfades, how should I do the mixdown?
    Audition shows me in multi-track view, that it is doing 32-Bit mixing.
    Can I just mixdown to 16Bit, 44.1kHz Stereo without any dithering (as the files are 16Bit, 44.1kHz Stereo to begin with), or will I lose quality that way?
    I will be performing a normalization to 96% to the mixdown and then split to tracks in Audition, as in the end I want to to have an audio CD.
    I guess I could mixdown to 32Bit, then normalize and in the end save back to 16Bit, 44.1kHz Stereo WAV (with dithering, I suppose?), but I want to avoid any unnecessary converting steps.
    Greetings

    Any time you do any processing on a 16bit file in 16 bit only it will degrade the audio slightly due to rounding of the calculations. Working in 32 bit floating point (Audition's default) takes account of all bits generated due to processing.
    So it is always best to work in 32 bit, even if your originals were 16, all the way through until the last stage of saving the files for CD burning. Any losses due to conversion will be insignificant against those due to working 16 bit.

  • Java Switch Statement with Strings

    Apparently you cant make a switch statement with strings in java. What is the most efficient way to rewrite this code to make it function similar to a swtich statement with strings?
    switch (type){
                   case "pounds":
                        type = "weight";
                        break;
                   case "ounces":
                        type = "weight";
                        break;
                   case "grams":
                        type = "weight";
                        break;
                   case "fluid ounces":
                        type = "liquid";
                        break;
                   case "liters":
                        type = "liquid";
                        break;
                   case "gallons":
                        type = "liquid";
                        break;
                   case "cups":
                        type = "liquid";
                        break;
                   case "teaspoons":
                        type = "liquid";
                        break;
                   case "tablespoons":
                        type = "liquid";
                        break;
              }

    I'd create a Map somewhere with entries "liquid", "weight", etc.
    public class Converter {
        private static Map<String, List<String>> unitMap = new HashMap<String, List<String>>();
        private static String[] LIQUID_UNITS = { "pints", "gallons", "quarts", "millilitres" };
        private static String[] WEIGHT_UNITS = { "pounds", "ounces", "grams" };
        static {
            List<String> liquidUnits = new ArrayList<String>();
            for (int i = 0; i < LIQUID_UNITS.length; i++) liquidUnits.add(LIQUID_UNITS));
    unitMap.put("liquid", liquidUnits);
    ... // other unit types here
    public String findUnitType(String unit) {
    for (String unitType : unitMap.keySet()) {
    List<String> unitList = unitMap.get(unitType);
    if (unitList.contains(unit))
    return unitType;
    return null;
    It might not be more "efficient", but it's certainly quite readable, and supports adding new units quite easily. And it's a lot shorter than the series of if/else-ifs that you would have to do otherwise. You'll probably want to include a distinction between imperial/metric units, but maybe you don't need it.
    Brian

  • Switch statement with JRadioButton!!!

    hi there guys....
    Good day/!
    can anyone give me some short example on switch statements with JRadioButton???

    * Radio_Test.java
    package basics;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Radio_Test extends JFrame implements ActionListener{
        public Radio_Test() {
            setTitle("Radio Test");
            setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            buttonGroup1 = new ButtonGroup();
            toolbar = new JToolBar();
            btn1 = new JRadioButton("btn1");
            btn2 = new JRadioButton("btn2");
            btn3 = new JRadioButton("btn3");
            btn4 = new JRadioButton("btn4");
            //init button 1
            buttonGroup1.add(btn1);
            btn1.setActionCommand("1");
            btn1.addActionListener(this);
            toolbar.add(btn1);
            //init button 2
            buttonGroup1.add(btn2);
            btn2.setActionCommand("2");
            btn2.addActionListener(this);
            toolbar.add(btn2);
            //init button 3
            //init button 4
            getContentPane().add(toolbar, BorderLayout.NORTH);
            pack();
        public void actionPerformed(final ActionEvent e) {
            JRadioButton source = (JRadioButton)e.getSource();
            int action = Integer.parseInt(source.getActionCommand());
            showStatus(action);
        private void showStatus(final int action){
            switch(action){
                case 1:
                    JOptionPane.showMessageDialog(this, "Choice was 1");
                    break;
                case 2:
                    JOptionPane.showMessageDialog(this, "Choice was 2");
                    break;
                case 3:
                    JOptionPane.showMessageDialog(this, "Choice was 3");
                    break;
                default:
                    JOptionPane.showMessageDialog(this, "Choice must be 1, 2, or 3");
        public static void main(final String args[]) { new Radio_Test().setVisible(true); }
        private ButtonGroup buttonGroup1;
        private JRadioButton btn1,btn2,btn3,btn4;
        private JToolBar toolbar;
    }

  • Switch statement with println() for enum

    Hi,
    I have this exercise maybe you could help with:
    I have to create an enum class and then print out a description of each of the values from a switch.
    This is what I've done..
    enum PaperCurrency {
         FIVE, TEN, TWENTY, FIFTY, ONE_HUNDRED, TWO_HUNDRED
    public class Ex22 {
         PaperCurrency amount;
         Ex22(PaperCurrency amount) {
              this.amount = amount;
         void describe() {
              switch(amount) {
              case FIVE:               System.out.println("five dollar note");
              case TEN:               System.out.println("ten dollar note");
              case TWENTY:          System.out.println("twenty dollar note");
              case FIFTY:               System.out.println("fifty dollar note");
              case ONE_HUNDRED:     System.out.println("a hundred dollar note");
              case TWO_HUNDRED:     System.out.println("two hundred dollar note");
    static void main(String[] args) {
              Ex22
                   fiveDollars = new Ex22(PaperCurrency.FIVE),
                   tenDollars = new Ex22(PaperCurrency.TEN),
                   twentyDollars = new Ex22(PaperCurrency.TWENTY),
                   fiftyDollars = new Ex22 (PaperCurrency.FIFTY),
                   aHundredDollars = new Ex22 (PaperCurrency.ONE_HUNDRED),
                   twoHundredDollars = new Ex22 (PaperCurrency.TWO_HUNDRED);
              fiveDollars.describe();     
    }There are no compilation errors.
    The print out on the console is like this for fiveDollars.describe():
    five dollar note
    ten dollar note
    twenty dollar note
    fifty dollar note
    a hundred dollar note
    two hundred dollar note
    and it is supposed to be:
    five dollar note.
    My question is how to only print out the relevant description instead of all of them? Is my switch wrong?
    Thanks for any help

    If you can, it makes more sense to add functionality to an enum type than to write switch statements:
    public enum PaperCurrency {
        FIVE("five dollar note"),
        TEN("ten dollar note"),
        TWENTY("twenty dollar note"),
        FIFTY("fifty dollar note"),
        ONE_HUNDRED("one hundred dollar note"),
        TWO_HUNDRED("two hundred dollar note");
        private String description;
        private PaperCurrency(String desc) {
            description = desc;
        public String getDescription() {
            return description;
        public static void main(String[] args) {
            System.out.println(PaperCurrency.TEN.getDescription());
    }

  • Beginner question about prepared statements...PLEASE help! :-)

    First let me say thanks for the assistance. This is probably really easy to do, but I'm new to JSP and can't seem to figure it out.
    I want to dynamically populate a table that shows whether a particular person has an appointment at a given date and time with a user. To do this, I want to query the MySQL database for the lastname of the person with the appointment that occurs with the user at the year, month, date, and time, in question.
    THE CODE BELOW DOESN'T WORK (obviously) BUT SOMEWHAT ILLUSTRATES WHAT I'M TRYING TO ACCOMPLISH:
    <%
    Driver DriverTestRecordSet = (Driver)Class.forName(MM_website_DRIVER).newInstance();
    Connection ConnTestRecordSet = DriverManager.getConnection(MM_website_STRING,MM_website_USERNAME,MM_website_PASSWORD);
    PreparedStatement StatementTestRecordSet = ConnTestRecordSet.prepareStatement("SELECT lastname FROM appts_pid1 WHERE user_id='<%=(((Recordset1_data = Recordset1.getObject(user_id))==null || Recordset1.wasNull())?"":Recordset1_data)%>' AND year='<%= yy %>' AND month='<%= months[mm] %>' AND date='<%= dates[dd] %>' AND appttime='16:15:00'");
    ResultSet TestRecordSet = StatementTestRecordSet.executeQuery();
    boolean TestRecordSet_isEmpty = !TestRecordSet.next();
    boolean TestRecordSet_hasData = !TestRecordSet_isEmpty;
    Object TestRecordSet_data;
    int TestRecordSet_numRows = 0;
    %>
    The real problem comes in the prepared statement portion. If I build the prepared statement with static values like below, EVERYTHING WORKS GREAT:
    PreparedStatement StatementTestRecordSet = ConnTestRecordSet.prepareStatement("SELECT lastname FROM appts_pid1 WHERE user_id='1' AND year='2002' AND month='October' AND date='31' AND appttime='16:15:00'");
    But when I try to use dynamic values, everything falls apart. It's not that the values aren't defined, I use the user_id, year <%= yy %>, month <%= months[mm] %>, etc. elsewhere on the page with no problems. It's just that I can't figure out how to use these dynamic values within the prepared statement.
    Thanks for reading this far and thanks in advance for the help!!!!

    Hi PhineasGage
    You are little bit wrong in your
    your preparedStatement.
    Expression tag within scriptlet tag is invalid.
    Whenever you are appending the statement with
    expression tag, append it with "+" and remove
    expression tag.
    Hopefully it will work
    ThanksThanks for the response!
    I know that the expression tag within scriptlet tag is invalid. I just need a workaround for what I want to do.
    I'm unclear what you mean by "Whenever you are appending the statement with expression tag, append it with a "+" and remove expression tag".
    Could you give an example?
    In the meantime, I've been trying to digest the docs on prepared statements and have changed the code to look like:
    PreparedStatement StatementTestRecordSet = ConnTestRecordSet.prepareStatement("SELECT lastname FROM appts_pid1 WHERE user_id= ? AND year= ? AND month= ? AND date= ? AND appttime='13:15:00'");
    StatementTestRecordSet.setInt(1,1);
    StatementTestRecordSet.setInt(2,2002);
    StatementTestRecordSet.setString(3,"October");
    StatementTestRecordSet.setInt(4,31);
    Again, WITH THE STATIC VALUES, THIS WORKS FINE...but when I try to use expressions or variables like below, things don't work:
    StatementTestRecordSet.setInt(2,<%= yy %>);
    Obviously, I'm doing something wrong, but there has to be a way to use variables within the prepared statement.
    ALSO, the values are being passed to this page via URL in the form:
    samplepage?user_id=1&year=2002&month=October&date=31
    Based upon this information, is there another way (outside of stored procedures in the db) to do what I want to do? I'm open to ideas.

  • Newbie question about switch statement

    Lets say you have a loop and inside the loop you have a switch statement, how do you BREAK out of the outer loop?
    for (i=0....) {
    switch {
    case 11:
    .... some stuff
    break; <==== HOW DO I BREAK OUT OF THE for loop here?

    In standard C and standard C++ the break statement terminates the nearest enclosing loop and only that loop; i.e. control transfers to the first statement following the loop. I think there are C or C++ extensions that allow loop tags which may be used with a break to specify which loop to drop through, but I don't think these are supported by gcc, and they would certainly be very non-portable.
    There are several common ways to drop out of one or more outer loops. In many cases, there's nothing else in the loop following the switch so you can simply write
    switch (condition) {
    default:
    case 0:
    break;
    // other case statements here
    break;
    Else you can declare a loop control var and use the continue statement like this:
    for (i=0; i<jMax && !bDone; i++) {
    switch (condition) {
    default:
    case 0:
    bDone++; continue;
    // other case statements
    If you need to escape several loops and/or don't want to use loop control vars, you might consider structuring the code so you can use return to terminate the entire function. In the worst case of a very complex structure that you don't know how to simplify with a helper function, you can always resort to a goto:
    switch (condition) {
    default:
    case 0:
    goto escape;
    // other case statements here
    // remainder of code inside nested loops here
    escape: <first statement following the outermost loop>;
    Note that the statement following the escape label is always executed; i.e. when execution skips the goto it's as if the statement following escape was unlabeled. Use goto sparingly of course, since it's an artifact of unstructured programming. But when you really need a goto, it can make your code much easier to maintain.

  • Question about "switch" statement

    hi all I am new to Java programming..
    I have one problem that is
    I would like to use switch statement like below
    in the switch statement can we use only integers ?
    but i am using string it is not supporting ..
    for strings like below what I have to do...
    String temp = "str2";
    switch(temp){
    case "str1":
    case "str2":
    case "str3":
    case "str4":
    please send the solution if anyone knows
    thanks

    What do you mean by a smart hash?At least smarter than String.hashCode ().
    Don't think so - char, byte, short, or int.You're correct - seems I've got to test things before I post. So it's safe to say that a switch works on anything that can be treated as an int?

  • Switch statement with enumerated types

    Hello,
    I'm currently having problems (error in eclipse) using enums in a
    switch block. Eclipse says:
    "The enum constant Constants.AnalysisType.<each case> reference cannot be qualified in a case label.
    for each of the cases that I try to use the enumerated type. My code
    looks something like this:
    switch (analysisType) {
    case Constants.AnalysisType.NONE:
        break;
    case Constants.AnalysisType.MVGAVG:
        break;
    }(With a number of cases omitted).
    where analysisType is the enumerated type defined in
    a file called Constants.java.
    The class where the error is occuring is located at:
    package myprog.ui.ViewPanelTab; and the enumerated type is declared at:
    package myprog.utility.Constants;I have the required import statements in the ViewPanelTab class.
    I have tried
    public, private, public static, private static as modifiers on the enumeration.
    Any ideas as to why eclipse won't let me do this.
    Thanks for any help
    Devon

    Why is it that the entire switch and all of its cases have the same locality ?By "locality" do you mean "scope" (i.e. the inability to declare two variables with the same name)? I find it rather irritating that I can't write switch (foo)
        case bar:
            int quux = ...
            break;
        case baz:
            int quux = ...
            break;
    }My guess as to the reason for the decision to disallow this is that otherwise removing a break statement could create a compiler error where there previously was none, and that this would be confusing. It is possible to create a fresh scope, though, by using braces:switch (foo)
        case bar:
            int quux = ...
            break;
        case baz:
            int quux = ...
            break;
    }

  • Question regarding movers coupon with preorders

    I was planning on picking up the halo 5 collectors edition, I have gamers club unlocked which takes $50 off but wanted to know if the movers coupon can be used with it. I didn't see anything in the exclusions regarding it but had been declined trying to use it on a pre-order in store before. When asked why I was told "They just can't."
    Thanks for any answers,
    Cheers!
    Solved!
    Go to Solution.

    Hey there Shibby77,
    I'm happy to hear that you plan to pick up your copy of Halo 5 at Best Buy.  I'll be happy to answer your questions today.
    It is correct that you would be unable to use coupons on a pre-order deposit in-store, as the game itself is not being purchased on that receipt.  If your coupon is still valid at the time of fulfillment, then you would apply it at that time, which is the same time your the Unlocked Gamers Club discount is applied.
    Depending on which coupon you have, you may be able to use it online.  If this is the case, the coupon discount should apply, followed by your Unlocked discount.  In some cases, however, only one discount can be applied through BestBuy.com.  The best course of action is typically to try it.  If it is not supposed to work, it won't.  Just don't process through the transaction if you aren't seeing both discounts and want to use the coupon later.  This could result in the coupon being considered redeemed and unable to be used on a different transaction.
    I hope this helps, but please let me know if you have any other questions at this time.  Thanks for being a My Best Buy member.
    Regards,
    Mike|Social Media Specialist | Best Buy® Corporate
     Private Message

  • Beginner question regarding Events

    Hello, I`m just starting developing Xlets with the org.havi & javaTv packages. As I don`t have an DVB interoperable device I test them with the XletView-emulator. Guess like most people I started to create a simple scene including 2 HTextButtons. Now my question is what causes the sending of an HActionEvent ? If I press the arrow-buttons or the ok-button of the XletViewer`s remotecontroll there are sent KeyEvents only ?
    Thanks for any help,
    oliver

    Hi Oliver!
    The remotecontrol fires KeyEvents and UserEvents. In the latest release of XleTView HTextButton is not yet implemented, so it won't work using it. I'm working on it and will probably include it in the next release. I know it would be nice to know what's implemented and not before you go crazy on trying to do something. I will try to keep an updated list, there is a list here http://xletview.sourceforge.net/implemented.html but it's far from complete. Having a tool that automatically extract the status of the implementation from source code comments would be preferrable, unfortunately I'm split between priorities so I haven't been able to make it yet. If someone know of a good tool for this please tell me, I'm finding it hard to believe that a tool like that doesn't exist already.
    // beiker

  • Quick Question regarding an error with editable regions

    Hello,
    I am a co-op student and I work with other students as well, on our large company website. I have always been considered the cheif coder, and nobody knew the wesite layout and file directory as well as me. However, something terrible has happened while somebody was updating some information on one of your HTML pages.
    I logged in to Dreamweaver CS3 on afternoon to make a very simple text error change on our website. As soon as I hit "synchronize sitewide", it stated that there was no synchronization necessary, although I had already made a change. So then, on the template (.DWT) page, I thought I would backspace any character, and then retype it again in order for the "save" option to appear, so that I could save the template, and have it update all HTML pages, as well as the page that had just said "no synchronization necessary". I thought that I had to update the template first, which was strange, as I never had to do this before.
    When I clicked update, the error message that I got was that I have placed an editable region inside of a block tag. I checked the HTML pages as well as our template (.DWT) pages, and indeed, the <!--TemplateBeginEditable-->"Page Header"<!--TemplateEndEditable--> was embedded in a <h1></h1> pair. The pair appears black and delete-able in the template files, and grey in the HTML files, which is expected. However, I have been working at this institution for four months, and I recall that the <h1> tag pair had always been there since I remember. (How badly did this other person mess up?! =S)
    I tried to delete it from the .DWT file (the small editable region, and the <h1> tags), and now, what happens is that if I try to save a template so it updates all other HTML pages before synchronization, the template simply does not update anything, and I get no message whatsoever after clicking Save.
    Any help would be greatly appreciated. Thank you in advance for coping with these many details. I simply want to be able to update HTML pages again, because my boss really needs it, and I have never had such a problem before (having made much larger changes to this same website in the past)
    Thanks again,
    Mr. V

    How many child pages are you supporting with this DWT?   Hopefully less than 50 pages.
    Is your code valid?  HTML Validator - http://validator.w3.org
    Can you post a link to your DWT page, or copy and paste your code here?
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    www.alt-web.com/
    www.twitter.com/altweb
    www.alt-web.blogspot.com

  • How to Use Switch Statement with Exclusion Group (radio buttons)?

    Wouldn't you know, just when I though I'd really be making progress, I've come across another problem I can't solve. In a homeowners insurance application I am building, there is an exclusion group that needs to set the value of several variables
    I have setup in the form properties/variables. These variables take on different values depending on the users choice.  For the exclusion group, in the object pallet, I have set the binding to normal, and have checked the "Specify Item Values" check box. Also the values for the choices have been assigned 1,2,3,4,5.
    Here is my code for the change event fir the exclusion group (This is exactly what I have tried). For now, the values for the variables to take on in the different cases, are completely arbitrary.
    switch (this.change.rawValue)              // I have tried so many things here
        case "1":                                        // I have tried the caption, single quotes in all combinations
            addLivingExp = "1";
            damageOthersProperty = "2";
            liabilityIncl = "3";
            maxCoverage = "4";
            minCoverage = "5";
            persProperty = "6";
            relatedPrivateStruct = "7";
            break;
        case "2":    
            addLivingExp = "10";
            damageOthersProperty = "20";
            liabilityIncl = "30";
            maxCoverage = "40";
            minCoverage = "50";
            persProperty = "60"
            relatedPrivateStruct = "70";
            break;
        case "3":    
            addLivingExp = "100";
            damageOthersProperty = "200";
            liabilityIncl = "300";
            maxCoverage = "400";
            minCoverage = "500";
            persProperty = "600"
            relatedPrivateStruct = "700";
            break;
        case "4":    
            addLivingExp = "1000";
            damageOthersProperty = "2000";
            liabilityIncl = "3000";
            maxCoverage = "4000";
            minCoverage = "5000";
            persProperty = "6000"
            relatedPrivateStruct = "7000";
            break;   
        case "5":    
            addLivingExp = "10000";
            damageOthersProperty = "20000";
            liabilityIncl = "30000";
            maxCoverage = "40000";
            minCoverage = "50000";
            persProperty = "60000"
            relatedPrivateStruct = "70000";
            break;   
        default:   
            minCoverage= 5;   
            break;
    There must be something obvious I am missing? Eternally grateful for advice on this.
    Stephen

    There are two issues in this script:
    1. You are not using the accessor 'value' to set form variables
    2. You are not correctly getting the value of the radio button list in the switch clause
    Please see the working script below.
    Ben Walsh
    www.avoka.com
    switch (this.rawValue) 
        case "1":                                       
            addLivingExp.value                  = "1";
            damageOthersProperty.value   = "2";
            liabilityIncl.value                      = "3";
            maxCoverage.value                 = "4";
            minCoverage.value                  = "5";
            persProperty.value                  = "6";
            relatedPrivateStruct.value        = "7";
            break;
        case "2":   
            addLivingExp.value                  = "10";
            damageOthersProperty.value   = "20";
            liabilityIncl.value                     = "30";
            maxCoverage.value                 = "40";
            minCoverage.value                  = "50";
            persProperty.value                  = "60"
            relatedPrivateStruct.value        = "70";
            break;
        case "3":   
            addLivingExp.value                 = "100";
            damageOthersProperty.value   = "200";
            liabilityIncl.value                     = "300";
            maxCoverage.value                 = "400";
            minCoverage.value                  = "500";
            persProperty.value                  = "600"
            relatedPrivateStruct.value        = "700";
            break;
        case "4":   
            addLivingExp.value                  = "1000";
            damageOthersProperty.value   = "2000";
            liabilityIncl.value                      = "3000";
            maxCoverage.value                 = "4000";
            minCoverage.value                  = "5000";
            persProperty.value                  = "6000"
            relatedPrivateStruct.value        = "7000";
            break; 
        case "5":   
            addLivingExp.value                  = "10000";
            damageOthersProperty.value   = "20000";
            liabilityIncl.value                      = "30000";
            maxCoverage.value                 = "40000";
            minCoverage.value                  = "50000";
            persProperty.value                  = "60000"
            relatedPrivateStruct.value        = "70000";
            break; 
        default:  
            minCoverage.value                 = 5;  
            break;

  • QUESTION ON INSERT STATEMENT WITH SELECT

    Hi
    I have a table which contains three fields
    Table name : USERS
    ID NUMBER(10),
    NAME VARCHAR2(50),
    EMAIL VARCHAR2(50)
    SEQUENCE by name SEQ_ID
    I am trying to insert values into USERS from EMPLOYEE by virtue
    of insert into USERS (SELECT NAME, MAIL from EMPLOYEE) but i
    want to have one id for all the rows fetched from my inner
    query.
    I would like to know if here is a way, by which i can fetch a
    constant in my select statement which is not present in the
    table and use it like
    insert into USERS ( SELECT constant, NAME, MAIL FROM EMPLOYEE );
    where constant is some number unique for a given insertion.
    Thanks
    Arun

    Why not just try it? All you had to do was type
    insert into USERS SELECT 1, NAME, MAIL FROM EMPLOYEE ;
    and you would have had your answer immediately instead of
    waiting for me to tell you.
    rgds, APC

  • Adobe AIR help; question regarding search criteria with multibyte characters

    Hi,
    I created Adobe AIR application with Robohelp 9 (using FM 10 files as source, and texts are written in Japanese and English),
    and happend to find that search function in AIR application doesn't catch keywords correctly.
    For example,
    1. If you type "文字" and "スタイル" with single byte space in search window, the result appears for both "文字" and "スタイル".
    2. If you type "文字" and "スタイル" with double byte space in search window, the result doesn't match for anything.
    3. If you type "文字スタイル" (in one word) in search window, the result doesn't match for anything.
    Same thing happens for the case "文字種" (literally, "文字"+"種", the meaning is almost the same).
    But, if you type search words which is all in Katakana, the result seems to be fine.
    Is there any limitation for multibyte characters support? Or, this behaviour is a feature??
    If so, how can make AIR application "hit" correct words?
    Thank you very much for your kind help in advance!

    On this one your best course of action is to contact Adobe Support. They will likely require your project and there is one thing I would suggest you do first. Create a new project with just a few topics to prove the problem exists there as well. If it does it will be a simpler upload and you will know the problem is repeatable.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

Maybe you are looking for

  • Raid 1 with two external drives

    Hi Everyone, I've been searching for some answers on this and havent quite found what ive been looking for so i figured id just ask. I have two identical 1tb g-drives daisy chained and hooked up to my imac via Firewire 800. I want to make one of the

  • Apple Up-To-Date Program?

    My sister is buying a new previous generation iMac. Doesn't Apple have an offer we're they'll send you the latest programs for $9.95? I've looked everywhere, but I can't find any info on this. Thanks, Kelly

  • DELETE THE MATCHED RECORDS IN DB2 TABLE

    DELETE THE MATCHED RECORDS IN DB2 TABLE sql server table sqlserver_emp(c1,c2,c3,4) records:1 2 3 4 DB2 table db2_emp(c1 key,c2,c3,c4) records:1 2 5 6 7 8 Both tables having same structure Matched records : 1 2 1.Delete the matched records in db2 tabl

  • Reinstall / uninstall / install on top???....Logic Studio

    I am missing many presets. Most of the Space Designer default presets,mastering presets ect. I did reinstall Logic.I think and I say I think because some people on this forum have said the installed Logic on top of their previous installation. How do

  • Is there a spam filter for email?

    Getting dozens of spam emails on iPad and iPhone each day.   Is there a filter available?