a.
(a)Legal and conventional:
The class identifier whose name starts with uppercase letter, contains no space and emphasizes each new word with initial uppercase letter comes under the legal and conventional class names in java.
(b)Legal but unconventional:
The class identifier whose new words does not starts with initial uppercase letters, using underscore, indicating the whole letter with the uppercase and beginning the initial letter with lowercase is considered as the legal but unconventional class names 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 class names in Java.
b.
Explanation of Solution
void:
“void” is considered as...
c.
Explanation of Solution
Golden Retriever:
“Golden Retriever” is cons...
d.
Explanation of Solution
Invoice:
“Invoice” is considered as lega...
e.
Explanation of Solution
36542ZipCode:
“36542ZipCode” is cons...
f.
Explanation of Solution
Apartment:
“Apartment” is considered as le...
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 c...
j.
Explanation of Solution
Accounts_Receivable:
“Accounts_Receivable” is consi...
Trending nowThis is a popular solution!
Chapter 1 Solutions
Mindtap Computing, 1 Term (6 Months) Printed Access Card For Farrell’s Java Programming, 8th
- Create a python code with the following:• A Class called Player with four(4) attributes and two(2) methods:• String name, Char sex, int health, int power• Attack(), Defend() • Print the lines:• "My character's name is <name>"• "<he/she> has <health> health and <power> power"• Use if statements for <he/she>• Print function Attack():• "<name> attacked with <power> power"arrow_forward1. Create a python file with a class called "Mobile ()" which will allow us to create new mobile phone objects. 2. Each phone has 4 attributes: make model OS color 3. As there are many things a mobile phone can do create at least four methods the phone can do, examples can be receiving a call, playing a video etc...Within the methods, use print statements to reflect the actions. One Method should use more than one attribute in its print statement 4. Create a separate python file to call the Mobile() class and create at least 3 phone objects. 5. After creating the objects, let each phone perform at least two of the methods and printthem on the screen 6. Add comments to both files to explain your processarrow_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_forward
- PS: Please say the logic behind it. Thank you! 1. Create a java class Vehicle.a. The class should have two fields:i. no_of_seats and no_of_wheels.b. Create two objectsi. Motorcycle and Car for this class.c. Your output should show the descriptions for Car and Motorcyclearrow_forwardRecall the Rectangle and Cube classes discussed earlier, as shown in Figure 10-18. a) Is the following statement legal or illegal? If it is illegal, why?Rectangle r = new Cube(10, 12, 5);b) If you determined that the statement in part a is legal, are the following statementslegal or illegal? (Indicate legal or illegal for each statement.)System.out.println(r.getLength());System.out.println(r.getWidth());System.out.println(r.getHeight());System.out.println(r.getSurfaceArea());c) Is the following statement legal or illegal? If it is illegal, why?Cube c = new Rectangle(10, 12);arrow_forwardConsider the following class: public class IdentifyMyParts { public static int x = 7; public int y = 3; } 1. 1. What are the class variables? 2. What are the instance variables?arrow_forward
- Can you help debug my Java program? Attached is a screenshot of my code. Here are my bugs: i cannot be resolved to a variable (line 27)i cannot be resolved to a variable (line 28)n cannot be resolved to a variable (line 27)Scan cannot be resolved (line 15, 19)Syntax error, insert ; to complete statement (line 19)Syntax error, insert “.class” (line 28)The left hand side of an assignment must be a variable (line 27)The method char(at)int is undefined (line 19)This method requires a body (line 24)Void methods cannot return a value (line 31)arrow_forwardWhat indicates that a class definition is complete? A. The first line of code that is not indented. B. The classEnd statement. C. The defEnd statement. D. Nothing. Class definitions never end. How are instance variables within an object's method referenced? A. by attaching 'self' and a period before the instance variable's name B. by attaching the method name and a period before the name of the instance variable. C. by specifiying the instance variable's name D. by specifying the name of the class and the instance variable. Which of the following statements correctly shows the first line of a class definition for Rectangle? A. class Rectangle: B. def class Rectangle: C. class Rectangle(): D. class Rectangle(self):arrow_forwardAns8 izt--7 Write the following Book class:A Book has-a title, ISBN number, author and price.o Include the following:o All instance fields (variables)o Two Constructors: a default constructor and onerequiring all fields as parameterso Methods – an accessor and mutator for each instancefieldso Create two Book objects with title, isbn, author andpriceo Print the information about the bookso Change the price of both books.o Reprint the information about the books.arrow_forward
- Reply to another student's post. Modify the student's code by providing a modified approach to the class or suggestions for enhancement. * * * Import java.util.Scanner; public class Appliance { //Instance variables declared public int level; public char auto; //Method to assign values for humidity level and auto feature; taken from user input in main method public void setValues(int level, char auto) { this.level = level; this.auto = auto; } //Method to display results from user input public void displayStatus() { System.out.println("You have entered " + level + " for humidity"); System.out.println("You have entered " + auto + " for auto feature"); String setting = null; if (Character.toUpperCase(auto) == 'Y') { setting = "ON"; } else { setting = "OFF"; } System.out.println("\nThe humidity level is " + level + "%"); System.out.println("The auto feature is set to " + setting); } public static void main(String[] args) { //Create instance of class Appliance humidity = new…arrow_forwardI need help with creating a Java program described in the image below: CourseInformation.java: import java.util.Scanner; public class CourseInformation { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); Course myCourse = new Course(); OfferedCourse myOfferedCourse = new OfferedCourse(); String courseNumber, courseTitle; String oCourseNumber, oCourseTitle, instructorName, location, classTime; courseNumber = scnr.nextLine(); courseTitle = scnr.nextLine(); oCourseNumber = scnr.nextLine(); oCourseTitle = scnr.nextLine(); instructorName = scnr.nextLine(); location = scnr.nextLine(); classTime = scnr.nextLine(); myCourse.setCourseNumber(courseNumber); myCourse.setCourseTitle(courseTitle); myCourse.printInfo(); myOfferedCourse.setCourseNumber(oCourseNumber); myOfferedCourse.setCourseTitle(oCourseTitle); myOfferedCourse.setInstructorName(instructorName);…arrow_forwardThis is the question I am struggling with - Create a class in JobApplicant.java that holds data about a job applicant. Include a name, a phone number, and four Boolean fields that represent whether the applicant is skilled in each of the following areas: word processing, spreadsheets, databases, and graphics. Include a constructor that accepts values for each of the fields. Also include a get method for each field. The get method should be the field name prefixed with 'get'. For example, the get method for name should be called getName. Create an application in TestJobApplicants.java that instantiates several job applicant objects and pass each in turn to a Boolean method named isQualified that determines whether each applicant is qualified for an interview. Then, in the main() method, display an appropriate method for each applicant. A qualified applicant has at least three of the four skills. This is the code it has given - public class JobApplicant { private String name;…arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage