Help with project...

I have aproject to do in my cs class. I seriously do not know what to do here:
"For this project you will write a program that will aid in the cracking of a substitution cipher. Basically, it is a form of frequency analysis. Your program will read in a String as input from the user and count the number of times each letter appears in the String. It will then print out the frequency of each letter, along with a decimal frequency or percentage (your choice). You must use an array for this program - you will be severely penalized for not using an array. After running your program your output may look something like this:
Welcome to Letter Frequency Analyzer v. 1.0
Enter a String to be analyzed: The quick brown fox jumps over the lazy dog.
Letter Frequencies
==================
A12.86%
B12.86%
C12.86%
D12.86%
E38.57%
F12.86%
G12.86%
H25.71%
I12.86%
J12.86%
K12.86%
L12.86%
M12.86%
N12.86%
O411.43%
P12.86%
Q12.86%
R25.71%
S12.86%
T25.71%
U25.71%
V12.86%
W12.86%
X12.86%
Y12.86%
Z12.86%
How does this help crack a substitution cipher? By using the letter frequencies of letters in the English language, we can make educated guesses about which letters are substituted for the most common letters (ie. the most common would be e, the next most common would be t, etc). This, of course, would not work for some ciphertexts (like the one in the example), but it should work for most of the cryptogram puzzles that you find in the newspaper.
Hints: Your array should contain 26 elements that you will store the frequency of each letter. The main part of your program will first convert the input String to uppercase, and then use a for loop to go through each letter of the String, incrementing the appropriate index in the array. You do not need a 26 case switch statement to do this! You can cleverly use casting and the unicode values of each letter (see the appendix in your book) to index into the array. My version of this program (that produced the output above) was only 31 lines of code (including 3 blank lines, 5 lines with only brackets, the class and main method definitions, an import statement, etc - in other words, I wrote it just like I write any other program). If you can keep the number of lines in your program at or below 45 (and maintain good coding style), you will receive a 10 point bonus for this project! (the 45 lines do not include the normal 5 line header required at the top of all source code submissions)"
Wtf mate??
Your help is greatly appreciated!
Steve

One of the unwritten rules of this forum is that we don't do other people's homework. But I will give you a hint:
You can cast a character to an integer, if you do you get its unicode value as a number A is \u0041 (in hexadecimal), so the number you get is 65. B is 66, Z is 90.

