AP Java Assignment 1

  1. Write an applet to solve the math expressions shown below.
  2. The program must store each calculated result in an appropriate variable.
  3. The program must print out the math expression and results as follows:
    
    2 + 3 = 5
    17 % 4 = 1
  4. The program will display and solve the following problems:
    
    4 + 9               
    46 / 7              
    46 % 7              
    2 * 3.0             
    (double)25 / 4
    (int) 7.75 + 2
    (int) 'P'
    (char)105
  5. The code will look something like this:
    
    int nAnswer = 4 + 9;
    g.drawString("4 + 9 = " + nAnswer, 20, 20);
  6. Print out all the constants listed in the slide "Wrapper class constants". For example:
    
    g.drawString("The largest value of type int = " + Integer.MAX_VALUE, 20,40);
    
  7. Send your Java code to mrsimon@lycos.com. Make sure that your name, class and assignment are in comments of the code as well as on the subject line of the email. Include the URL of your completed applet.