Can someone check this?

Hi Everyone,
I'm just wondering if these two classes Movie and Viewer and the Application class look right for what I've done so far for the following problem. Any comments are greatly appreciated.
Also, using if statements, how am I going to check if the user is actually permitted to see the film and in what class will I put it in?
Using a class to represent each of the major entities involved and an application class which controls object and user interaction.
Write a program which implements a cinema entry system, according to the following rules:
Anyone can go to see a U rated film.
Only those aged 12 or over, or accompanied by an adult can go to see a PG rated film.
Only those aged 12 or over can go to see a 12s rated film.
Only those aged 15 or over can go to see a 15s rated film.
Only those aged 18 or over can go to see an 18s rated film.
Your program should present the user with the following list of film options:
(a) Blair Witch Project, 18s
(b) American Pie, 15s
(c) Lord of the Rings, 12s
(d) It?s a Wonderful Life, PG
(e) Aladdin, U
The program should ask the user what film they want to see, and then determine whether or not they are permitted to see the film. If they are not permitted, then
a list of the films they can see will be displayed.
Thanks,
A novice Java programmer
public class Movie
private final int EIGHTEEN = "18";
private final int FIFTEEN = "15";
private final int TWELVE = "12";
private final String PG = "PG";
private final String U = "U";
private String title; //title of the movie
private String rating; //rating of the movie
private Boolean isAcompaniedByAdult; //if viewer is accompanied by an adult
public Movie (String t, String r)
title = t;
rating = r;
//Method to get the title of the movie
public String getTitle()
return title;
//Method to set the title of the movie
public void setTiltle(String t)
title = t;
//Method to get the rating of the movie
public String getRating()
return rating;
//Method to set the rating of the movie
public void setRating(String r)
rating = r;
public class Viewer
//age of the viewer
private int age;
private boolean isWithAdult;
public Viewer (int a, boolean w)
age = a;
isWithAdult = w;
//Method to get the age of the viewer
public int getAge()
return age;
//Method to set the age of the viewer
public void setAge(int a)
age = a;
//Method for if the viewer is with an adult
public boolean isWithAdult(Viewer v1)
if (isWithAdult(v1))
     return true;
else
     return false;
public class CinemaApp
public static void main(String [] args)
int Movie;
int Age;
Boolean isWithAdult;
System.out.println();
System.out.println("Welcome to the Cinema Entry Program");
System.out.println();
System.out.println("Movies Currently Available to View:");
System.out.println("1. Blair Witch Project, 18s");
System.out.println("2. American Pie, 15s");
System.out.println("3. Lord of the Rings, 12s");
System.out.println("4. It's a Wonderful Life, PG");
System.out.println("5. Aladdin, U");
System.out.println();
do
     Movie = Input.readInt("Please enter the number which corresponds to the movie you wish to view: ");
while ((Movie<1) || (Movie>12));
if (Movie == 1)
     Movie m1 = new Movie("Blair Witch Project","18s");
else if (Movie == 2)
     Movie m1 = new Movie("American Pie","15s");
else if (Movie == 3)
     Movie m1 = new Movie("Lord of the Rings","12s");
else if (Movie == 4)
     Movie m1 = new Movie("It's a Wonderful Life","PG");
else if (Movie == 5)
     Movie m1 = new Movie("Aladdin","U");
Viewer v1 = new Viewer(Input.readInt("Please enter your age: "), Input.readBoolean("Are you acompanied by an adult? (y/n): "));

There are a few things I don't quite understand. I'd love to explain!
Why would you declare and initialise the ratings in the
movie class if your using them in the viewer class.First, a little clarification: those ratings are static final variables. This means that, no matter how many instances of Movie you make, there is only one set of those ratings. If you've ever used enumerations in C++, it's a way of simulating those. In effect, it makes the logic easier and more efficient. Basically, NEVER refer to a rating by it's int value (don't use "1" instead of "RATED_U"). Anytime you want to refer to the rating 15s, always use Movie.RATED_18S.
Why did I put them in the Movie class? Because the rating is a property of a Movie, not a Viewer. Thus, the rating should be kept in the Movie class.
Basically, look at my suggestions as a lesson in some principles of Object Oriented design. You don't want to make the rating a String, because of the following case:
Using this as the variable declaration for the ratings:
private final String U = "U";
//etc...What if someone tried to assign "R" as the rating for a movie? They would be able to, because there are no control structures on what a String can be. If you use static final variables, however, they're given a set list of values they can assign as a rating.
This methodology is used commonly in the Java APIs (for example, MimeMessage.RecipientType.TO). It's a good practice, and in this program, it would simplify the logic greatly.
Secondly, I don't understand this if(this.getAge()
= 12 || this.isWithAdult()), what is gt?
"this" refers to the current instance of the class. It's not actually necessary in this context. You could just as easily replace those lines with if(getAge() >=12 || isWithAdult())
ThanksAnytime! This stuff I've thrown at you isn't exactly basic programming... if it's still unclear, feel free to ask more questions.