Similar Messages

  • Help with Project Management setup from very basics...

    hi all!
    i am new to e-business suite and now i have installed vision demo database successfully on a Quad Core with 320 GB hard and 4 GB ram...now i need help to setup Project Management (PM) module for a hypothetical construction company with the required functionalities (just limited functionalities and Not complete functionalities as in EBS).i need help in setting up Project Management module from the very basics...so can you help me out in this...thanks in anticipation

    Hi,
    Please post only once (do not post same thread across multiple forums).
    help with Financials setup from very basics...
    Re: help with Financials setup from very basics...
    Regards,
    Hussein

  • Need help with Project Pro

    Hi,
    I recently purchased few licenses for Project pro from office 365 (online version). When I log in to office 365 and go to my apps I can not see Project Pro app there? Where it might be?
    Also when I create a project with desktop app, where is the option to sync that project to server? The license already included with
    Project Online and Project server Sync.
    Any Help solving my issues will be greatly appreciated.
    Thanks in advance..

    Hi,
    Please see this
    article for starting a project with Project Pro for Project Online.
    Don't forget to use in Project Pro the email adress used for creating your O365 account.
    Hope this helps,
    Guillaume Rouyre, MBA, MVP, P-Seller |

  • Help with project/folder setup for new flex project??

    Hello all,
      I need help deciding how to set up my projects for a new flex application we're developing.
    We have an in-house custom java/jsp "framework". This framework has JSP pages for administering applications that are built using this framework. One part of the framework generates all java base and model objects from our database tables to be used in the new application.
    The new application will have a back-office part (Adobe AIR) and a web facing part (Adobe Flex).  Both the AIR and Flex parts of the application need to access the java model objects via AS3 classes (I believe I'll do this using remoteobject).
    My questions are as follows:
    After I create the base and model AS3 classes that remoteobject with the java classes can I put these in a common library project so both my AIR and Flex app can access common AS3 code.  I feel I should do this to keep from duplicating code by copying the AS3 classes in both my AIR and Flex projects.  Can you give my any examples or links to information on how to do this??
    I plan to also create a common java project for all base and model objects generated from my db tables so that the common library project with AS3 classes could remoteobject interface with the java classes in the java project. I would like to keep all of my business logic in the java model classes.  Does this seem appropriate for the projects/setup listed above?
    Here are the projects I think I need in Flex Builder.
    FlexWebApp
    AIRBackOfficeApp
    JavaApp - Common
    AS3FlexLibraryApp - Common
    The FlexWebApp and AIRBackOfficeApp will reference the AS3FlexLibraryApp and the AS3FlexLibraryApp will remoteobject to the java classes in JavaApp.
    Any help or direction with this is greatly appreciated.
    Thanks,
    Whitney

    Hi,
    Please post only once (do not post same thread across multiple forums).
    help with Financials setup from very basics...
    Re: help with Financials setup from very basics...
    Regards,
    Hussein

  • Need help with project

    Hi all I'm working on a project and need help.
    I want the "New" button to clear all the fields.
    Any help?
    =======================================================
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Message extends JFrame implements ActionListener {
         public Message() {
         super("Write a Message - by Kieran Hannigan");
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         setSize(370,270);
         FlowLayout flo = new FlowLayout(FlowLayout.RIGHT);
         setLayout(flo);
         //Make the bar
         JMenuBar bar = new JMenuBar();
         //Make "File" on Menu
         JMenu File = new JMenu("File");
         JMenuItem f1 = new JMenuItem("New");
         JMenuItem f2 = new JMenuItem("Open");
         JMenuItem f3 = new JMenuItem("Save");
         JMenuItem f4 = new JMenuItem("Save As");
         JMenuItem f5 = new JMenuItem("Exit");
         File.add(f1);
         File.add(f2);
         File.add(f3);
         File.add(f4);
         File.add(f5);
         bar.add(File);
         //Make "Edit" on menu
         JMenu Edit = new JMenu("Edit");
         JMenuItem e1 = new JMenuItem("Cut");
         JMenuItem e2 = new JMenuItem("Paste");
         JMenuItem e3 = new JMenuItem("Copy");
         JMenuItem e4 = new JMenuItem("Repeat");
         JMenuItem e5 = new JMenuItem("Undo");
         Edit.add(e5);
         Edit.add(e4);
         Edit.add(e1);
         Edit.add(e3);
         Edit.add(e2);
         bar.add(Edit);
         //Make "View" on menu
         JMenu View = new JMenu("View");
         JMenuItem v1 = new JMenuItem("Bold");
         JMenuItem v2 = new JMenuItem("Italic");
         JMenuItem v3 = new JMenuItem("Normal");
         JMenuItem v4 = new JMenuItem("Bold-Italic");
         View.add(v1);
         View.add(v2);
         View.add(v3);
         View.addSeparator();
         View.add(v4);
         bar.add(View);
         //Make "Help" on menu
         JMenu Help = new JMenu("Help");
         JMenuItem h1 = new JMenuItem("Help Online");
         JMenuItem h2 = new JMenuItem("E-mail Programmer");
         Help.add(h1);
         Help.add(h2);
         bar.add(Help);
         setJMenuBar(bar);
         //Make Contents of window.
         //Make "Subject" text field
         JPanel row2 = new JPanel();
         JLabel sublabel = new JLabel("Subject:");
         row2.add(sublabel);
         JTextField text2 = new JTextField("RE:",24);
         row2.add(text2);
         //Make "To" text field
         JPanel row1 = new JPanel();
         JLabel tolabel = new JLabel("To:");
         row1.add(tolabel);
         JTextField text1 = new JTextField(24);
         row1.add(text1);
         //Make "Message" text area
         JPanel row3 = new JPanel();
         JLabel Meslabel = new JLabel("Message:");
         row3.add(Meslabel);
         JTextArea text3 = new JTextArea(6,22);
         messagearea.setLineWrap(true);
         messagearea.setWrapStyleWord(true);
         JScrollPane scroll = new JScrollPane(text3,
                                  JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                                  JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
         row3.add(scroll);
         add(row1);
         add(row2);
         add(row3);
         setVisible(true);
         public static void main(String[] arguments)  {
         Message Message = new Message();
    }

    Ok, given that I may have not been the kindest to you on the other thread (and I'm still annoyed that you went and cross-posted this), and that you did actually use code tags, I'm going to post some code here:
    Please take the following advice onboard though.
    1. When you are naming your artifacts, please use the java coding standard as your guide. So if you are naming a class you use a capital letter first, and use camel case thereafter. All method names begin with a lower case letter, and all variable names begin with a lower case letter (and again camel case after that)
    2. Please use self explanitory names (for everything), so no more row1, row2, or text1, text2, etc.
    3. The example I am giving below makes use of a single class to handle all actions, this is not really the best way to do this, and a better way would be to have a class to handle each action (that would remove the massive if() else if() in the action handler class.
    4. When you are using class variables they should be private (no exceptions, ever!), if you need to access them from other classes use accessors (eclipse and other IDE tools can generate these methods for you in seconds)
    5. Notice the naming convention for my constants (final statics), they are all upper case (again from the java coding standards document, which you are going to look for with google right?)
    6. I have hived some of the creation work to helper methods (the getSubjectTextField() etc), although it isn't advisable to be calling other methods from the constructor, since this is a GUI, and you want it to appear as soon as you create the class, we won't worry about this, but perhaps as an execrise you could work out a better way to do this?
    7. Personally, I don't like classes that implement listeners, unless they are specifically designed to do that job. So a Frame that is set up as an action listener is fine, provided the actions it listens for are associated with the frame, not its contents. If the actions are related to its contents, then a dedicated class is better.
    8. Another personal opinion, but I feel it makes code clearer, but others may disagree. If you are creating a variable solely to hold the result of a calculation, to be passed to a method in the very next line, then don't create the variable, just pass the method as the argument to the method (feel free to ignore this advice if the method call is extremely long, and a local would make it easier to read)
    Anyway, here is the code. I have removed most of the menu items, and leave this as an exercise for you. Also I have only created 2 methods (new and exit), I'll again leave it as an exercise for you to complete this.
    package jdc;
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import javax.swing.AbstractAction;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    import javax.swing.ScrollPaneConstants;
    public class Message extends JFrame {
        /** Constant for the new action command. */
        private static final String NEW_COMMAND = "New";
        /** Constant for the exit action command. */
        private static final String EXIT_COMMAND = "Exit";
        /** Subject text field. */
        private JTextField subjectTextField;
        /** Recipient text field. */
        private JTextField toTextField;
        /** Message text area. */
        private JTextArea messageTextArea;
        public Message() {
            super("Write a Message - by Kieran Hannigan");
            setSize(370, 270);
            FlowLayout flo = new FlowLayout(FlowLayout.RIGHT);
            setLayout(flo);
            setJMenuBar(createMenuBar());
            // Add "Subject" text field
            JPanel subjectRow = new JPanel();
            subjectRow.add(new JLabel("Subject:"));
            subjectRow.add(getSubjectTextField());
            // Add "To" text field
            JPanel toRow = new JPanel();
            toRow.add(new JLabel("To:"));
            toRow.add(getToTextField());
            // Make "Message" text area
            JPanel messageRow = new JPanel();
            JScrollPane scroll = new JScrollPane(getMessageTextArea(), ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
                    ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            messageRow.add(scroll);
            add(toRow);
            add(subjectRow);
            add(messageRow);
            setVisible(true);
         * Clear all the fields.
        public void createNewMessage() {
            getSubjectTextField().setText("");
            getToTextField().setText("");
            getMessageTextArea().setText("");
         * Exit the application.
        public void exitApplication() {
            if (JOptionPane.showConfirmDialog(this, "Are you sure you would like to exit now?", "Exit",
                    JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
                System.exit(0);
         * @return The subject text field, (creates a new one if it doesn't already exist)
        private JTextField getSubjectTextField() {
            if (this.subjectTextField == null) {
                this.subjectTextField = new JTextField("RE:", 24);
            return this.subjectTextField;
         * @return The to text field, (creates a new one if it doesn't already exist)
        private JTextField getToTextField() {
            if (this.toTextField == null) {
                this.toTextField = new JTextField(24);
            return this.toTextField;
         * @return The message text area, (creates a new one if it doesn't already exist
        private JTextArea getMessageTextArea() {
            if (this.messageTextArea == null) {
                this.messageTextArea = new JTextArea(6, 22);
                this.messageTextArea.setLineWrap(true);
                this.messageTextArea.setWrapStyleWord(true);
            return this.messageTextArea;
         * Helper method to create the menu bar.
         * @return Menu bar with all menus and menu items added
        private JMenuBar createMenuBar() {
            JMenuBar bar = new JMenuBar();
            JMenu fileMenu = new JMenu("File");
            fileMenu.add(new JMenuItem(new MenuItemAction(this, NEW_COMMAND)));
            fileMenu.add(new JMenuItem(new MenuItemAction(this, EXIT_COMMAND)));
            bar.add(fileMenu);
            // TODO add all other menu's and menu items here....
            return bar;
         * Private static class to handle all menu item actions.
        private static class MenuItemAction extends AbstractAction {
            /** Instance of the message class. */
            private Message message;
             * @param actionName
            public MenuItemAction(Message messageFrame, String actionName) {
                super(actionName);
                this.message = messageFrame;
             * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
            public void actionPerformed(ActionEvent e) {
                if (e.getActionCommand().equals(NEW_COMMAND)) {
                    this.message.createNewMessage();
                } else if (e.getActionCommand().equals(EXIT_COMMAND)) {
                    this.message.exitApplication();
                // TODO Add the other event handlers here
        public static void main(String[] arguments) {
            Message messageFrame = new Message();
            messageFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }If you have any questions, please let me know, as there are a number of new areas introduced that you may not have come across before.

  • Help with project: trying to create variables from decimals

    topic may be a bit unclear, but I have a project from a java course. I need to create a simple program, but hit a bit of a bump.
    I have made a formula to find that the total hours equals 2.7350 which is equal to 2hours, 44minutes, 6seconds.
    so to sum what I just said up, I have the number 2.7350, but need to display 2hours, 44minutes, 6seconds
    now I need help of how I can accomplish this with basic java (this is my first java class).
    If there is a way to leave 2 and take .7350 in separate variables, I can make some more formulas to convert that to the answer I need displayed, but I don't know how.
    Please help if you have ideas
    Thank You

    ahh, that just gave me an idea, I can't believe subtraction didn't come into my mind.
    I also should have mentioned that the numbers are generated via formula and user input, so it is not pre set.
    I will try something out with the subtraction idea. however, if you have a solution please post it in case my idea doesn't work.
    thanks again ^^

  • Need help with project (calling methods) please!!

    Hi there i have a project for uni requiring me to create a java program that creates a random No. and lets the user have three guesses to find the No. When the users guesses correct he gets a message telling him hes won and if he doesnt get it correct he gets a message telling him the correct No then terminates.
    The code has to call an outside method called[b] Public Static Boolean CheckGuess
    I have tried to create this and got it to compile with no errors (eventually) but i keep getting a message saying i have whenever i type any number in. I think the problem is the way i am calling the method i havnt got much experience this is all pretty new to me any help would be really appreciated. Thanks.
    import javax.swing.*;
    import java.util.*;
    public class Coursework1{
         public static void main(String args[]){
              int randomnumber,usersguessint,checkguess,guessvalid,attempts;
              String usersguess,output;
              boolean match;
              //create random number generator
              Random numGenerator = new Random();
              //generate a random number between 1 & 10 inclusive
              randomnumber = Math.abs(numGenerator.nextInt(9))+1;
              //initialize variable attempts
              for ( attempts = 0; attempts < 3; attempts++ ) {
                   //ask user for his first guess
                   usersguess=JOptionPane.showInputDialog("Please enter your guess between 1 & 10");
                   //convert users guess to integer
                   usersguessint = Integer.parseInt(usersguess);
                        //validate input
                        while (usersguessint<1||usersguessint>10){
                        usersguess=JOptionPane.showInputDialog("You entered an incorrect number \nPlease enter a numberbetween 1 & 10");
                         //convert users guess to integer
                        usersguessint = Integer.parseInt(usersguess);
                        } //end while loop
                             //call boolean method
                             if (match=true){
                             //display text area in JoptionPane
                             output="You won";
                             JOptionPane.showMessageDialog(null,output,"You Won",JOptionPane.INFORMATION_MESSAGE);
                             break;}
                             else{
                             output="Try again";     
                             JOptionPane.showInputDialog("Try again");
                                  }     //end if
                   } //end for
              }//end main
                             //user defined method
                             public static boolean checkGuess(int usersguessint,int randomnumber){
                             boolean match = false;
                             if (usersguessint == randomnumber){
                             match = true;
                             return match;
                             }//end method
         }//endclass

    Thank you very much that worked a treat the program is working better now. I have just realised that my for loopcontaining my counter may be in the wrong place as the program is running though both messages 3 times e.g
    "Please enter your guess between 1 & 10"
    "Try again"
    "Please enter your guess between 1 & 10"
    "Try again"
    "Please enter your guess between 1 & 10"
    "Try again"
    "Please enter your guess between 1 & 10"
    "Try again"
    I want my program to run like
    "Please enter your guess between 1 & 10"
    "Try again"
    "Try again"
    "Try again"
    Do u think if i placed my for stament (counter) in between the two messages it would eliminate this problem.

  • Xml help with project?

    Hey guys, Java newbie here, was wondering if anyone could point me in the right direction.
    so my co-worker gave me a folder with a bunch of .tif image files and one .xml file. I'm supposed to write Java code to copy a folder with the same name as the folder he gave me, and copy the .xml file into that folder. so the end result is that we have the original folder w/ the .tif files and .xml file, and one copy folder with the same name with a copy of the .xml file in it.
    this is the code that i have so far:
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import java.io.File;
    public class FileCopy{
    public static void copyFile(Document source, Document target)
    Node node = target.importNode(source.getDocumentElement(), true);
    target.getDocumentElement().appendChild(node);
    static void report(boolean b){
         System.out.println(b ? "success" : "failure");
    public static void main(String args[]){
         boolean status;
         status = new File("/project1").mkdirs();
         report(status);
    some of my questions are:
    A) how do i copy the exact name of the folder / .xml file?
    B) how do i even create a new blank .xml file for which i can use copyFile to copy over? (note it needs both a source and a target)
    C) how do i find the .xml file in the folder in which he gave me?
    Any help is appreciated

    rzhang10 wrote:
    Okay, but how do I ensure that the file I copied will be a .xml file?Mixing up of tenses leading to ambiguity! Bottom line: if it was XML, and you copy it, it will be XML.
    here is a copyFile function I found on the web:
    public static void copyFile(File in, File out) throws IOException{
              FileChannel inChannel = new FileInputStream(in).getChannel();
              FileChannel outChannel = new FileOutputStream(out).getChannel();
              try{
                   inChannel.transferTo(0 , inChannel.size(), outChannel);
              catch(IOException e){
                   throw e;
              finally{
                   if(inChannel != null) inChannel.close();
                   if(outChannel != null) outChannel.close();
    are you saying that this code would be sufficient to copy an .xml file? everytime I've tried it, it reproduces a .txt file.An XML file is a text file.

  • Please help with project

    Hey there
    I have a project due soon and would like to add a Gui. Can anyone help me. I'll e-mail you the program. Ive done half the text but would like a GUi included and some tips from people that know what they are talking about.
    Thanks

    A good starting point is (after once doing it by hand to see how everything fits together), to use a dialog editor.
    For instance the NetBeans IDE has such a "form editor". Drag and drop your buttons and such.
    Add events "actionPerformed" to such buttons etcetera.
    It still is a time consuming task. So prepare yourself: think of the layout and rest of user-interface you want to achieve.

  • Help with project PLEASE

    does anyone have any suggestions on how to do the rest of this project
    import javax.swing.JOptionPane;
    public class Bank {
         private static char which;
         public static void main(String args[])
         Account[] bankAcct = new Account[30];
         int num = 0;
         Customer c = new Customer("Daffy", "Duck");
         Savings s = new Savings(c, 40000, 1237,3.00);
         Checking ck = new Checking(c, 3500, 1235,2.50);     
         bankAcct[0]=s;
         bankAcct[1]=ck;
         bankAcct[2] = new Checking ( new Customer("Bugs", "Bunny"), 2000,1236,4.00);
         num = 3;
    int ans=0;
    while (ans!=6)
    menu();
    System.out.println("CHOICE:");
    ans = Keyboard.readInt();
    if (ans==1)
    num = addAccount(bankAcct,num);
    if (ans==2)
    sortAccount(bankAcct,num);
    if (ans==3)
    process(bankAcct,num);
    if (ans == 4)
    printAll(bankAcct,num);
    if (ans==5)
         System.out.println("See ya later!!!!");
    System.exit(0);
         * Method addAccount.
         * @param bankAcct
         * @param num
         * @return int
         private static int addAccount(Account[] bankAcct, int num)
              return 0;
    public static void menu()
    System.out.println("1. Add an account");
    System.out.println("2. sort the accounts");
    System.out.println("3. end of month processing");
    System.out.println("4. print all records");
    System.out.println("5. exit");
    public static int addAccount(Account[] a, int num, String name)
         // ask for fields needed for an account
         JOptionPane.showInputDialog( "Enter Name" );
         JOptionPane.showInputDialog( "Enter Address" );
         JOptionPane.showInputDialog( "Enter Phone Number" );
         JOptionPane.showInputDialog( "Enter Date of Birth" );
         JOptionPane.showInputDialog( "Enter Social Security Number" );
         JOptionPane.showInputDialog( "Enter Account Number" );
         // declare local variables and store the information in these
         // ask whether it is a checking or savings. Read in a char datatype named which
         JOptionPane.showInputDialog("Enter checking or savings [C],[S]");
         if (which=='C')
              // ask for the monthly fee and read it into a variable
              // create an instance of a checking account and add it to the array
         else if (which=='S')
              // ask for the interest rate and read it into a variable
              // create an instance of a savings account and add it to the array
         return ++num;
    public static void sortAccount(Account[] a, int num)
    for(int pass = 1; pass < num; pass++)
    for(int pair = 1; pair < num; pair++)
    if(a[pair].compareTo(a[pair - 1]) < 1)
    Account temp = a[pair - 1];
    a[pair - 1] = a[pair];
    a[pair] = temp;
    public static void process(Account[] acct, int num)
         // use a for loop to calculate all the new balances
    public static void printAll(Account[] acct, int num)
         // use a for loop to print out all of the accounts
         * Returns the which.
         * @return char
         public static char getWhich()
              return which;
         * Sets the which.
         * @param which The which to set
         public static void setWhich(char which)
              Bank.which = which;

    I dont know how to do the code code comments that are listed
    // ask for fields needed for an account
    // declare local variables and store the information in these
    // ask whether it is a checking or savings. Read in a char datatype named which
    // ask for the monthly fee and read it into a variable
    // ask whether it is a checking or savings. Read in a char datatype named which
    // ask for the interest rate and read it into a variable
              // create an instance of a savings account and add it to the array
    public static void process(Account[] acct, int num)
         // use a for loop to calculate all the new balances
    public static void printAll(Account[] acct, int num)
         // use a for loop to print out all of the accounts
    public static int addAccount(Account[] a, int num, String name)
         // ask for fields needed for an account
         JOptionPane.showInputDialog( "Enter Name" );
         JOptionPane.showInputDialog( "Enter Address" );
         JOptionPane.showInputDialog( "Enter Phone Number" );
         JOptionPane.showInputDialog( "Enter Date of Birth" );
         JOptionPane.showInputDialog( "Enter Social Security Number" );
         JOptionPane.showInputDialog( "Enter Account Number" );
         // declare local variables and store the information in these
         // ask whether it is a checking or savings. Read in a char datatype named which
         JOptionPane.showInputDialog("Enter checking or savings 'C','S'");
         if (which=='C')
              // ask for the monthly fee and read it into a variable
         JOptionPane.showInputDialog("Enter monthly fee");
              // create an instance of a checking account and add it to the array
         else if (which=='S')
              // ask for the interest rate and read it into a variable
              // create an instance of a savings account and add it to the array
         return ++num;
    public static void sortAccount(Account[] a, int num)
    for(int pass = 1; pass < num; pass++)
    for(int pair = 1; pair < num; pair++)
    if(a[pair].compareTo(a[pair - 1]) < 1)
    Account temp = a[pair - 1];
    a[pair - 1] = a[pair];
    a[pair] = temp;
    public static void process(Account[] acct, int num)
         // use a for loop to calculate all the new balances
    public static void printAll(Account[] acct, int num)
         // use a for loop to print out all of the accounts

  • Help with project management, please?

    Hello all!
    It's been about a year since I've last visited this forum and I'm lost .. the format must have changed?
    Here's what I'm trying to remember (it was a simple task)
    I have a project that I would like to break into smaller segments for the sake of managing it.
    I recall having selected a portion of my project and either rendering it or exporting it to a file.
    There was also some "switch" that should be selected to maintain maximum resolution and no
    compression.
    When several portions are rendered/exported in this fashion, it becomes an easier task to
    pull the pieces into back into a time line for the sake a rendering the completed work to
    be burned onto a DVD.
    Does anyone remember how this process was done?  Was it "Render"?  "Export"?  What
    was the selection that maintains the hi-resolution?
    (I’m using Premiere Elements)
    Thank you!
    --Tom Nickel

    Hunt,
    Thank you copiously for the information!
    I had
    done this before, but I've forgotten how!
    Thanks again,
    --Tom Nickel
    Tom,
     
    Welcome to the "new & improved" Adobe forum. Don't
    worry, I've been around
    these for many more years, than my
    Profile indicates, and still cannot
    find my way around this new
    one.
     
    Now, the process that you
    describe is to create "mini-Projects," edit them
    >
    completely, and then Export to DV-AVI Type II files w/ 48KHz 16-bit
    PCM/WAV Audio. These can then be Imported into "master
    Project," and
    assembled into a final.
    >
     
    Just do your full editing, as things like
    Transitions will be part of the
    these DV-AVI's and to get rid
    of them, is a lot of work.
     
    Good luck,
     
    Hunt
    >

  • Need some help with project - help is VERY appreciated!

    This one has been driving me nuts for a few days. So basically, I have this constructor.
    public SportStacker( String newName, int numTimes, int newID )
             name = newName;
             numTimesRecorded = 0;
             times = new double[ numTimes ];
             ID = newID;
          }The important thing here being that it sets ID = newID. That's in the SportStacker class. We also have a method in SportStacker named getID:
    public int getID()
             return ID;
          }Okay, then we have another class, Contestant. In this class, we have an array of SportStacker objects. One method we had to create was to add a new contestant.
    public void addCompetitor(String name, int numTimesRecorded)
             if(numCompetitors == competitors.length)
                increaseSize();
             SportStacker temp = new SportStacker(name, numTimesRecorded, IDtracker);
             competitors[numTimesRecorded] = temp;
             numCompetitors++;
             IDtracker++;
    }Which I think is fine. However, the next one is addCompetitorTimes. It seems like it should be easy, but this part confuses me...in his instructions, he says: "This method should take in two parameters: an int representing the competitors ID and a double representing the time to be recorded. Then, search through competitors for the correct ID using the getID method provided in SportStacker..." This is what confuses me. One of the parameters taken in this method is the int representing his ID, and all getID will do is return what was last used in the constructor. It doesn't make any sense to me! Someone please help!

    johnboy8282 wrote:
    Minus the addTime part, just wanted to make sure I was doing this right first. Thanks so much for the help, your explanation helped me understand a lot!Using a for loop is clearer but yes your on the right track. Minor note, if the competitors array contains nulls then a runtime error will occur due to .getID() applied to a null object. This is easily avoidable.
    public void addCompetitorTimes(int compID, double timeToRecord){
      for(int i=0; i<numCompetitors; i++){
        if(competitors.getID() == compID){
    System.out.print("Add time stuff here...");
    break; //Break from for loop, no need to check other IDs
    }Mel                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Need help with lost iMovie project.

    I was creating an iMovie project for school and needed to save it on a USB, so I clicked on 'Export Movie' from the 'Share' options menu in iMovie. I chose the type I wanted it saved in (viewing for computers) and then a smaller screen in iMovie popped up saying it was exporting the movie, or something like that. It took about a good 30 minutes and my project was a 7 minute movie with film clips, music, transitions, ect. I exported this project to my USB but when it finished it wasn't on there and when I finally found it on the Mac somewhere, I went to drag it into my USB but it said it was full. I then dragged the project onto my desktop and tried to open it to see if it worked. When I did the iMovie icon jumped once and stopped. I clicked on iMovie and it was still there in the projects screen. I then decided to close iMovie and open the project again from my desktop to see if it would play like a normal movie but once I clicked it the iMovie icon jumped again, opened but my project that I was trying to open was not there anymore and wouldn't open from my desktop file. I cannot open it at all and view it, it has been lost from my iMovie. Is there a way that I can get it back? Really need some help with this.

    What version of iMovie are you using?
    Matt

  • Need help with calculator project for an assignment...

    Hi all, I please need help with my calculator project that I have to do for an assignment.
    Here is the project's specifications that I need to do"
    """Create a console calculator applicaion that:
    * Takes one command line argument: your name and surname. When the
    program starts, display the date and time with a welcome message for the
    user.
    * Display all the available options to the user. Your calculator must include
    the arithmetic operations as well as at least five scientific operations of the
    Math class.
    -Your program must also have the ability to round a number and
    truncate it.
    -When you multiply by 2, you should not use the '*' operator to perform the
    operation.
    -Your program must also be able to reverse the sign of a number.
    * Include sufficient error checking in your program to ensure that the user
    only enters valid input. Make use of the String; Character, and other
    wrapper classes to help you.
    * Your program must be able to do conversions between decimal, octal and
    hex numbers.
    * Make use of a menu. You should give the user the option to end the
    program when entering a certain option.
    * When the program exits, display a message for the user, stating the
    current time, and calculate and display how long the user used your
    program.
    * Make use of helper classes where possible.
    * Use the SDK to run your program."""
    When the program starts, it asks the user for his/her name and surname. I got the program to ask the user again and again for his/her name and surname
    when he/she doesn't insert anything or just press 'enter', but if the user enters a number for the name and surname part, the program continues.
    Now my question is this: How can I restrict the user to only enter 'letters' (and spaces of course) but allow NO numbers for his/her surname??
    Here is the programs code that I've written so far:
    {code}
    import java.io.*;
    import java.util.*;
    import java.text.*;
    public class Project {
         private static String nameSurname = "";     
         private static String num1 = null;
         private static String num2 = null;
         private static String choice1 = null;
         private static double answer = 0;
         private static String more;
         public double Add() {
              answer = (Double.parseDouble(num1) + Double.parseDouble(num2));
              return answer;
         public double Subtract() {
              answer = (Double.parseDouble(num1) - Double.parseDouble(num2));
              return answer;
         public double Multiply() {
              answer = (Double.parseDouble(num1) * Double.parseDouble(num2));
              return answer;
         public double Divide() {
              answer = (Double.parseDouble(num1) / Double.parseDouble(num2));
              return answer;
         public double Modulus() {
              answer = (Double.parseDouble(num1) % Double.parseDouble(num2));
              return answer;
         public double maximumValue() {
              answer = (Math.max(Double.parseDouble(num1), Double.parseDouble(num2)));
              return answer;
         public double minimumValue() {
              answer = (Math.min(Double.parseDouble(num1), Double.parseDouble(num2)));
              return answer;
         public double absoluteNumber1() {
              answer = (Math.abs(Double.parseDouble(num1)));
              return answer;
         public double absoluteNumber2() {
              answer = (Math.abs(Double.parseDouble(num2)));
              return answer;
         public double Squareroot1() {
              answer = (Math.sqrt(Double.parseDouble(num1)));
              return answer;
         public double Squareroot2() {
              answer = (Math.sqrt(Double.parseDouble(num2)));
              return answer;
         public static String octalEquivalent1() {
              int iNum1 = Integer.parseInt(num1);
    String octal1 = Integer.toOctalString(iNum1);
    return octal1;
         public static String octalEquivalent2() {
              int iNum2 = Integer.parseInt(num2);
              String octal2 = Integer.toOctalString(iNum2);
              return octal2;
         public static String hexadecimalEquivalent1() {
              int iNum1 = Integer.parseInt(num1);
              String hex1 = Integer.toHexString(iNum1);
              return hex1;
         public static String hexadecimalEquivalent2() {
              int iNum2 = Integer.parseInt(num2);
              String hex2 = Integer.toHexString(iNum2);
              return hex2;
         public double Round1() {
              answer = Math.round(Double.parseDouble(num1));
              return answer;
         public double Round2() {
              answer = Math.round(Double.parseDouble(num2));
              return answer;
              SimpleDateFormat format1 = new SimpleDateFormat("EEEE, dd MMMM yyyy");
         Date now = new Date();
         SimpleDateFormat format2 = new SimpleDateFormat("hh:mm a");
         static Date timeIn = new Date();
         public static long programRuntime() {
              Date timeInD = timeIn;
              long timeOutD = System.currentTimeMillis();
              long msec = timeOutD - timeInD.getTime();
              float timeHours = msec / 1000;
                   return (long) timeHours;
         DecimalFormat decimals = new DecimalFormat("#0.00");
         public String insertNameAndSurname() throws IOException{
              boolean inputCorrect = false;
                   while (inputCorrect == false) {
                        while (nameSurname == null || nameSurname.length() == 0) {
                             for (int i = 0; i < nameSurname.length(); i++) {
                             if ((nameSurname.charAt(i) > 'a') && (nameSurname.charAt(i) < 'Z')){
                                       inputCorrect = true;
                        else{
                        inputCorrect = false;
                        break;
                        try {
                             BufferedReader inStream = new BufferedReader (new InputStreamReader(System.in));
                             System.out.print("Please enter your name and surname: ");
                             nameSurname = inStream.readLine();
                             inputCorrect = true;
                        }catch (IOException ex) {
                             System.out.println("You did not enter your name and surname, " + nameSurname + " is not a name, please enter your name and surname :");
                             inputCorrect = false;
                        System.out.println("\nA warm welcome " + nameSurname + " ,todays date is: " + format1.format(now));
                        System.out.println("and the time is now exactly " + format2.format(timeIn) + ".");
                        return nameSurname;
              public String inputNumber1() throws IOException {
              boolean inputCorrect = false;
                   while (inputCorrect == false) {
                        try {
                             BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
                             System.out.print("\nPlease enter a number you want to do a calculation with and hit <ENTER>: ");
                             num1 = br.readLine();
                             double number1 = Double.parseDouble(num1);
                             System.out.println("\nThe number you have entered is: " + number1);
                             inputCorrect = true;
                        } catch (NumberFormatException nfe) {
                             System.out.println("\nYou did not enter a valid number: " + "\""+ num1 + "\" is not a number!!");
                             inputCorrect = false;
                        return num1;
         public String calculatorChoice() throws IOException {
              System.out.println("Please select an option of what you would like to do with this number from the menu below and hit <ENTER>: ");
              System.out.println("\n*********************************************");
              System.out.println("---------------------------------------------");
              System.out.println("Please select an option from the list below: ");
              System.out.println("---------------------------------------------");
              System.out.println("1 - Add");
              System.out.println("2 - Subtract");
              System.out.println("3 - Multiply");
              System.out.println("4 - Divide (remainder included)");
              System.out.println("5 - Maximum and minimum value of two numbers");
              System.out.println("6 - Squareroot");
              System.out.println("7 - Absolute value of numbers");
              System.out.println("8 - Octal and Hexadecimal equivalent of numbers");
              System.out.println("9 - Round numbers");
              System.out.println("0 - Exit program");
              System.out.println("**********************************************");
              boolean inputCorrect = false;
                   while (inputCorrect == false) {
                        try {
                             BufferedReader inStream = new BufferedReader (new InputStreamReader(System.in));
                             System.out.print("Please enter your option and hit <ENTER>: ");
                             choice1 = inStream.readLine();
                             int c1 = Integer.parseInt(choice1);
                             System.out.println("\nYou have entered choice number: " + c1);
                             inputCorrect = true;
                        } catch (NumberFormatException nfe) {
                             System.out.println("You did not enter a valid choice number: " + "\""+ choice1 + "\" is not in the list!!");
                             inputCorrect = false;
                        return choice1;
         public String inputNumber2() throws IOException {
              boolean inputCorrect = false;
                   while (inputCorrect == false) {
                        try {
                             BufferedReader br2 = new BufferedReader (new InputStreamReader(System.in));
                             System.out.print("\nPlease enter another number you want to do the calculation with and hit <ENTER>: ");
                             num2 = br2.readLine();
                             double n2 = Double.parseDouble(num2);
                             System.out.println("\nThe second number you have entered is: " + n2);
                             System.out.println("\nYour numbers are: " + num1 + " and " + num2);
                             inputCorrect = true;
                        } catch (NumberFormatException nfe) {
                             System.out.println("You did not enter a valid number: " + "\""+ num2 + "\" is not a number!!");
                             inputCorrect = false;
                        return num2;
         public int Calculator() {
              int choice2 = (int) Double.parseDouble(choice1);
              switch (choice2) {
                        case 1 :
                             Add();
                             System.out.print("The answer of " + num1 + " + " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 2 :
                             Subtract();
                             System.out.print("The answer of " + num1 + " - " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 3 :
                             Multiply();
                             System.out.print("The answer of " + num1 + " * " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 4 :
                             Divide();
                             System.out.print("The answer of " + num1 + " / " + num2 + " is: " + decimals.format(answer));
                             Modulus();
                             System.out.print(" and the remainder is " + decimals.format(answer));
                             break;
                        case 5 :
                             maximumValue();
                             System.out.println("The maximum number between the numbers " + num1 + " and " + num2 + " is: " + decimals.format(answer));
                             minimumValue();
                             System.out.println("The minimum number between the numbers " + num1 + " and " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 6 :
                             Squareroot1();
                             System.out.println("The squareroot of value " + num1 + " is: " + decimals.format(answer));
                             Squareroot2();
                             System.out.println("The squareroot of value " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 7 :
                             absoluteNumber1();
                             System.out.println("The absolute number of " + num1 + " is: " + decimals.format(answer));
                             absoluteNumber2();
                             System.out.println("The absolute number of " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 8 :
                             octalEquivalent1();
                             System.out.println("The octal equivalent of " + num1 + " is: " + octalEquivalent1());
                             octalEquivalent2();
                             System.out.println("The octal equivalent of " + num2 + " is: " + octalEquivalent2());
                             hexadecimalEquivalent1();
                             System.out.println("\nThe hexadecimal equivalent of " + num1 + " is: " + hexadecimalEquivalent1());
                             hexadecimalEquivalent2();
                             System.out.println("The hexadecimal equivalent of " + num2 + " is: " + hexadecimalEquivalent2());
                             break;
                        case 9 :
                             Round1();
                             System.out.println("The rounded number of " + num1 + " is: " + decimals.format(answer));
                             Round2();
                             System.out.println("The rounded number of " + num2 + " is: " + decimals.format(answer));
                             break;
                        case 0 :
                             if (choice2 == 0) {
                                  System.exit(1);
                             break;
                   return choice2;
              public String anotherCalculation() throws IOException {
                   boolean inputCorrect = false;
                   while (inputCorrect == false) {
                             try {                              
                                  BufferedReader br3 = new BufferedReader (new InputStreamReader(System.in));
                                  System.out.print("\nWould you like to do another calculation? Y/N ");
                                  more = br3.readLine();
                                  String s1 = "y";
                                  String s2 = "Y";
                                  if (more.equals(s1) || more.equals(s2)) {
                                       inputCorrect = true;
                                       while (inputCorrect = true){
                                            inputNumber1();
                                            System.out.println("");
                                            calculatorChoice();
                                            System.out.println("");
                                            inputNumber2();
                                            System.out.println("");
                                            Calculator();
                                            System.out.println("");
                                            anotherCalculation();
                                            System.out.println("");
                                            inputCorrect = true;
                                  } else {
                                       System.out.println("\n" + nameSurname + " thank you for using this program, you have used this program for: " + decimals.format(programRuntime()) + " seconds");
                                       System.out.println("the program will now exit, Goodbye.");
                                       System.exit(0);
                             } catch (IOException ex){
                                  System.out.println("You did not enter a valid answer: " + "\""+ more + "\" is not in the list!!");
                                  inputCorrect = false;
              return more;
         public static void main(String[] args) throws IOException {
              Project p1 = new Project();
              p1.insertNameAndSurname();
              System.out.println("");
              p1.inputNumber1();
              System.out.println("");
              p1.calculatorChoice();
              System.out.println("");
              p1.inputNumber2();
              System.out.println("");
              p1.Calculator();
                   System.out.println("");
                   p1.anotherCalculation();
                   System.out.println("");
    {code}
    *Can you please run my code for yourself and have a look at how this program is constructed*
    *and give me ANY feedback on how I can better this code(program) or if I've done anything wrong from your point of view.*
    Your help will be much appreciated.
    Thanks in advance

    Smirre wrote:
    Now my question is this: How can I restrict the user to only enter 'letters' (and spaces of course) but allow NO numbers for his/her surname??You cannot restrict the user. It is a sad fact in programming that the worst bug always sits in front of the Computer.
    What you could do is checking the input string for numbers. If it contains numbers, just reprompt for the Name.
    AND you might want to ask yourself why the heck a calculator needs to know the users Name.

  • Need help with almost completed plugin engine project

    Hi all,
    For a while now I have been working on a plugin engine. After a few iterations, the engine is similar to the Eclipse engine, in that plugins use extension points and extensions to allow contributions. Unlike the eclipse engine I have added the ability for plugins to fire events through the engine and other plugins can add listeners, all through the plugin.xml manifest. Dependencies are mostly handled automatically at plugin load time (when extensions get resolved to extension points, and listeners get resolved to events). For the case where a plugin needs to use classes from another plugin, dependencies are also allowed to be declared. Like the eclipse engine, activation of plugins occurs the first time a class is used within the plugin's classpath, OR a plugin can be activated after it is loaded.
    What I need help with is testing, working on examples to provide with the engine project, and feedback/suggestions before we release the M1 build. I am asking for those that are interested in this type of work to volunteer to help where applicable and possible. I want to provide a solid plugin engine to the java community, one that is easy to use, works well, and is pretty effecient in terms of resource usage and performance.
    Of particular interest to me right at the moment is dealing with multiple versions. As I see it, the engine will be used within an application and as such plugins would be distributed with a specific application version. The plugin version itself is more of a notification as to what version a plugin is, although I imagine it will help when updating at runtime as well.
    Just a few other details of the engine. It handles (or will soon) dynamic load, unload and reload of plugins at runtime. Plugins can be distributed in an archive file format, we call .par (Plugin ARchive), with additional plugin filename extensions configurable at runtime. The plugins can be developed and deployed in an expanded directory format as they are in Eclipse as well, or in the archive format. In the archive format they do not need to be unzipped when deployed, and they can contain embeded jar/zip libraries. The engine handles finding and creating classes directly out of the .par file at runtime.
    Multiple locations to find plugins are configurable before the engine starts, and even after it starts more could be added to allow additional locations to find plugins. URLs are supported, and soon the HTTP protocol will be supported so that plugins can be downloaded and installed at runtime.
    The project can be found at www.sourceforge.net/projects/genpluginengine. If you would like to get involved and help out, please sign up on the dev mail list and send an email to introduce yourself to the rest of the members on the list.
    I'll also add that I am working on a Swing UI Framework built entirely from plugins. It provides a ready-to-launce UI application that developers can simply add their plugins to, extending various extension points of the framework to have menu items, toolbar buttons, status bar access, help and preferences dialog additions, file i/o choosers, tons of open-source components ready to use (or extend to add on to), and like Eclipse, hopefully... draggable window frames that can be dropped on any other frame to form a tabbed frame of windows. Some of this is a ways off, some is getting there now. Presently you can add menu items that do allow plugin activation when first clicked, so plugins can be loaded but not activated until needed. The Preference dialog works but is not completed, and a plugin that adds a plugin control panel to view all loaded plugins, activate them, load/unload/reload, view extension points, extensions, dependencies, etc is partially completed. The point is, to allow a ready to run UI framework in Swing with an easy path for developers to quickly build applications with. If you are interested in this, when you join the mail list and introduce yourself, indicate that you are interested in this as well, as we need help with plugin development for it and would appreciate more help here too.
    Look forward to some replies.

    Might I suggest setting up a project at a known project-site? I've seen your progress and questions posted here from time to time, but one of the drawbacks is that you have to fill each post with the entirity of your vision to explain what you're doing. That's a lot of text to read - and most folks will skip right over it.
    On the other hand, a well-crafted, good-looking project web-site, with appropriate links and docs and vision statements, diagrams, etc. will have more likelyhood of attracting volunteers. java.net and sourceforge.net are likely spots to set up shop. In addition, you get CVS and bug-tracking systems, which can be quite valuable in such a large-scale project where there are lots of pieces.

Maybe you are looking for

  • Issue with trigger, multi-table insert and error logging

    I find that if I try to perform a multi-table insert with error logging on a table that has a trigger, then some constraint violations result in an exception being raised as well as logged: <pre> SQL> select * from v$version; BANNER Oracle Database 1

  • When I turn on my ipad the cursor keeping circling and will not boot up

    My ipad will not boot up.  The cursor continually turns.

  • Illustrator CC running very slow on Windows 7 PC

    Hi there, I'm running Windows 7 64bit with an Intel core i7 4790K with 8 GIG of high speed Dominator DDR3 RAM and I've got two GPUs (AMD R9 290 4GB) but since I've started working on this PC from home I've noticed how poor Illustrator runs. I bring i

  • Can't open illustrator

    Here's the error message I get when I try to open Illustrator on my Mac OS 10.9. And, yes, I did already delete any third party plug-ins. Adobe, make this work. Process:         Adobe Illustrator [407] Path:            /Applications/Adobe Illustrator

  • "Commit work and wait" possible with JCA/JRA ?

    Is it possible to specify the "commit and wait" directive with Java when attempting to commit a transaction via an RFC ? I am using JCA/JRA. If it is not possible with this version of JCA/JRA, will it be implemented in the next version ? Thanks in ad