zawhtooaung(ddoocp)

Upload: robby-chris

Post on 03-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/28/2019 ZawHtooAung(DDOOCP)

    1/2

    Exercise 1Describe what is meant by a computer program.A piece of software containing statements and commands that tell the computer toperform a task or function.Exercise 2

    Describe the advantages for the programmer of a context sensitive editor.users can quickly find information about how to be most effective, which will increase

    their satisfaction with your tools.Exercise 3Explain the advantages of Graphical User Interfaces as compared with text based

    interfaces.1) Windows 2) Icons 3) Menus 4) Pointer The biggest difference is that CLI don't use

    graphics.. Also in CLI you manually have to enter the command whereas in GUI you

    may have buttons and menu.. CLI does not supports Mouse..A graphical user interface uses graphics, such as pictures and icons the user can select(eg click on) to run commands. A command-line interface has a space or line on which

    text based inputs (commands for the computer) can be typed, so the user must haveexisting knowledge of valid commands.Exercise 4Describe what is meant by a Class in the Java programming language.In the real world, you'll often find many individual objects all of the same kind. There may

    be thousands of other bicycles in existence, all of the same make and model. Eachbicycle was built from the same set of blueprints and therefore contains the same

    components. In object-oriented terms, we say that your bicycle is an instance of theclass of objects known as bicycles. A class is the blueprint from which individual objects

    are created.Exercise 5Distinguish between a Class and an Object.A class is basically a definition, and contains the object's code. An object is an instanceof a class. For instance, there is one java.lang.String class, but you can instantiate any

    number of distinct java.lang.String objects (instances). While a class defines the

    instance variables than an object has, the instantiated object itself actually containsthose variables. So to put it simply: An object is an instance of a class.

  • 7/28/2019 ZawHtooAung(DDOOCP)

    2/2

    Exercise 6Illustrate how variables are declared in a Java Program.To declare a variable in Java, all that is needed is the data type followed by the variablename: For example byte nextInStream;short hour; long totalNumberOfStars; float reactionTime; double itemPrice;Exercise 7Illustrate two methods that could be applied to a string variable.Method1: char charAt(int index) Returns the character at the specified index.Method2: int compareTo(Object o) Compares this String to another Object.Exercise 8Produce a Java project that would display a useful conversion table to compare fourcurrenciespublic class TodayCurrency

    { public static void main( String args [])

    { System.out.println("1 USD = 855.49 KS");System.out.println("1 SGD = 700.93 KS");System.out.println("1 GBP = 1089.12 KS");

    System.out.println("1 CNY = 137.28 KS"); }}