This repository was archived by the owner on May 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Chapter 2
chyneyee edited this page May 8, 2022
·
5 revisions
Figure No. | Description | Filename |
---|---|---|
Fig. 2.1 | Text-printing program. | Welcome1.java |
Fig. 2.3 | Printing a line of text with multiple statement. | Welcome2.java |
Fig. 2.4 | Printing multiple lines of text with a single statement. | Welcome3.java |
Fig. 2.6 | Printing multiple lines in a dialog box. | Welcome4.java |
Fig. 2.7 | Addition program that displays the sum of two numbers. | Addition.java |
Fig. 2.15 | Compare integers using if statements, relational operators and equality operators. | Comparison.java |
Exercise No. | Description | Filename |
---|---|---|
Exercise 2.10 | Write an application that displays the number 1 to 4 on the same line, with each pair of adjacent numbers separated by one space. | Exercise0210.java |
Exercise 2.11 | Write an application that asks the user to enter two integers, obtains them from the user and prints their sum, product, difference and quotient (division). | Exercise0211.java |
Exercise 2.12 | Write an application that asks the user to enter two integers, obtains them from the user and displays the larger number followed by the words "is larger". If the numbers are equal, print the message "These numbers are equal". | Exercise0212.java |
Exercise 2.13 | Write an application that inputs three integers from the user and displays the sum, average, product, smallest and largest of the numbers. | Exercise0213.java |
Exercise 2.19 | Write an application that reads five integers, determines and prints the largest and smallest integers in the group. | Exercise0219.java |
Exercise 2.20 | Write an application that reads an integer and determines and prints whether it is odd or even. | Exercise0220.java |
Exercise 2.21 | Write an application that reads two integers, determines whether the first is a multiple of the second and prints the result. | Exercise0221.java |
Exercise 2.22 | Write an application that inputs from the user the radius of a circle as an integer and prints the circle's diameter, circumference and area using the floating-point value 3.14159 for π. | Exercise0222.java |
Exercise 2.23 | Write an application that inputs one number consisting of five digits from the user, separates the number into its individual digits and prints the digits separated from one another by three spaces each. | Exercise0223.java |
Exercise 2.24 | Using only the programming techniques you learned in this chapter, write an application that calculates the squares and cubes of the numbers from 0 to 10 and prints the resulting values in table format | Exercise0224.java |
Exercise 2.25 | Write a program that inputs five numbers and determines and prints the number of negative numbers input, the number of positive numbers input and the numbers of zeros input. | Exercise0225.java |