Similar Messages

  • Can someone check this code?

    What I am trying to achieve is an "active" button state. I
    have six buttons. When one is clicked, i need it to change to a
    color which denotes that it is the active button.
    someone provided me with this code, but I can't seem to get
    it to work. I followed the directions precisely.
    The directions were as follows:
    One thing I think you could do is create another invisible
    layer of buttons above all your other buttons. You could make them
    all invisible, unless a button is clicked.
    Let's say your original layer of buttons is called a_but,
    b_but, and c_but.
    Then you could have another invisible layer of buttons called
    invA_but, invB_but, and invC_but. This layer of buttons would each
    be the color you want displayed while the button is selected. The
    code would look something like-
    invA_but._visible=false;
    invB_but._visible=false;
    invC_but._visible=false;
    a_but.onRelease=function(){
    invA_but._visible=true;
    invB_but._visible=false;
    invB_but._visible=false;
    b_but.onRelease=function(){
    invA_but._visible=false;
    invB_but._visible=true;
    invC_but._visible=false;
    c_but.onRelease=function(){
    invA_but._visible=false;
    invB_but._visible=false;
    invC_but._visible=true

    invA_but, invB_but, and invC_but refer to instance names for
    your buttons, not layer names as suggested in the description. It
    should work if you have the instance names for the buttons right. I
    would probably add code to make the nomal state invisible instead
    of just having the active button covering the inactive one. EX:
    a_but.onRelease=function(){
    invA_but._visible=true; //show the buttons active state
    a_but._visible = false; //hide the off state of the button
    invB_but._visible=false; //hides the active state of button b
    invC_but._visible=false; //hides the active state of button c

  • PKGBUILD for swiftfox: can someone check this for me?

    I just finished my first PKGBUILD, one for swiftfox. Its pre-compiled, so essentially I just dumped all the contents of a tarball into a directory in /opt. If you guys could check it out before I submit it to the aur, I'd really appreciate it.
    pkgname=swiftfox
    pkgver=1.5.0.3
    pkgrel=1
    _pkgarch=athlon-xp
    pkgdesc="Swiftfox is a prebuilt version of Firefox,optimized for AMD AthlonXP processors"
    url="http://www.getswiftfox.com"
    license="MPL"
    depends=(gtk2 libidl2 mozilla-common nss desktop-file-utils)
    makedepends=()
    conflicts=()
    replaces=()
    backup=()
    install=('swiftfox.install')
    source=(http://www.getswiftfox.com/builds/releases/$pkgname-$pkgver-$_pkgarch.tar.bz2)
    md5sums=('d3b810d27f655c4908bcd4c7730d9427')
    build() {
    cd $startdir/src/
    mkdir $startdir/pkg/opt/
    cp -r $pkgname $startdir/pkg/opt/$pkgname
    and here is the swiftfox.install file
    # arg 1: the new package version
    pre_install() {
    /bin/true
    # arg 1: the new package version
    post_install() {
    ln -s /opt/swiftfox/swiftfox /usr/bin/swiftfox
    /bin/true
    # arg 1: the new package version
    # arg 2: the old package version
    pre_upgrade() {
    /bin/true
    # arg 1: the new package version
    # arg 2: the old package version
    post_upgrade() {
    /bin/true
    # arg 1: the old package version
    pre_remove() {
    /bin/true
    # arg 1: the old package version
    post_remove() {
    rm /usr/bin/swiftfox
    /bin/true
    op=$1
    shift
    $op $*
    Edit1: added dependencies

    Allright, you do have a point about having something in the title, so I've added that, and I've also added to the description. Unless there are any more suggestions, I'll put this into the aur tonight.
    pkgname=swiftfox-amd
    _pkgname=swiftfox
    pkgver=1.5.0.3
    pkgrel=1
    _pkgarch=athlon-xp
    pkgdesc="Swiftfox is a prebuilt version of Firefox,optimized for AMD AthlonXP processors. To install the build for a different architecture, go to getswiftfox.com, find the name they use for your processor, and replace the _pkgarch variable."
    url="http://www.getswiftfox.com"
    license="MPL"
    depends=(gconf libgnomecanvas nss mozilla-common desktop-file-utils libidl2)
    makedepends=()
    conflicts=()
    replaces=()
    backup=()
    install=
    source=(http://www.getswiftfox.com/builds/releases/$_pkgname-$pkgver-$_pkgarch.tar.bz2)
    md5sums=('d3b810d27f655c4908bcd4c7730d9427')
    build() {
    cd $startdir/src/
    mkdir $startdir/pkg/opt/
    cp -r $_pkgname $startdir/pkg/opt/$_pkgname
    mkdir -p $startdir/pkg/usr/bin
    ln -s /opt/$_pkgname/$_pkgname $startdir/pkg/usr/bin/$_pkgname

  • I am updating iphoto 9.1 to 9.3 and every time when I clicked for update aps store asked to open it in the account where you purchased. I am using the same account and its available in the purchased item of this account. Can someone resolve this problem.

    I am updating iphoto 9.1 to 9.3 and every time when I clicked for update aps store asked to open it in the account where you purchased. I am using the same account and its available in the purchased item of this account. But in my purchased item library it indicates that you update iPhoto. I am not sure which account the aps store asking. Can someone resolve this problem.

    Contact App Store support. They're the folks who can help with Account issues.
    Regards
    TD

  • Hi can someone keep this simple for me! my iPhone is due for a renewal. but my old laptop that it is backed up to no longer works! how do i go about saving all my songs pics etc to a new laptop without losing anything? please help!!!

    hi can someone keep this simple for me! my iPhone is due for a renewal. but my old laptop that it is backed up to no longer works! how do i go about saving all my songs pics etc to a new laptop without losing anything? please help!!!

                     Syncing to a "New" Computer or replacing a "crashed" Hard Drive

  • Can someone perform this speaker test for me please

    Hi can someone perform this test for please, play some ipod music through your phone and and cover 1 speaker at a time with you finger, does 1 block out the music as if one speaker is much louder than the other ? just I have tried this on my new iphone 4 as thought it might be a problem but my 3GS is doing it to ??, is it fault or meant to be like that

    There's only one speaker.
    http://manuals.info.apple.com/enUS/iPhone_iOS4_UserGuide.pdf

  • Multithreading - Can someone explain this ...

    Hi Java Gurus:
    Can someone explain this to me why my multithreading worked in once case and not in the other.
    First a little background:
    My application lets the user create multiple JInternalFrames. Each frame has an OK button. When the user presses the OK button, the frame goes about it's business in a new thread, thus returning control to the use, so he/she can press the OK button on the second frame .. and so on.
    Following is the event handler for the OK button that creates the new thread:
    case1 - doesn't work:
          btnTranslate.addActionListener(
             new ActionListener() {
                public void actionPerformed( ActionEvent e ) {
                             txtOutput.setText("");
                             txtBadParts.setText("");
                   Translation trans = new Translation(inst);
                   trans.run();
          );case2 - works:
          btnTranslate.addActionListener(
             new ActionListener() {
                public void actionPerformed( ActionEvent e ) {
                             txtOutput.setText("");
                             txtBadParts.setText("");
                       new Translation(inst).start();
          );Thanks,
    Kamran

    Calling the run method makes the run method run in the current thread. You need to call the start method to get the thread to start its own thread.

  • Can someone execute this program?

    Can someone execute this program for me and tell me if it works correctly? My DOS is acting funny.
    look for these things:
    - accepts input from keyboard and places them into an array
    - continues to accept names until a blank name is entered
    - array can contain up to 15 names
    - after all names are entered, it displays the contents of the array
    and writes them to a file
    - output should be in 2 columns
    if you see a problem, please tell me how to fix it.
    import java.io.*;
    * the purpose of this program is to read data from the keyboard
    * and put it into a sequential file for processing by ReadFile
    * @author Maya Crawford
    public class Lab0
    * this function will prompt and receive data from the keyboard
    * @return String containing the data read from the keyboard
    * @param BufferedReader that is connected to System.in
    */ (keyboard)
    public static String getData(BufferedReader infile)
    throws IOException
    System.out.println("enter a name");
    return infile.readLine();
    * this is the main program which will read from the keyboard and
    * display the given input onto the screen and also write the data
    * to a file
    * @param Array of Strings (not used in this program)
    public static void main(String[] args)
    throws IOException
    int i;
    String[] outString = new String[16];
    DataOutputStream output=null;
    // this code assigns the standard input to a datastream
    BufferedReader input= new BufferedReader(new InputStreamReader(System.in));
    // this code opens the output file...
    try
    output= new DataOutputStream(new FileOutputStream("javaapp.dat"));
    // handle any open errors
    catch (IOException e)
    System.err.println("Error in opening output file\n"
    + e.toString());
    System.exit(1);
    // priming read......
    for(i=0;i<outString.length;i++)
    outString=getData(input);
    // this is the loop to continue while nnonblank data is entered
    while (!outString.equals(""))
    for(i=0;i<outString.length;i++)
    outString[i]=getData(input);
    outString[i] = input.readLine();
    System.out.println("Name entered was:"+ outString[i]);
    output.writeBytes(outString[i]+"\r\n");
    int rcol=(outString.length+1)/2;
    for(i=0;i<(outString.length)/2;i++)
    System.out.println(outString[i]+"\t"+outString[rcol++]);
    // flush buffers and close file...
    try
    output.flush();
    output.close();
    catch (IOException e)
    System.err.println("Error in closing output file\n"
    + e.toString());
    // say goodnight Gracie...
    System.out.println("all done");

    Ok, here is what I came up with. I commented most of what I changed and gave a reason for changing it. My changes aren't perfect and it still needs to be tweeked. When you run the program you have to hit the enter key every time once before you type a name. When you are done typing names hit the enter key twice and it will output the names entered into the array. Like I said, it isn't perfect, and that part you will need to fix.
    import java.io.*;
    * the purpose of this program is to read data from the keyboard
    * and put it into a sequential file for processing by ReadFile
    * @author Maya Crawford
    public class Lab0
         * this function will prompt and receive data from the keyboard
         * @return String containing the data read from the keyboard
         * @param BufferedReader that is connected to System.in
         */ //(keyboard)
         //On the above line where you have (keyboard), it wasn't commented out in your
         //program and it was throwing a error.
         public static String getData(BufferedReader infile)
         throws IOException
              System.out.println("enter a name");
              return infile.readLine();
         * this is the main program which will read from the keyboard and
         * display the given input onto the screen and also write the data
         * to a file
         * @param Array of Strings (not used in this program)
         public static void main(String[] args)
         throws IOException
              int i;
              String testString; // Created to hold the string entered by the user, because your
                                 // outString array wasn't working for that.
              String[] outString = new String[16];
              DataOutputStream output=null;
              // this code assigns the standard input to a datastream
              BufferedReader input= new BufferedReader(new InputStreamReader(System.in));
              // this code opens the output file...
              try
                   output= new DataOutputStream(new FileOutputStream("javaapp.dat"));
              // handle any open errors
              catch (IOException e)
                   System.err.println("Error in opening output file\n"
                   + e.toString());
                   System.exit(1);
              // priming read......
              testString = " ";  // Initialize testString
              int placeMark = 0; // to input the String entered by the user into the outString
                                 // array, it needs to know which position to enter it into.
              while (!testString.equals(""))
                   testString=getData(input);
                   testString = input.readLine();
                   System.out.println("Name entered was:"+ testString);
                   // Put the testString into the outString[] array.
                   // A lot of the time when you used outString you forgot to use the [x] to indicate
                   // which position you wanted to access.
                   outString[placeMark] = testString;
                   output.writeBytes(testString+"\r\n");
                   placeMark++;
            // Created a do/while loop to display the list of outString.
              int nextEntry = 0;
              do
                   System.out.println(outString[nextEntry]);
                   nextEntry++;
              }while(!outString[nextEntry].equals(""));
              // flush buffers and close file...
              try
                   output.flush();
                   output.close();
              catch (IOException e)
                   System.err.println("Error in closing output file\n"
                   + e.toString());
              // say goodnight Gracie...
              System.out.println("all done");
    }

  • Can someone translate this vi to LV 5.0?

    Can someone translate this vi to LV 5.0?
    Thanks
    Gorka
    Attachments:
    Write_Table_and_Chart_to_XL.llb ‏240 KB

    Try this one.
    Hope it works!
    Brian
    Attachments:
    Write_Table_and_Chart_to_XL50.llb ‏163 KB

  • Can someone awnser this question please

    '\ my sound card and my tv is digital but my stereo surround system is analogue but my question is.
    how well to the analogue to digital converts work which i can buy for 40 quid.
    will it give me the same quality digital to digital if im using analogue to digital.
    any help will be much apreciated

    +Re: can someone awnser this question pleased
    deebs986 wrote:
    my sound card and my tv is digital but my stereo surround system is analogue but my question is.
    how well to the analogue to digital converts work which i can buy for 40 quid.
    will it give me the same quality digital to digital if im using analogue to digital.
    any help will be much apreciated
    Depends on
    the analog part of A/D Converter and the converter as well ... there are cheap ones which (if you're audiophile)? may give weak results but normally, those are suitable even being that cheap ... you name ones you have in mind to get more exact answers<
    the source ... D to D is : (lossless (theory))? , A to D (lossy (why, ... read above))<
    jutapa
    @9.56.77.37

  • Can someone check test this site to check if the video is Airplay compatible?

    I have a video hosted at http://mgohtml5.appspot.com, which should be Airplay compatible now that Sublime Video has updated their javascript html5 video player to include Airplay support. (Previously, only the audio would stream. For whatever reason, the video wouldn't stream to the AppleTV)
    Problem is I'm out of town and can't check the updated code.
    If anyone with an iOS 4.3 device and an Apple TV 2 could check this out for me, I'd appreciate it.

    that's strange.
    Sublime's player claims to be Airplay compatible; http://docs.sublimevideo.net/releases
    and in the html I wrote for that page included the 'x-webkit-airplay="allow"' in video source. The html is below;
    <head>
    <script type="text/javascript" src="http://cdn.sublimevideo.net/js/shy7bee5.js"></script>
    </head>
    <body>
    <video class="sublime" width="853" height="400" poster="video-poster.jpg" preload="none"> x-webkit-airplay="allow"><source src="http://mgovideo.s3.amazonaws.com/Misc./brady6.mp4" /></video>
    </body>
    </html>
    has anyone been able to successfully share video via Safari in an iOS 4.3 device to an Apple TV 2? If so, what site?

  • CAN SOMEONE FIX THIS????

    Hello, I can't get my program to work at all, I keep getting errors. Can someone please see if they can fix these Exception errors. I've posted tons of topics but I still can't get this program to run.
    I use these text files in the program.
    EVENT.txt
    1 C++ Programmer
    2 Business Management
    STCLASS.txt
    1 Tech Apps
    2 Computer Programming
    3 AP Computer Science
    4 AB Computer Science
    5 AP Biology
    6 AP US History
    STINFO.txt
    34865-Joe Peace-2003-01-02-1-2-3-4-5-6
    89398-John Carr-2003-04-05-1-2-3-4-5-6
    Here is The Actual Program, Can anyone get rid of the Exception Errors:
    //Program Starts Here
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    public class TrivialApplet extends Applet implements ItemListener, ActionListener
         TextField text1;
         CheckboxGroup checkboxgroup1;
         Checkbox checkbox1, checkbox2, checkbox3;
         Button adder;               //Button in addperson()
         Button cpsubmit;          //Button in clienpart()
         Button quit;               //Button in addperson() and search() - Returns to clientpart() when pressed
         Button ssubmit;               //Button in search()
         int where;                    //'Where' is the current position the user is in the program
         int what;                    //'What' is current checkbox that the user has selected
         int searcher;               //What User Is Searching for (ID, Event, Or Class)
         String line;               //'line' is used when a line is taken from a text file
         PrintWriter fileOut;     //Output to textfile Variables
         BufferedReader fileIn1,fileIn2,fileIn3;     //Inputting from textfile variables
         ******************************************** init() *******************************************************************
         public void init()
              what = 0;
              where = 0;
              searcher = 0;
              quit = new Button("Return To Menu");
              clientpart();
         ******************************************** clientpart() *************************************************************
         public void clientpart()
         removeAll();                                             
         setSize(300,200);
         where = 1;
         setLayout(new GridLayout(4,1));                                        //Sets Layout of Screen
         checkboxgroup1 = new CheckboxGroup();                         
         checkbox1 = new Checkbox("Search For A Person",false,checkboxgroup1);                    //Check Box
         checkbox2 = new Checkbox("Enter New Person Into Database",false,checkboxgroup1);
         cpsubmit = new Button("Submit");
         Label info;
         info = new Label("Select An Option And Press Submit", Label.CENTER);
         add(info);
         add(checkbox1);
         add(checkbox2);
         add(cpsubmit);
         checkbox1.addItemListener(this);
         checkbox2.addItemListener(this);
         cpsubmit.addActionListener(this);
         ******************************************** addperson() **************************************************************
         public void addperson() throws IOException
         setSize(400,300);
         PrintWriter fileOut = new PrintWriter(new FileOutputStream("C:/Documents and Settings/Joe/AP Programs/BPA Database/STINFO.TXT", true));
         where = 2;
         removeAll();                                                            //Remove everything from applet
         Label stat;
         stat = new Label("Select A Field, Enter Info, And Click Submit", Label.CENTER);
         setLayout(new GridLayout(5,1));
         add(stat);
         text1 = new TextField("ID-Name-Graduating Year-Event 1-Event 2-Class 1-Class 2-Class 3-Class 4-Class 5-Class 6");//New TextField
         checkboxgroup1 = new CheckboxGroup();                              //A group of checkboxes, allows only ONE click
         adder = new Button("Submit");                                        //Submit button
         add(text1);                                        
         add(adder);
         add(quit);
         adder.addActionListener(this);                                        //Checks for button actions
         quit.addActionListener(this);
         ************************************************** search() ***********************************************************
         public void search() throws IOException
         setSize(400,300);
         /********************************************** Variables to get info from text files *******************************/
         fileIn1 = new BufferedReader(new InputStreamReader(new FileInputStream("C:/Documents and Settings/Joe/AP Programs/BPA Database/STINFO.TXT")));
         fileIn2 = new BufferedReader(new InputStreamReader(new FileInputStream("C:/Documents and Settings/Joe/AP Programs/BPA Database/EVENTS.TXT")));
         fileIn3 = new BufferedReader(new InputStreamReader(new FileInputStream("C:/Documents and Settings/Joe/AP Programs/BPA Database/STCLASS.TXT")));
         where = 3;                                                                 //User Is At Position '3'.....or search()
         searcher = 0;
         removeAll();                                                            //Remove everything from applet
         /************************************* Creates a label that cannot be edited ***************************************/
         Label stats;
         stats = new Label("Click Field You Wish To Search By, And Click Submit", Label.CENTER);
         setLayout(new GridLayout(6,1));                                        //Makes applet a 6x1 Array for objects
         add(stats);
         checkboxgroup1 = new CheckboxGroup();                              //A group of checkboxes, allows only ONE click
         ssubmit = new Button("Submit");                                        //Submit button
         checkbox1 = new Checkbox("ID",false,checkboxgroup1);          //Sets The First Checkbox into checkboxgroup1
         add(checkbox1);                                                            //Add this to window
         checkbox2 = new Checkbox("Event",false,checkboxgroup1);               
         add(checkbox2);
         checkbox3 = new Checkbox("Class",false,checkboxgroup1);
         add(checkbox3);
         add(ssubmit);
         add(quit);
         /*********************************************** Calls itemStateChanged() when clicked ***************************/
         checkbox1.addItemListener(this);                                   
         checkbox2.addItemListener(this);
         checkbox3.addItemListener(this);
         ************************************************ Cals actionPerformed() when clicked *****************************/
         ssubmit.addActionListener(this);
         quit.addActionListener(this);
         ******************************************** actionPerformed() ********************************************************
         public void actionPerformed(ActionEvent e)
              /************************ clientpart() buttons **********************************************************/
              if (e.getSource() == cpsubmit && what == 1)               //If User wants to search for a person then search()
                   search();
              if (e.getSource() == cpsubmit && what == 2)               //If User wants to Add A New Person then addperson()
                   addperson();               
              /************************ quit button returns to clientpart() *******************************************/
              if (e.getSource() == quit)                                   //If User wants to return to main menu then clientpart()
                   clientpart();
              /************************ addperson() buttons ***********************************************************/
              if (e.getSource() == adder)                                   //Prints New Person To STINFO.txt
                   fileOut.println(text1.getText());
              /************************* search() buttons *************************************************************/
              if (e.getSource() == ssubmit && searcher == 1)          //Shows Everyone In School     
                   while((line=fileIn1.readLine()) != null)
                        System.out.println(line);
              if (e.getSource() == ssubmit && searcher == 2)          //Shows Events With Numbers
                   while((line=fileIn1.readLine()) != null)
                        System.out.println(line);
              if (e.getSource() == ssubmit && searcher == 3)          //Shows Classes With Numbers
                   while((line=fileIn3.readLine()) != null)
                        System.out.println(line);
         ******************************************** itemStateChanged() *******************************************************
         public void itemStateChanged(ItemEvent e)
              /*************************************** Checkboxes in clientpart() *****************************************/
              if (e.getItemSelectable() == checkbox1 && where == 1)               
                   what = 1;
              if (e.getItemSelectable() == checkbox2 && where == 1)
                   what = 2;
              /*************************************** Checkboxes in search() *********************************************/
              if (e.getItemSelectable() == checkbox1 && where == 3)
                   searcher = 1;
              if (e.getItemSelectable() == checkbox2 && where == 3)
                   searcher = 2;
              if (e.getItemSelectable() == checkbox3 && where == 3)
                   searcher = 3;

    An error
    1> exception not caught
    public void actionPerformed(ActionEvent e)
    try{
    <your code>
    catch(Exception ex)
    ex.printStackTrace();
    Explaination: your methods like search() and etc are throwing excpetion but it is not caught so you will have to catch it. The example up here is catching for all but you should tune it a bit to specific exceptions
    A suggestion
    1> your removeall() method is not very nice. Why don't u use card layout and hide the panel instead of removing and adding all again

  • Users report slow performance - how can I check this

    Users are telling me that performance has suddenly become slow.
    Is there someway I can check this is correct, ie. its not just the users perception at a partiluar point in time.
    The system seems to be normal to me.

    hi,
    if someone says suddenly the database performance slow, please check your database host and any particular process takes lot of resource or check the box load or any unusual things happening on the host level.
    if any session id taking lot of resource check what is going on this spid and try to kill or try tune like creating index.
    thanks
    Veera

  • Can someone expland this select ?

    Hello gurus,
    Could someone check if I'm right about this query ?
    select to_char(last_time,'dd-mon-yyyy hh24:mi') as "startup",
    to_char(start_time,'dd-mon-yyyy hh24:mi') as "shutdown",
    round((start_time-last_time)*24*60,2) as "minuts down",
    round((last_time-lag(start_time) over (order by r)),2) as "days up",
    case when (lead(r) over (order by r) is null )
    then round((sysdate-start_time),2)
    end as "Days still up"
    from (
    select r,
    to_date(last_time, 'Dy Mon DD HH24:MI:SS YYYY') last_time,
    to_date(start_time,'Dy Mon DD HH24:MI:SS YYYY') start_time
    from (
    select r,
    line,
    lag(line,1) over (order by r) start_time,
    lag(line,2) over (order by r) last_time
    from (
    select rownum r, line
    from alert_log
    where line like '___ ___ __ __:__:__ 20__'
    or line like 'Starting ORACLE instance %'
    where line like 'Starting ORACLE instance %'
    here is an output
    SHUTDOWN STARTUP MINS_DOWN DAYS_UP DAYS_STILL_UP
    line 1 21-may-2007 23:01 21-may-2007 23:01 0
    line 2 21-may-2007 23:02 21-may-2007 23:02 .05 0
    line 3 21-may-2007 23:04 21-may-2007 23:04 .07 0
    line 4 21-may-2007 23:09 21-may-2007 23:09 0 0
    line 5 22-may-2007 11:02 22-may-2007 11:02 0 .5
    line 6 22-may-2007 19:42 22-may-2007 19:42 0 .36
    line 7 22-may-2007 19:47 22-may-2007 19:47 .1 0
    line 8 22-may-2007 19:50 22-may-2007 19:50 .38 0
    line 9 22-may-2007 19:52 22-may-2007 19:53 1.23 0
    line 10 22-may-2007 19:54 22-may-2007 19:54 .07 0
    line 11 22-may-2007 19:56 22-may-2007 19:56 .05 0
    line 12 28-may-2007 15:30 28-may-2007 15:30 .1 5.81 182.81
    12 rows selected.
    according to the select,
    the shutdown column represents the time the instance was shutdown
    the startup column represents the time the instance has started
    the mins_down column represents the time the instance was unavailable, ex: on the line 9 the instance has been down for 1.23 minuts rigth ?
    the days up I cannot uderstand. look at the last line that shows 5.81 days up but the shutdown and the startup was on the same time. Is this columns referencing the previous line ?
    the days still up columns i guess is the time that the instance had the last startup, correct ?
    I cannot figure out the mins down and days up column
    Can someone help me ?
    Regards
    Message was edited by:
    KeenOnOracle

    Hello gurus,
    Could someone check if I'm right about this query ?
    select to_char(last_time,'dd-mon-yyyy hh24:mi') as "startup",
    to_char(start_time,'dd-mon-yyyy hh24:mi') as "shutdown",
    round((start_time-last_time)*24*60,2) as "minuts down",
    round((last_time-lag(start_time) over (order by r)),2) as "days up",
    case when (lead(r) over (order by r) is null )
    then round((sysdate-start_time),2)
    end as "Days still up"
    from (
    select r,
    to_date(last_time, 'Dy Mon DD HH24:MI:SS YYYY') last_time,
    to_date(start_time,'Dy Mon DD HH24:MI:SS YYYY') start_time
    from (
    select r,
    line,
    lag(line,1) over (order by r) start_time,
    lag(line,2) over (order by r) last_time
    from (
    select rownum r, line
    from alert_log
    where line like '___ ___ __ __:__:__ 20__'
    or line like 'Starting ORACLE instance %'
    where line like 'Starting ORACLE instance %'
    here is an output
    SHUTDOWN STARTUP MINS_DOWN DAYS_UP DAYS_STILL_UP
    line 1 21-may-2007 23:01 21-may-2007 23:01 0
    line 2 21-may-2007 23:02 21-may-2007 23:02 .05 0
    line 3 21-may-2007 23:04 21-may-2007 23:04 .07 0
    line 4 21-may-2007 23:09 21-may-2007 23:09 0 0
    line 5 22-may-2007 11:02 22-may-2007 11:02 0 .5
    line 6 22-may-2007 19:42 22-may-2007 19:42 0 .36
    line 7 22-may-2007 19:47 22-may-2007 19:47 .1 0
    line 8 22-may-2007 19:50 22-may-2007 19:50 .38 0
    line 9 22-may-2007 19:52 22-may-2007 19:53 1.23 0
    line 10 22-may-2007 19:54 22-may-2007 19:54 .07 0
    line 11 22-may-2007 19:56 22-may-2007 19:56 .05 0
    line 12 28-may-2007 15:30 28-may-2007 15:30 .1 5.81 182.81
    12 rows selected.
    according to the select,
    the shutdown column represents the time the instance was shutdown
    the startup column represents the time the instance has started
    the mins_down column represents the time the instance was unavailable, ex: on the line 9 the instance has been down for 1.23 minuts rigth ?
    the days up I cannot uderstand. look at the last line that shows 5.81 days up but the shutdown and the startup was on the same time. Is this columns referencing the previous line ?
    the days still up columns i guess is the time that the instance had the last startup, correct ?
    I cannot figure out the mins down and days up column
    Can someone help me ?
    Regards
    Message was edited by:
    KeenOnOracle

  • I am not able to download any  app on my ipad mini , it shows its loading, but never getting downloaded , can someone fix this for me ???

    i have a ipad mini , ios version 8.3 .... i am not able to download any app currently on my ipad.... i am not able to figure out the problem , it shows the app is loading in app store , but its never getting downloaded....how do i fix this problem ??? can someone please figure it out ???

    Welcome to the Apple Community.
    When your account becomes disabled, Apple provides the following recommendation:
    "This message means that someone tried and failed to sign in to your account multiple times. The Apple ID system disables the account to prevent unauthorized people from gaining access to your information. You need to reset your password, following the instructions at the Apple ID website".
    Visit iForgot.com and follow the instructions there.
    In order to change your Apple ID or password for your iCloud account on your iOS device, you need to delete the account from your iOS device first, then add it back using your updated details. (Settings > iCloud, scroll down and hit "Delete Account")
    Providing you are simply updating your existing details and not changing to another account, when you delete your account, all the data that is synced with iCloud will also be deleted from the device (but not from iCloud), but will be synced back to your device when you login again.
    In order to change your Apple ID or password for your iCloud account on your computer, you need to sign out of the account from your computer first, then sign back in using your updated details. (System Preferences > iCloud, click the sign out button)
    In order to change your Apple ID or password for your iTunes account on your iOS device, you need to sign out from your iOS device first, then sign back in using your updated details. (Settings > store, scroll down and tap your ID)
    If that doesn't help you might try contacting Apple through iTunes Store Support

Maybe you are looking for

  • GetResourceAsStream(String name)  - how to use it?

    I tryed to read from a "res.txt" file some text data. This is a test app: public class ResTest extends MIDlet{      public void startApp(){           try{                InputStream is=new String().getClass().getResourceAsStream("/res.txt");         

  • I am geting errors in my database alert log file ora-12012 and ora 44003

    Hi all, I am using oracle 10g ...10.2.0.1.0 and OS is solaris 10....... i am geting these errors in my database alert log file last two days..i am not geting why it is coming? ORA-12012: error on auto execute of job 8887 ORA-44003: invalid SQL name a

  • ILOM on X4x00 - temperature monitoring snmp, automatic shutdown

    Hello, we run some X4100/X4200 servers. I want to monitor temperatures via ILOM's snmp interface. Unfortunately I get all kind of information with snmpwalk like sensor typ, hysteresis, unit, .... except the current sensor readings. Did anybody succee

  • New player

    This is really stupid. I have been trying to get an answer to a question and I keep getting bumped . How about a phone number to call?

  • Key figure is not displayed in info area

    Hi experts, I have a customer created  key figure. I see it in RSD1 but it is not displayed at any info area. Normally when we create any info object and don't assign any info area, it must be displayed at " Unassigned Nodes ". But it is not displaye