TAILIEUCHUNG - Lecture Introduction to Java programming - Chapter 2: Elementary programming

In the preceding chapter, you learned how to create, compile, and run a Java program. Starting from this chapter, you will learn how to solve practical problems programmatically. Through these problems, you will learn Java primitive data types and related subjects, such as variables, constants, data types, operators, expressions, and input and output. | Chapter 2 Elementary Programming Motivations In the preceding chapter, you learned how to create, compile, and run a Java program. Starting from this chapter, you will learn how to solve practical problems programmatically. Through these problems, you will learn Java primitive data types and related subjects, such as variables, constants, data types, operators, expressions, and input and output. Objectives To write Java programs to perform simple calculations (§). To obtain input from the console using the Scanner class (§). To use identifiers to name variables, constants, methods, and classes (§). To use variables to store data (§§). To program with assignment statements and assignment expressions (§). To use constants to store permanent data (§). To declare Java primitive data types: byte, short, int, long, float, double, and char (§§). To use Java operators to write numeric expressions (§§–). To display current time (§). To use short hand operators (§). To cast value of one type to another type (§). To compute loan payment (§). To represent characters using the char type (§). To compute monetary changes (§). To represent a string using the String type (§). To become familiar with Java documentation, programming style, and naming conventions (§). To distinguish syntax errors, runtime errors, and logic errors and debug errors (§). (GUI) To obtain input using the JOptionPane input dialog boxes (§). Introducing Programming with an Example Listing Computing the Area of a Circle This program computes the area of the circle. ComputeArea Run IMPORTANT NOTE: To enable the buttons, you must download the entire slide file and unzip the files into a directory (., c:\slide) . Trace a Program Execution public class ComputeArea { /** Main method */ public static void main(String[] args) { double radius; double area; // Assign a radius radius = 20; // Compute area area =

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.