Concept explainers
Every complete statement ends with a __________.
- a. period
- b. parenthesis
- c. semicolon
- d. ending brace
The complete statement ends with “semicolon (“;”)”.
Hence, the correct answer is option “C”.
Explanation of Solution
Semicolon (;):
Semicolon is a type of command in Java.
- The semicolon is used to indicate to the compiler that the command ends here.
- Semicolon is used as delimiter in Java to intentionally separate a command from the following Java command.
- If a semicolon is missed in any of the statements, then the program produces an error.
Example for the purpose of Semicolon (;):
//Declare and initialize the variables
double value1 = 28;
double value2 = 32;
double value3 = 37;
The above three variable declaration statements are all individual commands separated by the semicolon.
Explanation for incorrect options:
a. Period:
Period is used differentiate an integer value and decimal value, the value with the period is considered as decimal value.
Hence, the option “A” is wrong.
b. Parentheses:
Parentheses are the symbol used to group the statements in if statement, loop or any other control structures.
Hence, the option “B” is wrong.
d. Ending brace:
Braces are used to represent a block of code, ending brace represents that the block of code ends there.
Hence, the option “D” is wrong.
Want to see more full solutions like this?
Chapter 2 Solutions
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Additional Engineering Textbook Solutions
Java How To Program (Early Objects)
Starting out with Visual C# (4th Edition)
Starting Out with C++ from Control Structures to Objects (8th Edition)
Starting Out with Java: Early Objects (6th Edition)
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Starting Out With Visual Basic (7th Edition)
- 4. During each summer, John and Jessica grow vegetables in their backyard and buy seeds and fertilizer from a local nursery. The nursery carries different types of vegetable fertilizers in various bag sizes. When buying a particular fertilizer, they want to know the price of the fertilizer per pound and the cost of fertilizing per square foot. The following program prompts the user to enter the size of the fertilizer bag, in pounds, the cost of the bag, and the area, in square feet, that can be covered by the bag. The program should output the desired result. However, the program contains logic errors. Find and correct the logic errors so that the program works properly. // Logic errors. #include #include using namespace std; int main() { double costs double area; double bagsize; cout > bagsize; cout > cost; cout > area; cout << endl; cout << "The cost of the fertilizer per pound is: $" << bagsize / cost << endl; cout << "The cost of fertilizing per square foot is: $" << area / cost << endl; return 0; }arrow_forwardThe Problem__: Write a program that calculates the average of a group of test scores, where the lowest score in the group is dropped. It should use the following functions: ⚫ void getScore() should ask the user for a test score, store it in a reference param- eter variable, and validate it. This function should be called by main once for each of the five scores to be entered. ⚫ void calcAverage() should calculate and display the average of the four highest scores. This function should be called just once by main and should be passed the five scores. ⚫int findLowest() should find and return the lowest of the five scores passed to it. It should be called by calcAverage, which uses the function to determine which of the five scores to drop. Input Validation: Do not accept test scores lower than 0 or higher than 100. YOU MUST USE THE STATED FUNCTIONS AND COMPLETE Input VALIDATION. **DO NOT use an ARRAY OR GLOBAL VARIABLES!!. you MUST USE function prototyping TEST THE FUNCTION TWICE.…arrow_forwardThe false statements are always executed using________arrow_forward
- c# Danielle, Edward, and Francis are three salespeople at Holiday Homes. Write an application named HomeSales that prompts the user for a salesperson initial (D, E, or F) input as a string. Either uppercase or lowercase initials are valid. While the user does not type Z, continue by prompting for the amount of a sale. Issue the error message "Sorry - invalid salesperson" for any invalid initials entered. Keep a running total of the amounts sold by each salesperson. After the user types Z or z for an initial, display each salesperson’s total, a grand total for all sales, and the name of the salesperson with the highest total unless there is a tie. If there is a tie, indicate this in the program's output with the message: "There was a tie". An example of the program is shown below: Enter a salesperson initial >> D Enter amount of sale >> 10 Enter next salesperson intital or Z to quit >> d Enter amount of sale >> 2 Enter next salesperson intital or Z to quit…arrow_forwardThe ___________iteration statement specifies that a statement or group of statements is to be executed repeatedly while some condition remains true.arrow_forwardi uploaded the screenshot please help me to do pseudocode And do flowchart should be in c++arrow_forward
- I.4. Usually a _________ indicates to a program the end of a data structure. a) backslash characterb) forward slash characterc) null referenced) null pointerarrow_forwardThe _________ function returns true if the character argument is uppercase.arrow_forwardI need answer in C programming Language Create a program that checks if a password and the repeated confirmation password match according to the following criteria: The password must be at least 8 characters long. The password and confirmed password must match. The password must include at least 1 lowercase character. The password must include at least 1 uppercase character. The password must include at least 1 number. The password must include 1 of the following special characters: ! @ # $ ? In your code, create a function which accepts two character arrays representing the password and repeated password. If the password entered does not meet the requirements listed above, the function should return 1. If the password meets all the requirements, return 0. In main, print a statement indicating the result after the password checking function is called. Other Requirements Your code must use consistent formatting and spacing. Points will be taken off for inconsistent or sloppy code.…arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning