Answer:
Program Comments
Explanation:
program comments are explanations. They are not executable code and the can actually appear anywhere in your code. Their main function is code documentation for the future. In Java programming language for example three types of comments is used. These are
// Single line comments (This starts with two forward slashes
/* Multiple Line
comment
Style*/
The third is the javadoc that gives a description of a function. I looks like the multiple line but is has two asterics
/** This is javadoc
comment
style*/
Answer:
- import java.util.Scanner;
-
- public class Main {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- System.out.print("Input total sales of month: ");
- double totalSales = input.nextDouble();
-
- double stateTax = totalSales * 0.04;
- double countyTax = totalSales * 0.02;
- double totalSalesTax = stateTax + countyTax;
-
- System.out.println("County Tax: $" + countyTax);
- System.out.println("State Tax: $" + stateTax);
- System.out.println("Total Sales Tax: $" + totalSalesTax);
- }
- }
Explanation:
Firstly, create a Scanner object and prompt user to input total sales of month (Line 5-7). Next, apply the appropriate tax rate to calculate the state tax, county tax (Line 9 - 10). Total up the state tax and county tax to get the total sales tax (Line 11).
At last, print the county tax, state tax and the total sales tax (Line 13 - 15).
Answer:
Option (D) using the private access specifier on the class fields
Explanation:
- The private access modifier can be used to hide the data.
- Methods and data variables ( fields ) can be declared with the private access modifier.
- Data hiding is a OOPS Concept which can be achieved with the private keyword (private access modifier).
- The access modifiers are of types Public, Private, Protected and Default ( no access modifier - no need to explicitly specify the default keyword).
- Data hiding means to hide the data, the data is contained in the class variables.So, option (d) using private access modifier on the class fields is correct option.
- Option (A) is wrong as the using the public access modifier doesn't hide anything. It is public and is visible to the public.
- Option (B) is wrong as using the private access modifier on the methods means it is hiding the implementation of the methods not the data.
- Option (C) is wrong as using private access modifiers on class definition means making the classes not visible to other classes it doesn't mean data hiding as the data is contained in the class variables.
Answer:
A.
Explanation:
Mark Brainliest if correct!