C# Programming - I Need Help Putting a Loop into this Program!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace Homework_2
    class Program
        static void Main(string[] args)
                Console.WriteLine("Enter the First Value:");
                var number1StringValue = Console.ReadLine();
                Console.WriteLine("Enter the Second Value");
                var number2StringValue = Console.ReadLine();
                var number1 = Convert.ToDouble(number1StringValue);
                var number2 = Convert.ToDouble(number2StringValue);
                var sum = number1 + number2;
                var difference = number1 - number2;
                var product = number1 * number2;
                var quotient = number1 / number2;
                var remainder = number1 % number2;
                Console.WriteLine("The Sum Is:");
                Console.WriteLine(sum);
                Console.WriteLine("The Difference Is:");
                Console.WriteLine(difference);
                Console.WriteLine("The Product Is:");
                Console.WriteLine(product);
                Console.WriteLine("The Quotient Is:");
                Console.WriteLine(quotient);
                Console.WriteLine("The Remainder Is:");
                Console.WriteLine(remainder);
                    string answer;
                    Console.Write("Would You Like to Calculate More Numbers? Type: [Yes] or [No]");
                    answer = Console.ReadLine();
                    if (answer.Equals("Yes", StringComparison.InvariantCultureIgnoreCase))
                        Console.WriteLine("You Answered: Yes... The Program Will Continue");
                        Console.WriteLine("Not Really, I do not have enough knowledge to make this Program Loop, Sorry.");
                        Console.WriteLine("Press Any Key To Continue!");
                        Console.ReadKey();
