Question

In: Computer Science

Problem 1) For each of the following sentences, indicate whether it is a language rule that...

Problem 1) For each of the following sentences, indicate whether it is a language rule that is enforced by the Java compiler or a convention (that is, not enforced by the Java compiler but most programmers follow it).

(a) Variable names must begin with a lower-case letter.
(b) The name of a class must match the name of the file containing it.
(c) All variables must be declared.
(d) There must be a space before and after each operator.
(e) All lines after a left curly brace must be indented.
(f) Class names must begin with an upper-case letter.
(g) Every program must begin with comments describing the author of the program and what the program does.

Solutions

Expert Solution

(a) Variable names must begin with a lower-case letter.
In java, variable names must start with lowercase letter,
and first letter of next(second,...) words must be in capital case.
This is the java naming convention rule..

***************************************************************

(b) The name of a class must match the name of the file containing it.
In java, name of the class should be match with file name,
because of .class file generation.

************************************************************

c) All variables must be declared
I
n java, we can not use variables before declaration,
it means variable should decalred first and then it should be used in program,
otherwise java compiler throws error.

******************************************************************

(d) There must be a space before and after each operator.
This is not a java rule.
If we are not giving space before and after operator then also java code compiles successful.

*******************************************************************

(e) All lines after a left curly brace must be indented.
This is not a java rule.
Indentation in code is the recomendation for better understanding of code,
but this is not compulsory in java.

*****************************************************************

(f) Class names must begin with an upper-case letter
This is again java naming convention rule that
class name should be start with upper case letter.

********************************************************************

(g) Every program must begin with comments
describing the author of the program and what the program does

It is recomended..Not compulsory


Related Solutions

1) Solve the following problem graphically. Indicate (a) whether or not the problem is feasible, (b)...
1) Solve the following problem graphically. Indicate (a) whether or not the problem is feasible, (b) whether or not the problem has an optimal solution, and (c) whether or not the problem is unbounded. If there is a unique optimal solution, specify the variable values for this solution. If there are 2 alternative optimal solutions, give the values for three different optimal solutions. max 9x1 + 3x2 s.t. x2 ≤ 125   − x1 + 2x2 ≤ 170 3x1 + x2...
For the following situations indicate whether a rule of the AICPA Code of Conduct applies; if...
For the following situations indicate whether a rule of the AICPA Code of Conduct applies; if yes, state which rule, whether the rule has been violated, and why or why not. (a)Walker, CPA, is purchasing a home and received a large mortgage, under normal lending procedures, with a bank that became an audit client after the mortgage was set up; the mortgage amount is material to him. (b)Logan, CPA, accepted as an audit client a modeling agency that signs up...
for each of the following oxides, indicate whether it is ionic or molecular and whether it...
for each of the following oxides, indicate whether it is ionic or molecular and whether it is acidic or basic. Then write a balanced equation for the reaction with the oxide and water. SO2(g), CaO(s), Li2O(s), SeO(s), P4O6(s)
3. For each of the following policies indicate whether the policy is: 1. A monetary or...
3. For each of the following policies indicate whether the policy is: 1. A monetary or a fiscal policy. 2. An active or a passive policy. 3. A policy by rules or with discretion. (4 total points, 1 point each) A. The central bank follows a policy of allowing the money supply to grow at a constant 4% per year. B. A government follows a policy of keeping government spending over a calendar year equal to government revenue over the...
1.) For each of the following accounts, indicate whether the account shown is a temporary or...
1.) For each of the following accounts, indicate whether the account shown is a temporary or permanent account: Account                                   Temporary or Permanent 1. Cash                              [ Select ]                       ["Permanent", "Neither", "Temporary", "Both"]       2. Accounts Receivable                            [ Select ]                       ["Permanent", "Neither", "Both", "Temporary"]...
Indicate whether each of the following statements is true or false. 1. The corporation is an...
Indicate whether each of the following statements is true or false. 1. The corporation is an entity separate and distinct from its owners. 2. The liability of stockholders is normally limited to their investment in the corporation. 3. The relative lack of government regulation is an advantage of the corporate form of business. 4. There is no journal entry to record the authorization of capital stock. 5. No-par value stock is quite rare today.
1. For each of the following items, indicate whether it would be classified as an (O)...
1. For each of the following items, indicate whether it would be classified as an (O) operating activity, an     (I) investing activity, a (F) financing activity, or a significant (N) noncash investing or financing activity. __________Received cash dividends from an investment in the stock of another corporation. __________Collected accounts receivable from customers. __________Issued bonds payable for cash. __________Paid wages to employees. __________Issued stock for cash. __________Sold equipment for cash. __________Purchased land in exchange for a note payable. __________Paid cash...
1. For each of the following propositions construct a truth table and indicate whether it is...
1. For each of the following propositions construct a truth table and indicate whether it is a tautology (i.e., it’s always true), a contradiction (it’s never true), or a contingency (its truth depends on the truth of the variables). Also specify whether it is a logical equivalence or not. Note: There should be a column for every operator. There should be three columns to show work for a biconditional. a) (P Λ ¬Q) ⇔ ¬(P ⇒ Q) b) (¬? V¬?)...
1. If inflation rises unexpectedly by 5%, indicate for each of the following whether the economic...
1. If inflation rises unexpectedly by 5%, indicate for each of the following whether the economic actor is helped, hurt, or unaffected: (2 points) a. A union member with a COLA wage contract b. Someone with a large stash of cash in a safe deposit box c. A bank lending money at a fixed rate of interest d. A person who is not due to receive a pay raise for another 11 months
C. For each of the following situations, (1.) indicate whether you agree or disagree with the...
C. For each of the following situations, (1.) indicate whether you agree or disagree with the financial reporting practice employed, then (2.) name the accounting concept being properly employed, or name the accounting concept being violated. (more than one answer may be appropriate) Loser Corporation did not disclose that it was the defendant in a material lawsuit because thetrial was still in progress. Alliant Semiconductor Corporation files quarterly and annual financial statements with the SEC. Reliant Pharmaceutical Inc. issues financial...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT