All Matches
Solution Library
Expert Answer
Textbooks
Search Textbook questions, tutors and Books
Oops, something went wrong!
Change your search query and then try again
Toggle navigation
FREE Trial
S
Books
FREE
Tutors
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Hire a Tutor
AI Study Help
New
Search
Search
Sign In
Register
study help
computer science
starting out with java from control structures
Questions and Answers of
Starting Out With Java From Control Structures
What things must be considered when deciding on a data type to use for a variable?
On paper, write a program that will display your name on the first line; your street address on the second line; your city, state, and ZIP code on the third line; and your telephone number on the
What will the following code output? String message = "Have a great day!";System.out.println(message.charAt(5));
Briefly describe the difference between variable assignment and variable initialization.
A car’s miles-per-gallon (MPG) can be calculated with the following formula: MPG = Miles driven / Gallons of gas used Write a program that asks the user for the number of miles driven and
Examine the following program. // This program uses variables and literals.public class BigLittle{ public static void main(String[] args) { int little; int big; little =
These characters mark the beginning of a documentation comment.a. //b. /*c. */d. /**
What will the following code output? String message = "Have a great day!";System.out.println(message.toUpperCase());System.out.println(message);
What is the difference between comments that start with the // characters and comments that start with the /* characters?
Write a program that asks the user to enter three test scores. The program should display each test score, as well as the average of the scores.
What will the following program display on the screen? public class CheckPoint{ public static void main(String[] args) { int number; number =
Which Scanner class method would you use to read a string as input?a. NextStringb. NextLinec. ReadStringd. GetLine
Convert the following pseudocode to Java code. Be sure to declare the appropriate variables. Store 20 in the speed variable.Store 10 in the time variable.Multiply speed by time and store the
Briefly describe what programming style means. Why should your programming style be consistent?
An electronics company sells circuit boards at a 40 percent profit. If you know the retail price of a circuit board, you can calculate its profit with the following formula: Profit = Retail
Which of the following are illegal variable names and why? x99bottlesjuly97theSalesFigureForFiscalYear98r&dgrade_report
Which Scanner class method would you use to read a double as input?a. NextDoubleb. GetDoublec. ReadDoubled. None of these;you cannot read a double with the Scanner class
Convert the following pseudocode to Java code. Be sure to declare the appropriate variables.Store 172.5 in the force variable.Store 27.5 in the area variable.Divide area by force and store the result
Assume that a program uses the named constant PI to represent the value 3.14. The program uses the named constant in several statements. What is the advantage of using the named constant instead of
Write a program that asks the user to enter the name of his or her favorite city. Use a String variable to store the input. The program should display the following:• The number of characters in
Is the variable name Sales the same as sales? Why or why not?
You can use this class to display dialog boxes.a. JOptionPaneb. BufferedReaderc. InputStreamReaderd. DialogBox
Write the code to set up all the necessary objects for reading keyboard input. Then write code that asks the user to enter his or her desired annual income. Store the input in a double variable.
Assume the file SalesAverage.java is a Java source file that contains documentation comments. Assuming you are in the same folder or directory as the source code file, what command would you enter at
Write a program that computes the tax and tip on a restaurant bill. The program should ask the user to enter the charge for the meal. The tax should be 6.75 percent of the meal charge. The tip should
When Java converts a lower-ranked value to a higher-ranked type, it is called a(n) __________.a. 4-bit conversionb. Escalating conversionc. Widening conversiond. Narrowing conversion
Write the code to display a dialog box that asks the user to enter his or her desired annual income. Store the input in a double variable.
An expression adds a byte variable and a short variable. Of what data type will the result be?
Write a program that asks the user for the number of males and the number of females registered in a class. The program should display the percentage of males and females in the class.
How would the number 6.31 × 1017 be represented in E notation?
This type of operator lets you manually convert a value, even if it means that a narrowing conversion will take place.a. Castb. Binaryc. Uploadingd. Dot
Kathryn bought 600 shares of stock at a price of $21.77 per share. She must pay her stockbroker a 2 percent commission for the transaction. Write a program that calculates and displays the
A program declares a float variable named number, and the following statement causes an error. What can be done to fix the error?number = 7.4;
True or False: A left brace in a Java program is always followed by a right brace later in the program.
What values can boolean variables hold?
True or False: A variable must be declared before it can be used.
Write statements that do the following:a) Declare a char variable named letter.b) Assign the letter A to the letter variable.c) Display the contents of the letter variable.
True or False: Variable names may begin with a number.
True or False: You cannot change the value of a variable whose declaration uses the final key word.
Last month Joe purchased some stock in Acme Software, Inc. Here are the details of the purchase: • The number of shares that Joe purchased was 1,000.• When Joe purchased the stock, he paid
Which is a character literal, 'B' or "B"?
True or False: Comments that begin with // can be processed by javadoc.
What is wrong with the following statement? char letter = "Z";
Complete the following table by writing the value of each expression in the Value column. Expression 6 + 3 * 5 12 / 24 9 + 14 2 - 6 * 5 + 19 % 3 - 1 (6+2) * 3 14 9 + 12 (8 - 3) (114) Value ||||
True or False: If one of an operator’s operands is a double, and the other operand is an int, Java will automatically convert the value of the double to an int.
Is the division statement in the following code an example of integer division or floating-point division? What value will be stored in portion? double portion;portion = 70 / 3;
Write statements using combined assignment operators to perform the following: a) Add 6 to xb) Subtract 4 from amountc) Multiply y by 4d) Divide total by 27e) Store in x the remainder of x
Write a statement that declares a String variable named city. The variable should be initialized so it references an object with the string “San Francisco”.
How do you write a single line comment? How do you write a multi-line comment? How do you write a documentation comment?
How are documentation comments different from other types of comments?
What is the purpose of the following types of dialog boxes?Message dialogInput dialog
Write code that will display each of the dialog boxes shown in Figure 2-19.Data in Figure in 2-19 a) Message i Greetings Earthling. ОК b) Input ? Enter a number. OK Cancel
Showing 1200 - 1300
of 1252
1
2
3
4
5
6
7
8
9
10
11
12
13