欢迎访问24帧网!

Starting Out with Java: From Control Structures through Objects 6th Edition by Tony Gaddis Solution

分享 时间: 加入收藏 我要投稿 点赞
Starting Out with Java - From Control Structures through Objects
Answers to Review Questions
 
Chapter 1
 
Multiple Choice
1. b
2. d
3. a
4. c
5. b
6. b
7. c
8. d
9. a
10. b
11. a
12. c
13. b
14. d
 
Find the Error
 
1.         The algorithm performs the math operation at the wrong time. It multiplies width by length before getting values for those variables.
 
Algorithm Workbench
 
1.    Display "What is the customer's maximum amount of credit?"
       Input maxCredit.
       Display "What is the amount of credit used by the customer?"
       Input creditUsed.
       availableCredit = maxCredit – creditUsed.
       Display availableCredit.
 
2.   Display "What is the retail price of the item?"
       Input retailPrice.
       Display "What is the sales tax rate?"
       Input taxRate.
       salesTax = retailPrice * taxRate.
       total = retailPrice + salesTax.
       Display salesTax.
       Display total.
 
3.   Display "What is the account's starting balance?"
       Input startingBalance.
       Display "What is the total amount of the deposits made?"
       Input deposits.
       Display "What is the total amount of the withdrawals made?"
       Input withdrawals.
       Display "What is the monthly interest rate?"
       Input interestRate.
       balance = startingBalance + deposits – withdrawals.
       interest = balance * interestRate.
       balance = balance + interest.
       Display balance.
 
Predict the Result
 
1.    7
2.    28
 
Short Answer
 
1.        Main memory, or RAM, holds the sequences of instructions in the programs that are running and the data those programs are using. Main memory, or RAM, is usually volatile. Secondary storage is a type of memory that can hold data for long periods of time—even when there is no power to the computer.
2.   RAM is usually volatile.
3.         An operating system is a set of programs that manages the computer’s hardware devices and controls their processes. Windows and UNIX are examples of operating systems. Application software refers to programs that make the computer useful to the user. These programs solve specific problems or perform general operations that satisfy the needs of the user. Word processing, spreadsheet, and database packages are all examples of application software.
4.        Because the computer is only capable of directly processing machine language instructions.
5.         Because machine language programs are streams of binary numbers, and high-level language programs are made up of words.
6.   A file that contains source code, which is the code written by the programmer.
7.        Syntax errors are mistakes that the programmer has made that violate the rules of the programming language. Logical errors are mistakes that cause the program to produce erroneous results.
8.        An algorithm is a set of well-defined steps for performing a task or solving a problem.
9.   A program that translates source code into executable code.
10.      An application is a stand-alone program that runs on your computer. An applet is designed to be transmitted over the Internet from a Web server, and then executed in a Web browser.
11.        Because the browser executes them in a restricted environment.

精选图文

221381