CSCI 201: Intro to Programming (Java)

Assignment 1.    Due: Mon, Sep 18

Please put your work in directory cs201 on your Linux account before 11:59pm of the day above.

  1. (25 points)   Write a Java program that prints a face, using text characters, hopefully better looking than this one:
       /////
      | o o |
     (|  ^  |)
      | \_/ |
       -----
    

    Name the project Hw1_1

  2. (25 points)   Write a Java program that inputs two integers from the keyboard and determines whether the first is a multiple of the second and prints the result. You can use the keyboard input technique from the KbInput2.java code designed in class.
    Hint: Use the remainder operator.

    Name the project Hw1_2
    Solution

  3. (25 points)   Write a Java program that enters two integers from the keyboard and allows the user to enter a character. If the character is A, add the two numbers. If it is S, subtract the second integer from the first one; if it is M, multiply the integers. Display the results of the arithmetic.
    Hint: Treat the operation codes as a single character strings.

    Name the project Hw1_3
    Solution

  4. (25 points)   Write a Java program that asks a user to enter a radius of a circle (as a floating-point number) and outputs 3 lines to the screen: the circle diameter circle circumference, and circle area.

    Name the project Hw1_4
    Solution