Java Programming (MindTap Course List)
9th Edition
ISBN: 9781337397070
Author: Joyce Farrell
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Chapter 1, Problem 2PE
Explanation of Solution
Naming conventions:
It is the set of rules used for choosing the character sequence of identifier name. The naming conventions denote variables, methods, classes, and constants.
Naming conventions for method name:
- Naming conventions for method are:
- If the name of the method consists of multiple words, join them into one.
- Make the first letter as lowercase and capitalize the first letter of each sub word.
- Examples: “numberOfPassmarks”, “calculateMarks()”, etc.
Method Identifiers | a | b | c | ||
Legal | Conventional | Legal | Unconventional | Illegal | |
associationRules() | Yes | Yes | |||
void() | Yes, the method identifier is illegal, since “void” is keyword | ||||
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Create a project in JAVA name "Supermarket Management System" Project should include:1. Authentication or login using credentials with new user signup2. Loop3. Method4. Arrays5. Encapsulation6. Inheritance7. Polymorphism8. Abstract class9. Interface10. File11. Exception
12. Frontend: JAVA GUI13. Backend: Eclipse14. Database: Mysql15. JAVA GUI using Swing. (You should not use JavaFX)
NB: Project should be created in eclipse
QUESTION 11
Given the following method header
public void someMethod ( float x, boolean y, boolean z)
what is the signature of this method?
For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac).
Read each step below and write a program using an IDE or text editor.
31-32. Create a class named MyAccount. This class should have the main method with a
welcome message, "Welcome to my account".
33-34. Create an enum and name it as Account.
35-36. Inside the implementation of enum, create three constants named, PREMIUM(10),
GOLD (7), and BASIC(3).
37-38. Create an int member variable inside the enum named discount and set its access
modifier to private.
39-40. Inside the main method, create a variable named dis with a data type Account.
41-42. Create the constructor of enum with parameter int discounted.
43-44. Inside the constructor, assign discounted to discount. Create a public method
named getDiscount(), set its return type to int and return discount.
45-46. In the main method, assign PREMIUM to dis using the Account enum
47-48. Print the discount using the getDiscount() method.
49-50. Concatenate "%" to getDiscount() method.
Chapter 1 Solutions
Java Programming (MindTap Course List)
Ch. 1 - Prob. 1RQCh. 1 - Prob. 2RQCh. 1 - Prob. 3RQCh. 1 - Prob. 4RQCh. 1 - Prob. 5RQCh. 1 - Prob. 6RQCh. 1 - Prob. 7RQCh. 1 - Prob. 8RQCh. 1 - Prob. 9RQCh. 1 - Prob. 10RQ
Ch. 1 - Prob. 11RQCh. 1 - Prob. 12RQCh. 1 - Prob. 13RQCh. 1 - Prob. 14RQCh. 1 - Prob. 15RQCh. 1 - Prob. 16RQCh. 1 - Prob. 17RQCh. 1 - Prob. 18RQCh. 1 - Prob. 19RQCh. 1 - Prob. 20RQCh. 1 - Prob. 1PECh. 1 - Prob. 2PECh. 1 - Prob. 3PECh. 1 - Prob. 4PECh. 1 - Prob. 5PECh. 1 - Prob. 6PECh. 1 - Prob. 7PECh. 1 - Prob. 8PECh. 1 - Prob. 9PECh. 1 - Prob. 10PECh. 1 - Prob. 11PECh. 1 - Prob. 12PECh. 1 - Prob. 1DECh. 1 - Prob. 1GZCh. 1 - Prob. 1CPCh. 1 - Prob. 2CP
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Objective: Write a class that will test dates and times inputted by the user and determine whether or not it is valid. This will focus on the usages of methods to organize code. First download the driver and put it in your project DO NOT ALTER THE DRIVER! Use this to run your project The driver : public class DateAndTimeDriver { public static void main(String[] args) { // TODO Auto-generated method stub DateAndTimeTester dtTester = new DateAndTimeTester(); dtTester.run(); } } Write a class file called DateAndTimeTester This DOES NOT have a main method Create the following methods run: This method returns nothing and takes no parameters. This is called by the driver and should handle all of the input from the Scanner and dialog for the user. isValid: returns true or false if a given String has the correct date and time. The String parameter should be formatted “MM/DD hh:mm” This method should call the methods isValidDate and isValidTime to determine this. isValidDate: returns…arrow_forward1. Create a program class, TestFrame, that contains a main() to test and use the above class. This process should contain methods as follows: main(): This method should: 1. Call makeFrame() to get the inputs and create a Frame object. 2. Call calcCost() to determine the cost of the picture. 3. Display the cost of the picture along with the attribute values. 4. Ask the user if he/she wants another picture. 5. If the answer is No, display the total cost of the picture 6. If the answer is Yes, implement steps 1 and 2 again (without a loop), then display: ● the number of frames created (through a variable) • total cost of the picture(s), and • average picture cost. 6. The program should then end. Class methods: makeFrame() A function to prompt the user for inputs and accept the four (4) input values needed to create an instance of a Frame. It instantiates a Frame object and returns the object to the calling method. follows: calcCost() This function has a Frame object as its formal argument…arrow_forwardOpen the Palace Solution.sln file contained in the VB2017\Chap10\Palace Solution folder. Use Windows to copy the Rectangle.vb file from the VB2017\Chap10 folder to the Palace Project folder. Then, use the Add Existing Item option on the Project menu to add the file to the project. Modify the Rectangle class to use Double variables rather than Integer variables. Change the name of the GetArea method to GetAreaSqFt. Add another method to the class. Use Get AreaSqYds as the method’s name. The method should calculate and return the area of a rectangle in square yards. The application’s Calculate button should calculate and display the number of square yards of carpeting needed to carpet a rectangular floor. Code the btnCalc_Click procedure. Display the number of yards with one decimal place. Save the solution and then start and test the application.arrow_forward
- Which of the following statements is false? a. A class can contain only one constructor. b. An example of a behavior is the SetTime method in a Time class. c. An object created from a class is referred to as an instance of the class. d. An instance of a class is considered an object.arrow_forwardPROBLEM: 1. Write a Rectangle class in Python language, allowing you to build a rectangle with length and width attributes. 2. Create a Perimeter() method to calculate the perimeter of the rectangle and a Area() method to calculate the area of the rectangle. 3. Create a method display() that display the length, width, perimeter and area of an object created using an instantiation on rectangle class. 4. Create a Parallelepipede child class inheriting from the Rectangle class and with a height attribute and another Volume() method to calculate the volume of the Parallelepiped.arrow_forward7. How does a command-line interface differ from a 8. How do radio buttons on a form differ from buttons? 9. Can arguments be sent to methods in event-driven programs? gorie ad n Hands-On Activities Hands-On Activity 3-1 The manager of an electronics appliance store has asked you to develop a class to help in tracking inventory for TVs. Variables include manufacturer, screen diagonal size (in inches), and retail price (in dollars and cents). Methods include a setPrice() method with a parameter for the new price and a displayInfo() method that dis- plays the three variables' values in sentences. There's also a construc- tor method with three parameters for the three variables. Using pseudocode, write a class definition. Save your pseudocode file in Notepad as TelevisionClass.txt. Hands-On Activity 3-2arrow_forward
- Design a program in Visual Basic.net languages to test a username and password using a method users information: username: OMAR Password: ADlreMlpfeN1 Second user username: MOHAMED Password: 12lre34pfe56 When the user write username: OMAR and Password: ADMIN1 or write username: MOHAMED and Password:123456 open another Form.arrow_forwardUsing python, create House Class with the following properties and methods floor Size noof Floors noOfDoors switchOn() lightOpen() ovenOpen(). Create Town House Class inherit the House class. Modify the value of the following(noOfFloors and no OfDoors). Instantiate the Town House Class once. Display all the properties Calling the switchOn() will automatically execute lightOpen() and ovenOpen()arrow_forwardWhich of the following was not a class in the racquetball simulation?a) Player b) SimStats c) RBallGame d) Scorearrow_forward
- In java language Class Design – Date V0.0 & V1.0 Create a new project for this lab and create a new class inside called Date. If you created a Date class last week, you may use it as a base. What does it mean to be a Date? What data items (called “state”) do you need to keep track of? Alternatively, what does a date have? (“has a” == composition) What can a Date do? What are the actions and verbs that can be applied to a date? Come up with one or two. These become the class’s methods. Try adding 3 data items to your Date to manage the month, day and year. Should these be local variables? Class-level (or instance) variables? Now let’s build a method to set the date This function should take 3 integers as input and assign these to your instance variables declared in the previous step. public void setDate(int m, int d, int y) { And, let’s build a method to report the date This function takes no input and uses the console to output the Date in the format…arrow_forwardCode to 1. inherit Application class to HelloFX class. 2. Code for Overriding the start method from Application class. 3. Import codes for Button, Labels, and TextField 4. Create an Instance of class Button, Labels, and TextField and assign them on their respective objects. 5. Call the method setOnAction() using the button object.arrow_forwardPLEASE ENSURE TO USE THE FRAMEWORK PROVIDED IN THE IMAGES, AND THAT IT WORKS WITH THE TESTER CLASS. PLEASE EDIT BOTH THE TEST CLASS, DO NOT EDIT THE MAIN METHOD. Write a BankAccountTester class whose main method constructs a bank account, deposits $1,000, withdraws $500, withdraws another $400, and then prints the remaining balance. Also print the expected result.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Linux - Tutorial for Beginners in 13 MINUTES! [ UPDATED ]; Author: bai;https://www.youtube.com/watch?v=BMGixkvJ-6w;License: Standard YouTube License, CC-BY
What is Linux?; Author: Techquickie;https://www.youtube.com/watch?v=zA3vmx0GaO8;License: Standard YouTube License, CC-BY
Introduction to Linux and Basic Linux Commands for Beginners; Author: sakitech;https://www.youtube.com/watch?v=IVquJh3DXUA;License: Standard Youtube License