Exam 10: Thinking in Objects

arrow
  • Select Tags
search iconSearch Question
  • Select Tags

What is displayed on the console when running the following program? class Test { Public static void main(String[] args) { Try { System.out.println("Welcome to Java"); Int i = 0; Int y = 2/i; System.out.println("Welcome to Java"); } Catch (RuntimeException ex) { System.out.println("Welcome to Java"); } Finally { System.out.println("End of the block"); } } }

(Multiple Choice)
4.8/5
(30)

Analyze the following program. class Test { Public static void main(String[] args) { Try { String s = "5.6"; Integer.parseInt(s); // Cause a NumberFormatException Int i = 0; Int y = 2 / i; System.out.println("Welcome to Java"); } Catch (Exception ex) { System.out.println(ex); } } }

(Multiple Choice)
4.9/5
(24)

Design and implement classes. Design a class named Person and its two subclasses named Student and Employee. Make Faculty and Staff subclasses of Employee. A person has a name, address, phone number, and email address. A student has a class status (freshman, sophomore, junior, or senior). Define the status as a constant. An employee has an office, salary, and date hired. Define a class named MyDate that contains the fields year, month, and day. A faculty member has office hours and a rank. A staff member has a title. Override the toString method in each class to display the class name and the person's name. Draw the UML diagram for the classes. Write the code for the Student class only.

(Short Answer)
4.9/5
(38)

An attribute that is shared by all objects of the class is coded using ________.

(Multiple Choice)
4.9/5
(35)

Write a program that converts US dollars into Canadian dollars, as shown in the following figure. The program let the user enter an amount in US dollars and display it equivalent value in Canadian dollars when clicking the Convert button. One dollar is 1.5 Canadian dollars. Write a program that converts US dollars into Canadian dollars, as shown in the following figure. The program let the user enter an amount in US dollars and display it equivalent value in Canadian dollars when clicking the Convert button. One dollar is 1.5 Canadian dollars.    Write a program that converts US dollars into Canadian dollars, as shown in the following figure. The program let the user enter an amount in US dollars and display it equivalent value in Canadian dollars when clicking the Convert button. One dollar is 1.5 Canadian dollars.

(Essay)
4.8/5
(41)
Showing 21 - 25 of 25
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)