// THIS IS WHERE I NEED THE PROGRAM TO LOOP AGAIN. 
                    else if (answer.Equals("No", StringComparison.InvariantCultureIgnoreCase))
                        Console.WriteLine("You Answered: No... Press Any Key To Stop Program");
                        Console.ReadKey();
}

 static void Main(string[] args)
           bool done = false;
           while( !done )
                Console.WriteLine("Enter the First Value:");
                var number1StringValue = Console.ReadLine();
                Console.WriteLine("Enter the Second Value");
                var number2StringValue = Console.ReadLine();
                var number1 = Convert.ToDouble(number1StringValue);
                var number2 = Convert.ToDouble(number2StringValue);
                var sum = number1 + number2;
                var difference = number1 - number2;
                var product = number1 * number2;
                var quotient = number1 / number2;
                var remainder = number1 % number2;
                Console.WriteLine("The Sum Is:");
                Console.WriteLine(sum);
                Console.WriteLine("The Difference Is:");
                Console.WriteLine(difference);
                Console.WriteLine("The Product Is:");
                Console.WriteLine(product);
                Console.WriteLine("The Quotient Is:");
                Console.WriteLine(quotient);
                Console.WriteLine("The Remainder Is:");
                Console.WriteLine(remainder);
                    string answer;
                    Console.Write("Would You Like to
Calculate More Numbers? Type: [Yes] or [No]");
                    answer = Console.ReadLine();
                    if (answer.Equals("Yes", StringComparison.InvariantCultureIgnoreCase))
                        Console.WriteLine("You
Answered: Yes... The Program Will Continue");
                        Console.WriteLine("Not
Really, I do not have enough knowledge to make this Program Loop, Sorry.");
                        Console.WriteLine("Press
Any Key To Continue!");
                        Console.ReadKey();
// THIS IS WHERE I NEED THE PROGRAM TO LOOP AGAIN. 
                    else if (answer.Equals("No",
StringComparison.InvariantCultureIgnoreCase))
                        Console.WriteLine("You
Answered: No... Press Any Key To Stop Program");
                        Console.ReadKey();
                        done = true;

Similar Messages

  • Need help fixing a bug with this program...

    I've been working for hours trying to fix the bug I have with this program...
    http://ss.majinnet.com/AccountManager.java - This is the source code of my program
    http://ss.majinnet.com/Dalzhim.jpg - This is an image used inside the program
    http://ss.majinnet.com/sphereaccu.scp - This is a text file you need to use the program
    First of all, to know what bug I am talking about.. You will need to download those 3 files.. Then you can compile AccountManager.java and run it.. When the program has opened, go into: File -> Open Account File
    and browse until you can open up the text file sphereaccu.scp ... Then there should be a list of names appearing on the left, and when you select any, there will be variables appearing in the TextFields on the right. When that's done, all you have to do to see where the bugs are is to use the options: Edit -> Create New Account as well as Edit -> Remove Account ... When you use the Create New Account option for the first time, it works fine.. But when you use it a second time, errors are appearing on the console (can't find what generates those errors...). And the biggest problem is that when you use the Remove Account option, it doesn't remove the selected account, and over that it generates errors in the console as well...
    If anyone can help me fix those errors, I'd be very grateful !

    won't pretend to understand everything or why you do somethings, but FWIW,
    //package Dalzhim.AccountManager;
    import java.io.*;
    import java.awt.*;
    import java.util.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    public class AccountManager
          JFrame window;
          Container mainPane;
          JSplitPane splitPane;
          JPanel leftPane,rightPane;
          JList accountList;
          JTextField accountName,plevel,priv,password,totaltime,lasttime,lastchar,firstconnect;
          JTextField firstIP,lastconnect,lastIP,lang;
          JLabel label1,label2,label3,label4,label5,label6,label7,label8,label9,label10,label11,label12;
          JMenuBar menuBar;
          JMenu file,edit,end;
          JMenuItem open,save,quit,create,remove,search,ab;
          JFileChooser jfc,jfcs;
          JButton searchButton,createButton;
          JTextField searchString,newName,newPassword,newPLevel;
          JDialog searchWindow,createWindow;
          File accountFile = null;
          File savingFile = null;
          FileInputStream fis;
          StringTokenizer st;
          String content;
          String lastSearch = "";
          String[] strings,lines;
          String[] parameters,arguments;
          Vector accountNames;
          Hashtable plevels,privs,passwords,totaltimes,lasttimes,lastchars,firstconnects;
          Hashtable firstIPs,lastconnects,lastIPs,langs;
          String newline = "";
          int[] activated;
          int lastSelection = -1;
          AL al;
          LL ll;
          public static void main(String args[])
          AccountManager am = new AccountManager();
          public AccountManager()
          al = new AL();
          ll = new LL();
          window = new JFrame("Account Manager");
          mainPane = window.getContentPane();
          leftPane = new JPanel();
          rightPane = new JPanel();
          leftPane.setLayout(new GridLayout(1,1,5,5));
          rightPane.setLayout(null);
          splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,leftPane,rightPane);
          mainPane.setLayout(new GridLayout(1,1,5,5));
          mainPane.add(splitPane);
          menuBar = new JMenuBar();
          file = new JMenu("File");
          edit = new JMenu("Edit");
          end = new JMenu("?");
          menuBar.add(file);
          menuBar.add(edit);
          menuBar.add(end);
          open = new JMenuItem("Open Account File");
          open.addActionListener(al);
          file.add(open);
          save = new JMenuItem("Save Account File");
          save.addActionListener(al);
          file.add(save);
          quit = new JMenuItem("Quit");
          quit.addActionListener(al);
          file.add(quit);
          create = new JMenuItem("Create New Account");
          create.addActionListener(al);
          edit.add(create);
          remove = new JMenuItem("Remove Selected Account");
          remove.addActionListener(al);
          edit.add(remove);
          search = new JMenuItem("Search");
          search.addActionListener(al);
          edit.add(search);
          ab = new JMenuItem("About");
          ab.addActionListener(al);
          end.add(ab);
          window.setJMenuBar(menuBar);
          accountList = new JList();
          accountList.addListSelectionListener(ll);
          leftPane.add(new JScrollPane(accountList));
          accountName = new JTextField(50);
          plevel = new JTextField(50);
          priv = new JTextField(50);
          password = new JTextField(50);
          totaltime = new JTextField(50);
          lasttime = new JTextField(50);
          lastchar = new JTextField(50);
          firstconnect = new JTextField(50);
          firstIP = new JTextField(50);
          lastconnect = new JTextField(50);
          lastIP = new JTextField(50);
          lang = new JTextField(50);
          label1 = new JLabel("Account Name:");
          label2 = new JLabel("Player Level:");
          label3 = new JLabel("Priv Level:");
          label4 = new JLabel("Password:");
          label5 = new JLabel("Total Connected Time:");
          label6 = new JLabel("Last Connected Time:");
          label7 = new JLabel("Last Character Used:");
          label8 = new JLabel("First Connect Data:");
          label9 = new JLabel("First Connected IP:");
          label10 = new JLabel("Last Connected Date:");
          label11 = new JLabel("Last Connected IP:");
          label12 = new JLabel("Language:");
          rightPane.add(accountName);
          rightPane.add(plevel);
          rightPane.add(priv);
          rightPane.add(password);
          rightPane.add(totaltime);
          rightPane.add(lasttime);
          rightPane.add(lastchar);
          rightPane.add(firstconnect);
          rightPane.add(firstIP);
          rightPane.add(lastconnect);
          rightPane.add(lastIP);
          rightPane.add(lang);
          rightPane.add(label1);
          rightPane.add(label2);
          rightPane.add(label3);
          rightPane.add(label4);
          rightPane.add(label5);
          rightPane.add(label6);
          rightPane.add(label7);
          rightPane.add(label8);
          rightPane.add(label9);
          rightPane.add(label10);
          rightPane.add(label11);
          rightPane.add(label12);
          label1.setBounds(10,10,150,25);
          accountName.setBounds(175,10,200,25);
          label2.setBounds(10,40,150,25);
          plevel.setBounds(175,40,200,25);
          label3.setBounds(10,70,150,25);
          priv.setBounds(175,70,200,25);
          label4.setBounds(10,100,150,25);
          password.setBounds(175,100,200,25);
          label5.setBounds(10,130,150,25);
          totaltime.setBounds(175,130,200,25);
          label6.setBounds(10,160,150,25);
          lasttime.setBounds(175,160,200,25);
          label7.setBounds(10,190,150,25);
          lastchar.setBounds(175,190,200,25);
          label8.setBounds(10,220,150,25);
          firstconnect.setBounds(175,220,200,25);
          label9.setBounds(10,250,150,25);
          firstIP.setBounds(175,250,200,25);
          label10.setBounds(10,280,150,25);
          lastconnect.setBounds(175,280,200,25);
          label11.setBounds(10,310,150,25);
          lastIP.setBounds(175,310,200,25);
          label12.setBounds(10,340,150,25);
          lang.setBounds(175,340,200,25);
          Dimension rightdim = new Dimension(380,425);
          rightPane.setMinimumSize(rightdim);
          window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          window.pack();
          window.setSize(550,425);
          window.setResizable(false);
          window.setVisible(true);
          public void openAccountFile()
          byte[] b = null;
          try
             fis = new FileInputStream(accountFile);
             b = new byte[fis.available()];
             fis.read(b,0,fis.available());
          catch(FileNotFoundException e)
          catch(IOException e)
          content = new String(b);
          newline = String.valueOf(content.charAt(content.indexOf("\n")));
          parseAccountFile();
          public void parseAccountFile()
          StringTokenizer st = new StringTokenizer(content, "[");
          strings = new String[st.countTokens()];
          createArrays();
          for (int i=0;i<strings.length;i++)
             strings[i] = st.nextToken();
          for(int i=0;i<strings.length;i++)
             parseAccountParameters(i);
          sort();
          public void parseAccountParameters(int which)
          StringTokenizer st = new StringTokenizer(strings[which],"\n");
          lines = new String[st.countTokens()];
          for(int i=0;i<lines.length;i++)
             lines[i] = st.nextToken();
          parameters = new String[lines.length];
          arguments = new String[lines.length];
          accountNames.add(getAccountName(lines[0]));
          for(int i=1;i<lines.length;i++)
             parseAccountParameter(i,which);
          public void parseAccountParameter(int which,int strings)
          StringTokenizer st = new StringTokenizer(lines[which],"=");
          parameters[which] = st.nextToken();
          if(st.hasMoreTokens())
             arguments[which] = st.nextToken();
          stockValues(strings);
          public void stockValues(int a)
          for(int i=0;i<parameters.length;i++)
             if(arguments!=null)
         if(parameters[i].equals("PLEVEL"))
              plevels.put(accountNames.get(a),arguments[i]);
         else if(parameters[i].equals("PRIV"))
              privs.put(accountNames.get(a),arguments[i]);
         else if(parameters[i].equals("PASSWORD"))
              passwords.put(accountNames.get(a),arguments[i]);
         else if(parameters[i].equals("TOTALCONNECTTIME"))
              totaltimes.put(accountNames.get(a),arguments[i]);
         else if(parameters[i].equals("LASTCONNECTTIME"))
              lasttimes.put(accountNames.get(a),arguments[i]);
         else if(parameters[i].equals("LASTCHARUID"))
              lastchars.put(accountNames.get(a),arguments[i]);
         else if(parameters[i].equals("FIRSTCONNECTDATE"))
              firstconnects.put(accountNames.get(a),arguments[i]);
         else if(parameters[i].equals("FIRSTIP"))
              firstIPs.put(accountNames.get(a),arguments[i]);
         else if(parameters[i].equals("LASTCONNECTDATE"))
              lastconnects.put(accountNames.get(a),arguments[i]);
         else if(parameters[i].equals("LASTIP"))
              lastIPs.put(accountNames.get(a),arguments[i]);
         else if(parameters[i].equals("LANG"))
              langs.put(accountNames.get(a),arguments[i]);
    public String getAccountName(String line)
         String name = "";
         for(int i=0;i<line.indexOf("]");i++)
         name = name + (String.valueOf(line.charAt(i)));
         return name;
    public void createArrays()
         accountNames = new Vector();
         plevels = new Hashtable();
         privs = new Hashtable();
         passwords = new Hashtable();
         totaltimes = new Hashtable();
         lasttimes = new Hashtable();
         lastchars = new Hashtable();
         firstconnects = new Hashtable();
         firstIPs = new Hashtable();
         lastconnects = new Hashtable();
         lastIPs = new Hashtable();
         langs = new Hashtable();
    public void showValues()
         if(lastSelection!=-1)
         //keepValues();
         int i = -1 == accountList.getSelectedIndex() ?
         lastSelection :
         accountList.getSelectedIndex();
         accountName.setText((String)accountNames.get( i ));
         plevel.setText((String)plevels.get(accountNames.get( i )));
         priv.setText((String)privs.get(accountNames.get( i )));
         password.setText((String)passwords.get(accountNames.get( i )));
         totaltime.setText((String)totaltimes.get(accountNames.get( i )));
         lasttime.setText((String)lasttimes.get(accountNames.get( i )));
         lastchar.setText((String)lastchars.get(accountNames.get( i )));
         firstconnect.setText((String)firstconnects.get(accountNames.get( i )));
         firstIP.setText((String)firstIPs.get(accountNames.get( i )));
         lastconnect.setText((String)lastconnects.get(accountNames.get( i )));
         lastIP.setText((String)lastIPs.get(accountNames.get( i )));
         lang.setText((String)langs.get(accountNames.get( i )));
         lastSelection = i ;
    public void keepValues()
         accountNames.setElementAt(accountName.getText(),lastSelection);
         plevels.put(accountNames.get(lastSelection),plevel.getText());
         privs.put(accountNames.get(lastSelection),priv.getText());
         passwords.put(accountNames.get(lastSelection),password.getText());
         totaltimes.put(accountNames.get(lastSelection),totaltime.getText());
         lasttimes.put(accountNames.get(lastSelection),lasttime.getText());
         lastchars.put(accountNames.get(lastSelection),lastchar.getText());
         firstconnects.put(accountNames.get(lastSelection),firstconnect.getText());
         firstIPs.put(accountNames.get(lastSelection),firstIP.getText());
         lastconnects.put(accountNames.get(lastSelection),lastconnect.getText());
         lastIPs.put(accountNames.get(lastSelection),lastIP.getText());
         langs.put(accountNames.get(lastSelection),lang.getText());
    public void saveAccountFile()
         keepValues();
         String saving = "";
         for(int i=0;i<strings.length;i++)
         saving = saving + ("["+(String)accountNames.get(i)+"]"+newline);
         if(plevels.get((String)accountNames.get(i))!=null && !(plevels.get((String)accountNames.get(i)).equals("")))
         saving = saving + ("PLEVEL="+plevels.get((String)accountNames.get(i))+newline);
         if(privs.get((String)accountNames.get(i))!=null && !(privs.get((String)accountNames.get(i)).equals("")))
         saving = saving + ("PRIV="+privs.get((String)accountNames.get(i))+newline);
         if(passwords.get((String)accountNames.get(i))!=null && !(passwords.get((String)accountNames.get(i)).equals("")))
         saving = saving + ("PASSWORD="+passwords.get((String)accountNames.get(i))+newline);
         if(totaltimes.get((String)accountNames.get(i))!=null && !(totaltimes.get((String)accountNames.get(i)).equals("")))
         saving = saving + ("TOTALCONNECTTIME="+totaltimes.get((String)accountNames.get(i))+newline);
         if(lasttimes.get((String)accountNames.get(i))!=null && !(lasttimes.get((String)accountNames.get(i)).equals("")))
         saving = saving + ("LASTCONNECTTIME="+lasttimes.get((String)accountNames.get(i))+newline);
         if(lastchars.get((String)accountNames.get(i))!=null && !(lastchars.get((String)accountNames.get(i)).equals("")))
         saving = saving + ("LASTCHARUID="+lastchars.get((String)accountNames.get(i))+newline);
         if(firstconnects.get((String)accountNames.get(i))!=null && !(firstconnects.get((String)accountNames.get(i)).equals("")))
         saving = saving + ("FIRSTCONNECTDATE="+firstconnects.get((String)accountNames.get(i))+newline);
         if(firstIPs.get((String)accountNames.get(i))!=null && !(firstIPs.get((String)accountNames.get(i)).equals("")))
         saving = saving + ("FIRSTIP="+firstIPs.get((String)accountNames.get(i))+newline);
         if(lastconnects.get((String)accountNames.get(i))!=null && !(lastconnects.get((String)accountNames.get(i)).equals("")))
         saving = saving + ("LASTCONNECTDATE="+lastconnects.get((String)accountNames.get(i))+newline);
         if(lastIPs.get((String)accountNames.get(i))!=null && !(lastIPs.get((String)accountNames.get(i)).equals("")))
         saving = saving + ("LASTIP="+lastIPs.get((String)accountNames.get(i))+newline);
         if(langs.get((String)accountNames.get(i))!=null && !(langs.get((String)accountNames.get(i)).equals("")))
         saving = saving + ("LANG="+langs.get((String)accountNames.get(i))+newline);
         saving = saving + newline;
         try
         FileOutputStream fos = new FileOutputStream(savingFile);
         fos.write(saving.getBytes());
         catch(FileNotFoundException e)
         catch(IOException e)
    public void about()
         final JDialog info = new JDialog(window,"About",true);
         Container aboutPane = info.getContentPane();
         aboutPane.setLayout(null);
         Image image = Toolkit.getDefaultToolkit().getImage(getClass().getResource("Dalzhim.jpg"));
         ImageIcon sig = new ImageIcon(image);
         JLabel sign = new JLabel(sig);
         JLabel text1 = new JLabel("AccountManager v0.2Beta");
         JEditorPane text2 = new JEditorPane();
         JEditorPane text3 = new JEditorPane();
         JEditorPane text4 = new JEditorPane();
         JButton close = new JButton("Okay");
         JEditorPane jep = new JEditorPane();
         sign.setBounds(10,0,374,292);
         text1.setBounds(125,300,250,20);
         text2.setBounds(10,350,400,20);
         text3.setBounds(10,400,400,20);
         text4.setBounds(10,450,400,20);
         close.setBounds(150,500,100,20);
         close.addActionListener(new ActionListener()
              public void actionPerformed(ActionEvent e)
              info.setVisible(false);
         text2.setText("Created by �alzhim");
         text3.setText("Dalzhim, also known as, Amlaruil");
         text4.setText("[email protected] - [email protected]");
         text2.setEditable(false);
         text3.setEditable(false);
         text4.setEditable(false);
         text2.setBackground(new Color(207,207,207));
         text3.setBackground(new Color(207,207,207));
         text4.setBackground(new Color(207,207,207));
         aboutPane.add(sign);
         aboutPane.add(text1);
         aboutPane.add(text2);
         aboutPane.add(text3);
         aboutPane.add(text4);
         aboutPane.add(close);
         jep.setBackground(new Color(207,207,207));
         jep.setEditable(false);
         jep.setText("TEST");
         info.pack();
         info.setSize(400,550);
         info.setResizable(false);
         info.setVisible(true);
    public void search()
         searchWindow = new JDialog(window,"Search");
         Container searchPane = searchWindow.getContentPane();
         searchPane.setLayout(null);
         searchString = new JTextField(lastSearch);
         searchButton = new JButton("Search");
         searchString.addActionListener(al);
         searchButton.addActionListener(al);
         searchPane.add(searchString);
         searchPane.add(searchButton);
         searchString.setBounds(10,10,175,25);
         searchButton.setBounds(200,10,100,25);
         searchString.selectAll();
         searchWindow.pack();
         searchWindow.setSize(320,65);
         searchWindow.setResizable(false);
         searchWindow.setVisible(true);
    public void search(String what)
         accountList.setSelectedValue(what,true);
    public void createAccount()
         createWindow = new JDialog(window,"Create New Account");
         Container createPane = createWindow.getContentPane();
         createPane.setLayout(null);
         newName = new JTextField();
         newPassword = new JTextField();
         newPLevel = new JTextField();
         createButton = new JButton("Create Account");
         JLabel createlabel1 = new JLabel("Account Name:");
         JLabel createlabel2 = new JLabel("Account Password:");
         JLabel createlabel3 = new JLabel("Account PLevel:");
         createPane.add(newName);
         createPane.add(newPassword);
         createPane.add(newPLevel);
         createPane.add(createButton);
         createPane.add(createlabel1);
         createPane.add(createlabel2);
         createPane.add(createlabel3);
         newName.addActionListener(al);
         newPassword.addActionListener(al);
         newPLevel.addActionListener(al);
         createButton.addActionListener(al);
         newName.setBounds(160,10,200,25);
         newPassword.setBounds(160,45,200,25);
         newPLevel.setBounds(160,80,200,25);
         createButton.setBounds(160,115,200,25);
         createlabel1.setBounds(10,10,150,25);
         createlabel2.setBounds(10,45,150,25);
         createlabel3.setBounds(10,80,150,25);
         createWindow.pack();
         createWindow.setSize(375,175);
         createWindow.setResizable(false);
         createWindow.setVisible(true);
    public void createProcess()
         String tempname = newName.getText();
         String temppass = newPassword.getText();
         String templeve = newPLevel.getText();
         createWindow.dispose();
         if(!(accountNames.contains(tempname)))
         accountNames.add(tempname);
         sort();
         passwords.put(tempname,temppass);
         plevels.put(tempname,templeve);
         search(newName.getText());
    public void sort()
         Object[] sorting = new Object[accountNames.size()];
         accountNames.toArray(sorting);
         String[] sorting2 = new String[sorting.length];
         for(int i=0;i<sorting.length;i++)
         sorting2[i] = (String)sorting[i];
         Arrays.sort(sorting2,String.CASE_INSENSITIVE_ORDER);
         accountNames.clear();
         for(int i=0;i<sorting2.length;i++)
         accountNames.add(sorting2[i]);
         accountList.setListData(accountNames);
    public void removeAccount()
         if(accountList.getSelectedIndex()==-1)
         JOptionPane.showMessageDialog(window,"You must select an account from the list to use the Remove option");
         else
         int i = accountList.getSelectedIndex();
         System.out.println( "ra: " + i + " an: " + accountNames.elementAt( i ) );
         System.out.println(accountNames.elementAt( i ));
         plevels.remove(accountNames.elementAt( i ));
         privs.remove(accountNames.elementAt( i ));
         passwords.remove(accountNames.elementAt( i ));
         totaltimes.remove(accountNames.elementAt( i ));
         lasttimes.remove(accountNames.elementAt( i ));
         lastchars.remove(accountNames.elementAt( i ));
         firstconnects.remove(accountNames.elementAt( i ));
         firstIPs.remove(accountNames.elementAt( i ));
         lastconnects.remove(accountNames.elementAt( i ));
         lastIPs.remove(accountNames.elementAt( i ));
         langs.remove(accountNames.elementAt( i ));
         accountNames.removeElementAt( i );
         accountList.setListData( accountNames );
         //sort();
         showValues();
    class AL implements ActionListener
         public void actionPerformed(ActionEvent e)
         if(e.getSource()==open)
              jfc = new JFileChooser(accountFile);
              jfc.setDialogTitle("Select your account file");
              jfc.setMultiSelectionEnabled(false);
              jfc.addActionListener(al);
              jfc.showOpenDialog(window);
         else if(e.getSource()==jfc)
              accountFile = jfc.getSelectedFile();
              openAccountFile();
         else if(e.getSource()==save)
              jfcs = new JFileChooser(savingFile);
              jfcs.setDialogTitle("Where do you wish to save?");
              jfcs.setMultiSelectionEnabled(false);
              jfcs.addActionListener(al);
              jfcs.showSaveDialog(window);
         else if(e.getSource()==ab)
              about();
         else if(e.getSource()==jfcs)
              savingFile = jfcs.getSelectedFile();
              saveAccountFile();
         else if(e.getSource()==quit)
              System.exit(-1);
         else if(e.getSource()==search)
              search();
         else if(e.getSource()==searchString)
              searchButton.doClick();
         else if(e.getSource()==searchButton)
              accountList.setSelectedValue(searchString.getText(),true);
              lastSearch = searchString.getText();
              searchWindow.dispose();
         else if(e.getSource()==create)
              createAccount();
         else if(e.getSource()==newName)
              newPassword.requestFocus();
              newPassword.selectAll();
         else if(e.getSource()==newPassword)
              newPLevel.requestFocus();
              newPLevel.selectAll();
         else if(e.getSource()==newPLevel)
              createButton.doClick();
         else if(e.getSource()==createButton)
              if(newName.getText().equals("") || newPassword.getText().equals("") || newPLevel.getText().equals(""))
              createWindow.dispose();
              JOptionPane.showMessageDialog(window,"You have to enter an account name, a password and a plevel");
              else
              createProcess();
         else if(e.getSource()==remove)
              removeAccount();
    class LL implements ListSelectionListener
         public void valueChanged(ListSelectionEvent e)
         showValues();

  • Really need help on how to write this program some 1 plz help me out here.

    i am new to java and i confused on how to be writing this program.
    i have completed the Part 1 but i am stuck on Part 2 & 3 so it would would be really great if any 1 could help me out on how to write the program.
    Part I
    An algorithm describes how a problem is solved in terms of the actions to be executed, and it specifies the order in which the actions should be executed. An algorithm must be detailed enough so that you can "walk" through the algorithm with test data. This means the algorithm must include all the necessary calculations.
    Here is an algorithm that calculates the cost of a rectangular window. The
    total cost of a window is based on two prices; the cost of the glass plus the cost of the metal frame around the glass. The glass is 50 cents per
    square inch (area) and the metal frame is 75 cents per inch (perimeter).
    The length and width of the window will be entered by the user. The
    output of the program should be the length and width (entered by the user)
    and the total cost of the window.
    FORMULAS:
    area = length times width perimeter = 2 times (length plus width)
    Here is the corresponding algorithm:
    read in the length of the window in inches
    read in the width of the window in inches
    compute the area
    compute the cost of the glass (area times 50 cents)
    compute the perimeter
    compute the cost of the frame (perimeter times 75 cents)
    compute the total cost of the window (cost of glass plus cost of frame)
    display the length, width and total cost
    The next step would be to "desk check" the algorithm. First you would need to make up the "test data". For this algorithm, the test data would involve making up a length and a width, and then calculating the cost of the window based on those values. The results are computing by hand or using a calculator. The results of your test data are always calculated before translating your algorithm into a programming language. Here is an example of the test data for the problem given:
    length = 10
    width = 20
    area = 200, glass cost= 100.00 (area times 50 cents)
    perimeter = 60, frame cost = 45.00 (perimeter times 75 cents)
    total cost =145.00
    Once the test data is chosen, you should "walk" through the algorithm using the test data to see if the algorithm produces the same answers that you obtained from your calculations.
    If the results are the same, then you would begin translating your algorithm into a programming language. If the results are not the same, then you would attempt to find out what part of the algorithm is incorrect and correct it. It is also
    necessary to re-check your hand calculations.
    Each time you revise your algorithm, you should walk through it with your test data again. You keep revising your algorithm until it produces the same answers as your test data.
    ?Now write and submit a Java program that will calculate the cost of a rectangular window according to the algorithm explained. Be sure to prompt for input and label your output.?
    Part II
    Write, compile and execute a Java program that displays the following prompts:
    Enter an integer.
    Enter a second integer
    Enter a third integer.
    Enter a fourth integer.
    After each prompt is displayed, your program should use the nextint method of the Scanner class to accept a number from the keyboard for the displayed
    prompt. After the fourth integer has been entered, your program should calculate and display the average of the four integers and the value of the first integer entered raised to the power of the second integer entered. The average and result of raising to a power should be included in an appropriate messages
    (labels).
    Sample Test Data:
    Set 1: 100 100 100 100
    Set 2: 100 0 100 0
    Be sure to write an algorithm first before attempting to write the Java code. Walk through your algorithm with test data to be sure it works as anticipated.
    Part III
    Repeat Part lI but only calculate the average, not the power. This time, make sure to use the same variable name, number, for each of the four numbers input. Also use the variable sum for the sum of the numbers. (Hint: To do this, you may use the statement sum = sum + number after each number is read.)
    For Part 1 this is what i got
    import java.util.Scanner;
    public class Window
         public static void main(String[] args)
              double length, width, glass_cost, perimeter, frame_cost, area, total;
              Scanner keyboard = new Scanner (System.in);
              System.out.println("Enter the length of the window in inches");
              length = keyboard.nextInt();
              System.out.println("Enter the width of the window in inches");
              width = keyboard.nextInt();
              area = length * width;
              glass_cost = area * .5;
              perimeter = 2 * (length + width);
              frame_cost = perimeter * .75;
              total = glass_cost + frame_cost;
                   System.out.println("The Length of the window is " + length + "inches");
                   System.out.println("The Width of the window is " + length + "inches");
                   System.out.println("The total cost of the window is $ " + total);
         Enter the length of the window in inches
         5
         Enter the width of the window in inches
         8
         The Length of the window is 5.0inches
         The Width of the window is 5.0inches
         The total cost of the window is $ 39.5
    Press any key to continue . . .
    Edited by: Adhi on Feb 24, 2008 10:33 AM

    Adhi wrote:
    i am new to java and i confused on how to be writing this program.
    i have completed the Part 1 but i am stuck on Part 2 & 3 so it would would be really great if any 1 could help me out on how to write the program.Looks like homework to me.
    What have you written so far? Post it.
    Part I
    An algorithm describes how a problem is solved in terms of the actions to be executed, and it specifies the order in which the actions should be executed. An algorithm must be detailed enough so that you can "walk" through the algorithm with test data. This means the algorithm must include all the necessary calculations.
    Here is an algorithm that calculates the cost of a rectangular window. The
    total cost of a window is based on two prices; the cost of the glass plus the cost of the metal frame around the glass. The glass is 50 cents per
    square inch (area) and the metal frame is 75 cents per inch (perimeter).
    The length and width of the window will be entered by the user. The
    output of the program should be the length and width (entered by the user)
    and the total cost of the window.
    FORMULAS:
    area = length times width perimeter = 2 times (length plus width)
    Here is the corresponding algorithm:
    read in the length of the window in inches
    read in the width of the window in inches
    compute the area
    compute the cost of the glass (area times 50 cents)
    compute the perimeter
    compute the cost of the frame (perimeter times 75 cents)
    compute the total cost of the window (cost of glass plus cost of frame)
    display the length, width and total cost
    The next step would be to "desk check" the algorithm. First you would need to make up the "test data". For this algorithm, the test data would involve making up a length and a width, and then calculating the cost of the window based on those values. The results are computing by hand or using a calculator. The results of your test data are always calculated before translating your algorithm into a programming language. Here is an example of the test data for the problem given:
    length = 10
    width = 20
    area = 200, glass cost= 100.00 (area times 50 cents)
    perimeter = 60, frame cost = 45.00 (perimeter times 75 cents)
    total cost =145.00
    Once the test data is chosen, you should "walk" through the algorithm using the test data to see if the algorithm produces the same answers that you obtained from your calculations.
    If the results are the same, then you would begin translating your algorithm into a programming language. If the results are not the same, then you would attempt to find out what part of the algorithm is incorrect and correct it. It is also
    necessary to re-check your hand calculations.
    Each time you revise your algorithm, you should walk through it with your test data again. You keep revising your algorithm until it produces the same answers as your test data.
    &#147;Now write and submit a Java program that will calculate the cost of a rectangular window according to the algorithm explained. Be sure to prompt for input and label your output.&#148;
    Part II
    Write, compile and execute a Java program that displays the following prompts:
    Enter an integer.
    Enter a second integer
    Enter a third integer.
    Enter a fourth integer.
    After each prompt is displayed, your program should use the nextint method of the Scanner class to accept a number from the keyboard for the displayed
    prompt. After the fourth integer has been entered, your program should calculate and display the average of the four integers and the value of the first integer entered raised to the power of the second integer entered. The average and result of raising to a power should be included in an appropriate messages
    (labels).
    Sample Test Data:
    Set 1: 100 100 100 100
    Set 2: 100 0 100 0
    Be sure to write an algorithm first before attempting to write the Java code. Walk through your algorithm with test data to be sure it works as anticipated.So this is where you actually have to do something. My guess is that you've done nothing so far.
    Part III
    Repeat Part lI but only calculate the average, not the power. This time, make sure to use the same variable name, number, for each of the four numbers input. Also use the variable sum for the sum of the numbers. (Hint: To do this, you may use the statement sum = sum + number after each number is read.)Man, this specification writes itself. Sit down and start coding.
    One bit of advice: Nobody here takes kindly to lazy, stupid students who are just trying to con somebody into doing their homework for them. If that's you, better have your asbestos underpants on.
    %

  • Need help writing a code for this program

    Design a code that reads a sentence and prints each individual word on a different line

    tsith's suggestion is excellent. Run it and see what happens. I just did that myself and doing so I learned something new about the Scanner class.
    Before you run it, add a couple of extra System.out.println for (hopefully) illustrating debugging purposes:
    import java.lang.String;
    import java.util.Scanner;
    public class Sentence {
        // main line of program
        public static void main(String[] args) {
            boolean z;
            String a;
            Scanner keyboard = new Scanner(System.in);
            System.out.print("Enter sentence: ");
            z = keyboard.hasNext();
            while (z) {
                System.out.println("z = " + z + ". Fetching the next word...");
                a = keyboard.next();
                System.out.println(a);
            System.out.println("Done!");
    }Let us know if the program ever prints "Done!" to the console. While you are waiting, read what the javadocs has to say about the Scanner class, and pay extra attention to what it says about the hasNext() and next() methods:
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Scanner.html

  • Error at new statement on extended program check need help

    Hi all ,
                       This is the code :
    LOOP AT i_stocks INTO wa_stocks WHERE NOT pulkt IS INITIAL AND
                             NOT bstkt IS INITIAL AND
                             NOT fprctr IS INITIAL AND
                             ( write_off_fix <> 0 OR
                               write_off_pup <> 0 ).
        AT NEW fprctr.
          CLEAR: l_prctrsum_fix, l_prctrsum_pup.
        ENDAT.
        IF wa_stocks-bukrs <> lastbukrs.
          lastbukrs = wa_stocks-bukrs.
          PERFORM document_header USING xreversal.
          i_counter = 1.
          CLEAR lastkostl.
        ENDIF.
        ADD wa_stocks-write_off_pup TO l_prctrsum_pup.
    ENDLOOP
    On Extended program check its says :
    The LOOP statement processing will be limited
    (FROM, TO and WHERE additions in LOOP)
    Interaction with group change processing (AT NEW, ...) is undefined
    (The message can be hidden with "#EC *)
    It means at statement   AT NEW fprctr .
    Need help , How can i resolve this error ?
    Regards .
    Edited by: ujjwal dharmak on Feb 19, 2010 9:55 AM
    Moderator message - Moved to the correct forum
    Edited by: Rob Burbank on Feb 19, 2010 9:04 AM

    Since you are using where condition in loop statement and also using the control break statement thats why it is showing the error for you.
    So if you want you can do like this
    loop at itab into wa.
    if not  wa-f1 is initial ....<and other conditions>.
    continue.
    endif.
    at new   f1.
    endat.
    endloop.
    It will resolve your problem but I am having the doubt how the at new will work properly...
    Regards
    Shiba Prasad Dutta

  • I need help putting my printer together hp photosmart cn218a b210a how do u find a book on it

    i need help putting it together i had to take it apart there was dog food jammed in it the mice

    Here is a link for the manual.
    http://h10032.www1.hp.com/ctg/Manual/c02456532.pdf
    Here is another link for a video on putting the cartridges in.
    http://www.youtube.com/watch?v=gbZkq01F7do
    ""Click on the WHITE STAR if you would like to say THANKS""
    **Click the KUDOS star on the left to say 'Thanks'**
    Please mark a reply "ACCEPTED AS SOLUTION" if it solved your problem, so others can find it.

  • Hi how to avoid nested loops in this program to improve the performence

    Hi all
    How to avoide the nested loops in this programing what is the replacement for the nested loops in this program coding......
    LOOP AT itb_ekpo.
        READ TABLE itb_marc WITH KEY
           matnr = itb_ekpo-matnr
           werks = itb_ekpo-werks BINARY SEARCH.
        CHECK sy-subrc = 0.
    FAE 26446 fin remplacement
        itb_pca-ebeln = itb_ekpo-ebeln.
        itb_pca-ebelp = itb_ekpo-ebelp.
      itb_pca-lifnr = itb_ekko-lifnr.   "-FAE26446
        itb_pca-lifnr = itb_ekpo-lifnr.                         "+FAE26446
        itb_pca-ekgrp = itb_ekpo-ekgrp.                         "+FAE26446
        itb_pca-dispo = itb_ekpo-dispo.                         "+FAE26446
        itb_pca-matnr = itb_ekpo-matnr.
        itb_pca-werks = itb_ekpo-werks.
      Recherche du libellé article
        READ TABLE itb_makt
                   WITH KEY matnr = itb_ekpo-matnr
                            spras = text-fra
                   BINARY SEARCH.
        IF sy-subrc = 0.
          itb_pca-maktx = itb_makt-maktx.
        ELSE.
          READ TABLE itb_makt
                    WITH KEY matnr = itb_ekpo-matnr
                             spras = text-ang
                    BINARY SEARCH.
          IF sy-subrc = 0.
            itb_pca-maktx = itb_makt-maktx.
          ENDIF.
        ENDIF.
        IF NOT itb_ekpo-bpumn IS INITIAL.
          itb_pca-menge = itb_ekpo-menge * itb_ekpo-bpumz /
                                           itb_ekpo-bpumn.
        ENDIF.
      Sélect° ds la table EKES des dates de livraisons et des qtés
      en transit
        CLEAR w_temoin_ar.
        CLEAR w_etens.
        LOOP AT itb_ekes
                FROM w_index_ekes.
          IF  itb_ekes-ebeln = itb_ekpo-ebeln
          AND itb_ekes-ebelp = itb_ekpo-ebelp.
            IF itb_ekes-ebtyp = text-arn.
              itb_pca-eindt = itb_ekes-eindt.
              w_temoin_ar = 'X'.
            ELSE.
            Si c'est une qté en transit alors on recupere
            la quantité et la date.
              IF itb_ekes-dabmg < itb_ekes-menge.
                itb_pca-qtran = itb_pca-qtran + itb_ekes-menge -
                                itb_ekes-dabmg.
              ENDIF.
              IF itb_ekes-etens > w_etens.
                w_etens = itb_ekes-etens.
                itb_pca-dtran = itb_ekes-eindt.
              ENDIF.
            ENDIF.
          ELSEIF itb_ekes-ebeln > itb_ekpo-ebeln
          OR ( itb_ekes-ebeln = itb_ekpo-ebeln
          AND itb_ekes-ebelp > itb_ekpo-ebelp ).
            w_index_ekes = sy-tabix.
            EXIT.
          ENDIF.
        ENDLOOP.
      S'il n'y a pas d'AR alors récupérat° de la date livraison dans EKET.
        LOOP AT itb_eket
                FROM w_index_eket.
          IF  itb_eket-ebeln = itb_ekpo-ebeln
          AND itb_eket-ebelp = itb_ekpo-ebelp.
            IF w_temoin_ar IS INITIAL.
              itb_pca-eindt = itb_eket-eindt.
            ENDIF.
            itb_pca-slfdt = itb_eket-slfdt.
          Calcul du portefeuille fournisseur à partir de la
          qté commandée et la qté reçue
            itb_pca-attdu = itb_pca-attdu + itb_eket-menge -
                            itb_eket-wemng.
          Calcul du montant du poste
            itb_pca-netpr = itb_ekpo-netpr * itb_pca-attdu.
            IF itb_ekpo-peinh NE 0.
              itb_pca-netpr = itb_pca-netpr / itb_ekpo-peinh.
            ENDIF.
          Calcul quantité réceptionnée.
            itb_pca-wemng = itb_pca-wemng + itb_eket-wemng.
          Calcul du retard en nombre de jours calendaires
          Le calcul du retard  ne doit pas prendre en compte
          le jour de livraison
            ADD 1 TO itb_eket-eindt.
            IF NOT itb_pca-attdu  IS INITIAL
            AND    itb_eket-eindt LT sy-datum.
            Calcul du retard en nombre de jours ouvrés
              CLEAR w_retard.
              CALL FUNCTION 'Z_00_BC_WORKDAYS_PER_PERIOD'
                   EXPORTING
                        date_deb = itb_eket-eindt
                        date_fin = sy-datum
                   IMPORTING
                        jours    = w_retard.
              itb_pca-rtard = itb_pca-rtard + w_retard .
            ENDIF.
          ELSEIF itb_eket-ebeln > itb_ekpo-ebeln
          OR (   itb_eket-ebeln = itb_ekpo-ebeln
          AND    itb_eket-ebelp > itb_ekpo-ebelp ).
            w_index_eket = sy-tabix.
            EXIT.
          ENDIF.
        ENDLOOP.
      Recherche de la derniere date de livraison.
        LOOP AT itb_mseg
                FROM w_index_mseg.
          IF  itb_mseg-ebeln = itb_ekpo-ebeln
          AND itb_mseg-ebelp = itb_ekpo-ebelp.
            READ TABLE itb_mkpf
                       WITH KEY mblnr = itb_mseg-mblnr
                                mjahr = itb_mseg-mjahr
                       BINARY SEARCH.
            IF sy-subrc = 0.
              IF itb_mkpf-bldat > itb_pca-bldat.
                itb_pca-bldat = itb_mkpf-bldat.
              ENDIF.
            ENDIF.
          ELSEIF itb_mseg-ebeln > itb_ekpo-ebeln
          OR (   itb_mseg-ebeln = itb_ekpo-ebeln
          AND    itb_mseg-ebelp > itb_ekpo-ebelp ).
            w_index_mseg = sy-tabix.
            EXIT.
          ENDIF.
        ENDLOOP.
        APPEND itb_pca.
        CLEAR itb_pca.
    FAE26446 suppression parag. suivant
         ELSEIF itb_ekpo-ebeln > itb_ekko-ebeln.
           w_index_ekpo = sy-tabix.
           EXIT.
         ENDIF.
       ENDLOOP.
    Fin FAE26446
      ENDLOOP.
    Thanks in advance for all.....

    Hi
    these are the performance tips
    Instead of using nested Select loops it is often better to use subqueries.
    SELECT * FROM SPFLI
      INTO TABLE T_SPFLI
      WHERE CITYFROM = 'FRANKFURT'
        AND CITYTO = 'NEW YORK'.
    SELECT * FROM SFLIGHT AS F
        INTO SFLIGHT_WA
        FOR ALL ENTRIES IN T_SPFLI
        WHERE SEATSOCC < F~SEATSMAX
          AND CARRID = T_SPFLI-CARRID
          AND CONNID = T_SPFLI-CONNID
          AND FLDATE BETWEEN '19990101' AND '19990331'.
    ENDSELECT.
    The above mentioned code can be even more optimized by using subqueries instead of for all entries.
    SELECT * FROM SFLIGHT AS F INTO SFLIGHT_WA
        WHERE SEATSOCC < F~SEATSMAX
          AND EXISTS ( SELECT * FROM SPFLI
                         WHERE CARRID = F~CARRID
                           AND CONNID = F~CONNID
                           AND CITYFROM = 'FRANKFURT'
                           AND CITYTO = 'NEW YORK' )
          AND FLDATE BETWEEN '19990101' AND '19990331'.
    ENDSELECT.
    <b>Internal Tables</b>
    1.     Table operations should be done using explicit work areas rather than via header lines.
    2.     Always try to use binary search instead of linear search. But don’t forget to sort your internal table before that.
    3.     A dynamic key access is slower than a static one, since the key specification must be evaluated at runtime.
    4.     A binary search using secondary index takes considerably less time.
    5.     LOOP ... WHERE is faster than LOOP/CHECK because LOOP ... WHERE evaluates the specified condition internally.
    6.     Modifying selected components using “ MODIFY itab …TRANSPORTING f1 f2.. “ accelerates the task of updating  a line of an internal table.
    Point # 2
    READ TABLE ITAB INTO WA WITH KEY K = 'X‘ BINARY SEARCH.
    IS MUCH FASTER THAN USING
    READ TABLE ITAB INTO WA WITH KEY K = 'X'.
    If TAB has n entries, linear search runs in O( n ) time, whereas binary search takes only O( log2( n ) ).
    Point # 3
    READ TABLE ITAB INTO WA WITH KEY K = 'X'. IS FASTER THAN USING
    READ TABLE ITAB INTO WA WITH KEY (NAME) = 'X'.
    Point # 5
    LOOP AT ITAB INTO WA WHERE K = 'X'.
    ENDLOOP.
    The above code is much faster than using
    LOOP AT ITAB INTO WA.
      CHECK WA-K = 'X'.
    ENDLOOP.
    Point # 6
    WA-DATE = SY-DATUM.
    MODIFY ITAB FROM WA INDEX 1 TRANSPORTING DATE.
    The above code is more optimized as compared to
    WA-DATE = SY-DATUM.
    MODIFY ITAB FROM WA INDEX 1.
    7.     Accessing the table entries directly in a "LOOP ... ASSIGNING ..." accelerates the task of updating a set of lines of an internal table considerably
    8.    If collect semantics is required, it is always better to use to COLLECT rather than READ BINARY and then ADD.
    9.    "APPEND LINES OF itab1 TO itab2" accelerates the task of appending a table to another table considerably as compared to “ LOOP-APPEND-ENDLOOP.”
    10.   “DELETE ADJACENT DUPLICATES“ accelerates the task of deleting duplicate entries considerably as compared to “ READ-LOOP-DELETE-ENDLOOP”.
    11.   "DELETE itab FROM ... TO ..." accelerates the task of deleting a sequence of lines considerably as compared to “  DO -DELETE-ENDDO”.
    Point # 7
    Modifying selected components only makes the program faster as compared to Modifying all lines completely.
    e.g,
    LOOP AT ITAB ASSIGNING <WA>.
      I = SY-TABIX MOD 2.
      IF I = 0.
        <WA>-FLAG = 'X'.
      ENDIF.
    ENDLOOP.
    The above code works faster as compared to
    LOOP AT ITAB INTO WA.
      I = SY-TABIX MOD 2.
      IF I = 0.
        WA-FLAG = 'X'.
        MODIFY ITAB FROM WA.
      ENDIF.
    ENDLOOP.
    Point # 8
    LOOP AT ITAB1 INTO WA1.
      READ TABLE ITAB2 INTO WA2 WITH KEY K = WA1-K BINARY SEARCH.
      IF SY-SUBRC = 0.
        ADD: WA1-VAL1 TO WA2-VAL1,
             WA1-VAL2 TO WA2-VAL2.
        MODIFY ITAB2 FROM WA2 INDEX SY-TABIX TRANSPORTING VAL1 VAL2.
      ELSE.
        INSERT WA1 INTO ITAB2 INDEX SY-TABIX.
      ENDIF.
    ENDLOOP.
    The above code uses BINARY SEARCH for collect semantics. READ BINARY runs in O( log2(n) ) time. The above piece of code can be more optimized by
    LOOP AT ITAB1 INTO WA.
      COLLECT WA INTO ITAB2.
    ENDLOOP.
    SORT ITAB2 BY K.
    COLLECT, however, uses a hash algorithm and is therefore independent
    of the number of entries (i.e. O(1)) .
    Point # 9
    APPEND LINES OF ITAB1 TO ITAB2.
    This is more optimized as compared to
    LOOP AT ITAB1 INTO WA.
      APPEND WA TO ITAB2.
    ENDLOOP.
    Point # 10
    DELETE ADJACENT DUPLICATES FROM ITAB COMPARING K.
    This is much more optimized as compared to
    READ TABLE ITAB INDEX 1 INTO PREV_LINE.
    LOOP AT ITAB FROM 2 INTO WA.
      IF WA = PREV_LINE.
        DELETE ITAB.
      ELSE.
        PREV_LINE = WA.
      ENDIF.
    ENDLOOP.
    Point # 11
    DELETE ITAB FROM 450 TO 550.
    This is much more optimized as compared to
    DO 101 TIMES.
      DELETE ITAB INDEX 450.
    ENDDO.
    12.   Copying internal tables by using “ITAB2[ ] = ITAB1[ ]” as compared to “LOOP-APPEND-ENDLOOP”.
    13.   Specify the sort key as restrictively as possible to run the program faster.
    Point # 12
    ITAB2[] = ITAB1[].
    This is much more optimized as compared to
    REFRESH ITAB2.
    LOOP AT ITAB1 INTO WA.
      APPEND WA TO ITAB2.
    ENDLOOP.
    Point # 13
    “SORT ITAB BY K.” makes the program runs faster as compared to “SORT ITAB.”
    Internal Tables         contd…
    Hashed and Sorted tables
    1.     For single read access hashed tables are more optimized as compared to sorted tables.
    2.      For partial sequential access sorted tables are more optimized as compared to hashed tables
    Hashed And Sorted Tables
    Point # 1
    Consider the following example where HTAB is a hashed table and STAB is a sorted table
    DO 250 TIMES.
      N = 4 * SY-INDEX.
      READ TABLE HTAB INTO WA WITH TABLE KEY K = N.
      IF SY-SUBRC = 0.
      ENDIF.
    ENDDO.
    This runs faster for single read access as compared to the following same code for sorted table
    DO 250 TIMES.
      N = 4 * SY-INDEX.
      READ TABLE STAB INTO WA WITH TABLE KEY K = N.
      IF SY-SUBRC = 0.
      ENDIF.
    ENDDO.
    Point # 2
    Similarly for Partial Sequential access the STAB runs faster as compared to HTAB
    LOOP AT STAB INTO WA WHERE K = SUBKEY.
    ENDLOOP.
    This runs faster as compared to
    LOOP AT HTAB INTO WA WHERE K = SUBKEY.
    ENDLOOP.
    <b>Reward if usefufll</b>

  • How do i put a loop round this so the user can only enter a number between

    how do i put a loop round this so that the user can only enter a number between 1 and 3 if a number like 4 is enter it will just say something like retry
    if (CA.trim().equals(ans1)){
    Out = "incorrect";
    else if(CA.trim().equals(ans2)){
    Out = "incorrect";
    else if(CA.trim().equals(ans3)){
    Out = "correct";
    else{
    System.out.println("Enter 1 2 or 3 try doin test again");
    System.out.println(Out);
    byte b[] = Out.getBytes();
    out1.write(b);

    You already know the conditions so here's some pseudocode.
    get input
    while(input is not what I want (between one and three))
            Inform user of improper input and ask for it again
            get new input

  • HT1338 I AM HAVING SO MANY PROBLE TRYING TO DOWNLOAD Mac OS X version 10.7.5 TO MY MACBOOK, I NEED HELP, I HAVE ALREADY PURCHASE THIS PRODUCT OVER A MONTH AGO

    I AM HAVING SO MANY PROBLEMS TRYING TO DOWNLOAD Mac OS X version 10.7.5 TO MY MACBOOK, I NEED HELP, I HAVE ALREADY PURCHASE THIS PRODUCT OVER A MONTH AGO

    lkimmie wrote:
    I AM HAVING SO MANY PROBLEMS TRYING TO DOWNLOAD Mac OS X version 10.7.5 TO MY MACBOOK, I NEED HELP, I HAVE ALREADY PURCHASE THIS PRODUCT OVER A MONTH AGO
    Firstly, please turn off your Caps lock. It is considered shouting in forums.
    Secondly, please explain your exact issue and wheteher or not you can see your purchase in the App Store and if you are using the same Apple ID to reinstall it with as you used to purcase it with.
    Thanks
    Pete

  • Hi, Need help about ios7 upgrade, after this upgrade I cannot watch youtube or any video with my Ipad,

    Hi, Need help about ios7 upgrade, after this upgrade I cannot watch youtube or any video with Ipad, and Iphone as well
    I think my wireless rooter's setting has some problem but cannot found anything to solve,
    I can watch if there is another wireless network , I tried this option in another place who has wireless network and I can watch.
    Do you have any idea to do these setting , I dont have any problem when Ipad has 6.1.3 IOS,
    need help
    thanks

    Thanks
    I will and share the result.

  • App Store appears in a program to do UPDATE, but I never installed this program.

    App Store appears in a program to do UPDATE, but I never installed this program.
    I was wondering if there is a way to remove this program from my webpage Update Available.
    Program's name: Nyan Cat: Lost In Space.

    First of all, Thank You Carolyn.
    I did that, but when I come to App Store > Update
    It still there.
    When I tryed to UPDATE come some other account.
    How can I delete this programer from that list?
    Thank's

  • Need Help Putting Together a rMBP so I Have Everything I Need...

    Hello-
    I am having trouble getting the right kind of help from "Chat Now" on apple.com and calling in to get my questions/needs taken care of so that when I get the rMBP I will be sure I wil have what I need to go right online and teach the online courses. I even went to the local apple store and woked with a couple sames guys there, but they were not clear in a couple situations on what I would need with the different options the rMBP gives. so I am truning to the great apple forum for additional help.  this might be too much to ask even for tis forum, but if I can learn a little at a time, maybe I can gradually gain the knowledge I need to have a complete and functioning home office for my personal computing needs and my needs as an online teacher at a university back East. My technical knowledge is not the best, so as far as the rMBP goes, a big problem for me is that I do not have the knowledge to make sure I order everything I need with the changes a new rMBP will bring to my current setup (which is just a basic MBP using a wireless router and a USB cable for the printer that I just connect when I need to print). I realizee my current set up on my desk is not the most advanced, but I would need a pro to come to my office and help me get the best set-up for what I am curently using. It seems that the agents I chat with and/or talk to on the phone are aslo lacking in knowledge to help me put together a rMBP that will be ready to fully use and have with the order all that I need so that I do not have to order additional items in a mad rush to be ready for the courses I am teaching online. I have read several articles about the rMBP so that I cold have some knowledge about what I will need but as I said my techie knowledge is lacking. I am looking at the 15" rMBP with all of the full upgrades that the configure option allows one to get. I am not clear if I do run into trouble with my wi fi and have to use my ethernet cable what I will need to do this. I also have programs that are older that I am guesing I will need to install using a DVD player. I would like to hook up the printer I have or a new Canon printer and use it wirelessly, but for now I will most likely be using it with a USB cable. I am not clear on the thunderbolt technology and if I should get any of these cables for any of the connections. I also would like to get a great speaker system and will need to hook that up, but I am not clear on the best way to do this. I have been wanting an iMac, but I am not sure what is a good slection to get and how to connect it to the rMBP or one of the other 2 older MBPs I currently have.
    If somebody could list for me what I would need to have a complete rMBP that will allow me to do these hookups and connections and explain what would be the best way to complete the various connections so that I have all that I will need to get up and running, I would really appreciate it. Because I do not have any USB 3.0 cables or cables for various additional connections, I would need help/suggestions in this area. I realize this is hard to do not seeing my office, but since I will be starting new with the purchase of the new rMBP and hopefully an iMac (and a new Canon printer and new set of great sounding speakers) getting some advice on what I should order for the various connections would be a hugh help. Part of the problem is with the rMBP and not having used one of these in the past. I know some of the differences with this machine like the lack of an internal SuperDrive and the new ports, but I do not know what cables I will need that will utilize the newer technology this machine and an imac will bring to my office.
    Any suggestions are greatly appreciated, even if you do not give me specific answers, but an idea, for example, of what I might need to connect the speaker system (knowing the best way the new speaker system shold be connected to the rMBP and/or the iMac. I am not even clear if I do want to use the iMac with the rMBP for teaching with a larger display what I will need to connect the imac to the rMBP. is this done by an HDMI cable and if so is there a specific type or example you could mention that is on apple.com?

    There are many differences with the new rMBP. There are ports that I am not sure what I would use them for.  Even the ethernet cable I use now to get the internet will not work with the rMBP.  I thought there would be some additional help on here.  as far as configuring the rMBP there are just a few options but the differences between an older MBP and the new rMBP is great.  No need to reply I will turn off email notifications. I gave as much information as I did because in the past I was told to give more information.

  • Need Help Putting a Flash Widget into an Image Being Exported into HTML

    Hi, I'm making a banner for the top of my band's MySpace. I only got into making layouts and such because we didn't want to spend the money on hiring a professional, so I'm kind of new to this and I don't know if anyone can help but what I'm trying to do is put a flash widget (for Twitter) into an image on Photoshop which I will then export into html. Can I do this on Photoshop or do I need to do it on another program. Any help would be appreciated, thanks!

    No, this requires you to learn HTML and create the proper embedding code and page layout.
    Mylenium

  • Need help putting Photoshop CS6 on new device (without the CD)

    So I just recently purchased a new Windows Surface Pro 3 which I've been looking forward to using Photoshop CS6 on. I bought PS CS6 through Journeyed.com a couple years ago and have already registered it to my old laptop. Unfortunately, I misplaced the CD, but I have the box with the product code. I thought I could just do like I did before--download the free trial of CS6 and put in my serial number. Since Adobe now offers "Photoshop CC" instead of CS6, I guess that's what throws it off and stops my serial number from working (i get "invalid code"). I even had to double check what my serial code was through Adobe and my serial number was there, already registered.
    I've already tried downloading the free trial of CS6 from other websites but it's been complicated. One of them didn't even work and gave me an error message, and the other was .dmg file so I had to download an app just to unzip the file. I'm just really confused and need help with this. I even tried to put the program files from my laptop onto an external hard drive and put them onto my surface pro, but that got confusing too. 
    Thanks,
    Gaby

    You can download CS6 software so you can use your code
    Download CS6 products from adobe site

  • NEED HELP PUTTING MULTIPLE PAGES TOGETHER IN 1 PDF

    HOW DO I PUT 10 PAGES TOGETHER TO OPEN IN 1 PDF?

    Thanks Janelle - I do not have that ability with the Epson RX580. Epson just answered my tech support question with this answer:
    I am sorry you are experiencing difficulties with your EPSON Stylus Photo RX580. Unfortunately this feature is not available with Mac OS X. You will need a third-party software that will help you with this, such as Poster Print for Mac or Tiler. Please note though that Epson does not support these applications.
    So I guess my question becomes what software can I use to print my images on multiple pages. As I do large photo transfers I need to be able to do this with my mac in an efficient way and not try to cut portions of image into seperate print jobs that would be too time consuming. HAve you had any experience with other software. If not I guess the next question  what printer would you recommend that would do this with my MAC. I have included a pic of one of my larger transfers on a cupboard. To do this I needed the image to be tiled on 8 different sheet of 8.5x11 so this is a feature I need through either software or a printer that is easy to use and easily accessible. Thanks Krista
    I am inl

Maybe you are looking for

  • How do I remove unwanted table/ cell borders in firefox

    I just built my website in dreamweaver. When I preview it, it looks fine in both firefox & safari. However when i post and view my site online, i see unwanted cel borders in firefox...I've already checked the code and the border is set to 0 - any hel

  • Can I buy US TV shows on my USA iTunes account while abroad?

    I live in the USA but I am traveling to Mexico in a couple of hours and I was wondering if I can purchase TV episodes of my favorite shows while I am over there? Someone told me I should be able to since I have a US account with a US Credit card. Is

  • How to get Adapter Engine version in PI 7.1?

    Hi all, How to get adapter engine version in ehp 1sap 7.1 sp08 ? Thanks Sunil

  • ZoomIn,ZoomOut problem...

    Hi. I have following problem: addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverHandler); function fl_MouseOverHandler(event:MouseEvent):void stop(); addEventListener(MouseEvent.MOUSE_OUT, fl_MouseOverHandler_0); function fl_MouseOverHandler_0(even

  • Can you upgrade the wifi card and if you can how much will it cost

    hi i just got a macbook not the pro its the white one and i find it has  a hard time grabbing my wifi and i know its the wifi card because i have 2 iphones and ipod touch and 2 laptops not including my macbook and all of them have no trouble holding