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 Data Structures (4th Edition) (What's New in Computer Science)
Additional Engineering Textbook Solutions
Starting Out With Visual Basic (8th Edition)
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Modern Database Management
Database Concepts (7th Edition)
Starting Out with Programming Logic and Design (4th Edition)
Computer Systems: A Programmer's Perspective (3rd 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_forwardi uploaded the screenshot please help me to do pseudocode And do flowchart should be in c++arrow_forward
- 10. The assignment operator has a very _____ priority and it associates from _____. a) high, right to left b) low, left to right c) high, left to right d) low, right to leftarrow_forwardC#: Please helparrow_forwardI.4. Usually a _________ indicates to a program the end of a data structure. a) backslash characterb) forward slash characterc) null referenced) null pointerarrow_forward
- I 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_forwardq → r r Therefore, q. -- This is an example of a _______ statement.arrow_forwardA group of statements, such as the body of a function, must be enclosed in__________.arrow_forward
- Computer Fundamentals and Programming 2 Write a program that determines a student’s grade. The program will accept 3 scores and computes the average score. Determine the grade based on the following rules: - If the average score is equal or greater than 90, the grade is A. - If the average score is greater than or equal to 70 and less than 90, the grade is B. - If the average score is greater than or equal to 50 and less than 70, the grade is C. - If the average score is less than 50, the grade is F. Source Codes and Print Screen of the Outputarrow_forwardThis question is for Chapter 5 programming exercise 5arrow_forwardExercise I- Medicine Write a program that asks the user to enter the name of the medicine (t for ThroX, f for FeliX), his mass. The user should enter as well if he has a prescription or not. The program will calculate the dosage using: age and his ThroX without prescription -The max dosage should be 0.75 mL -The dosage = mass / 150 -The number of pills per day to take is 1 ThroX with prescription -The dosage =mass * 3 / 150 -The number of pills per day to take is 5 FeliX with prescription -The dosage = 0.77 mL FeliX without prescription -The dosage should be between 0.3 and 0.7 -The dosage = mass * 0.009 -The number of pills per day to take is 2 -The number of pills per day to take is 6 The program should display the dosage and the number of pills to be taken per day if the requirements are full filled, otherwise it display "Please check your doctor for a prescription". In case the medicine does not exist in the database, the program display “Your medicine is not in our database!"…arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning