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
MyLab Programming with Pearson eText -- Access Code Card -- for Starting Out with Java: From Control Structures through Objects
Additional Engineering Textbook Solutions
Starting Out With Visual Basic (8th Edition)
Modern Database Management
Java: An Introduction to Problem Solving and Programming (8th Edition)
Web Development and Design Foundations with HTML5 (8th Edition)
SURVEY OF OPERATING SYSTEMS
Starting Out with C++ from Control Structures to Objects (9th 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_forwardProgramming Assignment: Car Repair For this programming assignment, create a car repair program that prompts the user to enter information about a customer, the customer's vehicle, and the work performed on the customer's vehicle. Your program should then display the final car repair bill on the computer screen. Your program should accomplish the following: 1. Prompt the user to enter the following information: a. Information about the customer (name, street address, city, state, zip code, phone number). b. Information about the customer's vehicle (make, model, year). c. Information about the work performed (brief description, labor hours needed, cost of parts). 2. Use a labor cost amount of $100.00 per hour and a sales tax rate of 7.0%. 3. Calculate the following: Variable subtotal sales tax total repair bill amount Formula subtotal = labor cost per hour * number of labor hours sales tax = sales tax rate * subtotal total repair bill amount = subtotal + sales tax 4. A screen shot of a…arrow_forwardc# 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_forward
- For an if statement to conditionally execute a group of statements, the statements must be enclosed in a set of __________.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
- Every statement ends with a(n)____________arrow_forward10. 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_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_forwardPrograming language is C# 6. Hospital Charges Create an application that calculates the total cost of a hospital stay. The daily base charge is $350. The hospital also charges for medication, surgical fees, lab fees, and physical rehab. The application should accept the following input: • The number of days spent in the hospital • The amount of medication charges • The amount of surgical charges • The amount of lab fees • The amount of physical rehabilitation charges Create and use the following value-returning methods in the application: • CalcStayCharges—Calculates and returns the base charges for the hospital stay. This is computed as $350 times the number of days in the hospital. • CalcMiscCharges—Calculates and returns the total of the medication, surgical, lab, and physical rehabilitation charges. • CalcTotalCharges—Calculates and returns the total charges.arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning