Concept explainers
a.
(a)Legal and conventional:
The method identifier whose name starts with lowercase letter, contains no space and emphasizes each new word with initial uppercase letter comes under the legal and conventional method identifiers in Java.
(b)Legal but unconventional:
The class identifier whose new words starts with initial uppercase letters, using underscore, indicating the whole letter with the uppercase is considered as the legal but unconventional method identifiers in Java.
(c)Illegal:
The class identifier whose name has space between two words, using reserved keywords, staring the names with digits and using “#” symbol are considered as the illegal method identifiers in Java.
b.
Explanation of Solution
Void():
“void()” is considered a...
c.
Explanation of Solution
Golden Retriever():
“Golden Retriever()” is con...
d.
Explanation of Solution
Invoice():
“Invoice()” is considered as leg...
e.
Explanation of Solution
36542ZipCode():
“36542ZipCode()” is co...
f.
Explanation of Solution
Apartment():
“Apartment()” is considered as l...
g.
Explanation of Solution
Phone#:
“Phone#” is considered as ill...
h.
Explanation of Solution
8888:
“8888” is considered a...
i.
Explanation of Solution
displayTotal():
“displayTotal()” is considere...
j.
Explanation of Solution
Accounts_Receivable():
“Accounts_Receivable()” is con...
Want to see the full answer?
Check out a sample textbook solutionChapter 1 Solutions
Java Programming, Loose-leaf Version
- Is each of the following class identifiers (a) legal and conventional, (b) legal but unconventional, or (c) illegal?a. myClassb. voidc. Golden Retrieverd. invoice#e. 36542ZipCodef. Apartmentg. Fruith. 8888i. displayTotal()j. Accounts_Receivablearrow_forwardMethodsJava Write the appropriate method headings using the provided method name for the following processes:1.) Given the radius of a circle, print the area of a circle - printArea. 2.) Accept an integer, compute for the square of the number and return the String equivalent of the square of the number - makeString 3.) Calculate and return the sum of two decimal numbers - getSum. 4.) Given a student’s name and three test scores (of type int), print the student’s name and average test score - printStudentDetails. 5) Compute and return the average speed of a car, given the distance traveled (as type double) and traveling time (in hours and minutes, both of type int) - getAverageSpeed.arrow_forwardConsider a class PersonAddress that represents an entry in an address book. Its attributes are The first name of the person The last name of the person The e-mail address of the person The telephone number of the person It will have methods to Access each attribute Change the e-mail address Change the telephone number Test whether two instances are equal based solely on name Write a method heading for each method. Write preconditions and postconditions for each method. Write some Java statements that test the class. Implement the class.arrow_forward
- Which of the following statements are false? (All that are not true). Group of answer choices A reference of type super class can refer to an instance of type subclass. A reference of type subclass can refer to an instance of type super class. A method in the super class can be overridden two different ways in two different subclasses. A method in the super class can be overridden by changing its signature in the subclass.arrow_forwardPlease send me answer within 10 min!! I will rate you good for sure!! Please send me explaination of your code and provide screenshot of your code and output!! Please Help. What is wrong with my code? It works fine but the test cases validDate2 and validDate3 fail when running the program. Can you please tell me what's wrong? ORIGINAL CODE: package Lab2; public class Lab2 { /** * Takes a date as three integers:day, month, and year. * The method returns a true if the date is valid and false otherwise. * The method checks if the month is valid, and the year is after the year 1000. * It checks if the day is valid according to the month. If the month is February, * it checks if the year is a leap year */ public static boolean validDate(int day, int month, int year) { // declaring boolean variables as originally false boolean yearValid = false; boolean monthValid = false; boolean dayValid = false; boolean isLeapYear = false; // truth value = T if the month is greater than 1 and less than…arrow_forwardThese two pictures are my resource and driver classes. Please, help me with the error in my resource class. I want my resource class to have getName, getSalary, getThePercentageThatTheEmployeeWantToRaise, and calculateTheNewSalary methods. For my driver class, I want the driver class to ask the user to input their name, salary, how much they want to raise, and print out their new salary.arrow_forward
- Use the class, WhatPrints, to view what prints for each of the method calls below:doSomething(5);doSomething(6.7);doSomething("Mary");doSomething(3, 6.7)Write the answers in a doc file.• Explain which method runs for each method call and why. public class WhatPrints {public static void main(String[] args) {doSomething(5);doSomething(6.7);doSomething("Mary");doSomething(3, 6.7);}public static void doSomething(String s){System.out.println("Apple");}public static void doSomething(int n){System.out.println("Banana");}public static void doSomething(double d){System.out.println("Pear");}public static void doSomething(int n, double d){System.out.println("Strawberry");}}arrow_forwardGiven the following class, what sets of statements would have the end result of the myUser instance having the username as testuser and the password as testpassword and then outputting the username and password? public class User { private String userName; private String password; public User(String userName, String password) { this.userName = userName; this.password = password; } public String getUserName() { return userName; } public String getPassword() { return password; } public void setUserName(String userName) { this.userName = userName; } public void setPassword(String password) { this.password = password; } } 1- User myUser = new User("testuser","testpassword"); System.out.println("User: " + myUser.username); System.out.println("Password: " + myUser.password); 2- User myUser = new User("testuser","testpassword"); System.out.println("User: " + myUser.username()); System.out.println("Password: " + myUser.password());…arrow_forwardWhat type of information does the following method return? public static void methodRankPoints(double points) int double nothing object Which statement is correct? The while loop repeats a set of code while a condition is not met. The number of iterations required of a while loop is always known before the while loop begins. The while loop repeats a set of code while a condition is met. The while loop does not require code to be added to manage iteration during each loop. Which of the following statements is true with regard to java exceptions? A try block can be followed by multiple catch blocks. A program automatically terminates immediately after a catch block is executed. Only one try/catch block is allowed in a single method. A try-catch is required in all methods.arrow_forward
- Please don't copy for answer screenshot provide a running code with preconditions and post conditions comments for each methods and screenshot of output. And please please please, write a brand new code for this!!! Thank youarrow_forwardWrite a class encapsulating the concept of a student, assuming student has the following attributes: a name, a social security number, and a GPA (for instance 3.5). Include a constructor, the accessors and mutators, and methods toString() and equals(). Write a client class to test all the methods in your class.arrow_forward2. What is printed by the following application?// Circle.java: Contains both Circle class and its user class1. public class Circle{2. public double x, y; // center of the circle3. public double r; // radius of circle //Methods to return circumference and area4. public int circumference() {5. return 2*3.14*r; }6. public double area() {7. return 3.14 * r * r; } }// User class MyMain8. class MyMain {9. public static void main(String args[]){10. Circle aCircle; // creating reference11. aCircle = new Circle(); // creating object12. aCircle.x = 10; // assigning value to data field13. aCircle.y = 20;14. aCircle.r = 5;15. double area = aCircle.area();16. double circumf = aCircle.circumference();17. System.out.println("Radius="+aCircle.r+" Area="+area);18. System.out.println("Circumference ="+circumf); } }3. What are the names of Class identifiers in two classes?4. What are identifiers x and y called on line 2?5. What is return type on line 4 in method header of circumference(), is it the…arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT