Mindtap Computing, 1 Term (6 Months) Printed Access Card For Farrell’s Java Programming, 8th
8th Edition
ISBN: 9781337091480
Author: Joyce Farrell
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 10, Problem 17RQ
Program Description Answer
A static method is called using the name of either a class or superclass of the class, a dot, and the name of the method.
Hence, the correct answer is option “D”.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Please answer these multiple choice questions
1) The new operator:
allocates memory
is used to create an object of a class
associates an object with a variable that names it.
All of the above.
Answer:
2) A method that performs some action other than returning a value is called a __________ method.
null
void
public
private
Answer:
3) The body of a method that returns a value must contain at least one _________ statement.
void
invocation
thows
return
Answer:
4) A variable whose meaning is confined to an object of a class is called:
instance variable
local variable
global variable
none of the above
Answer:
5) A variable whose meaning is confined to a method definition is called an/a
instance variable
local variable
global variable
none of the above
Answer:
6) In Java, a block is delimited by:
( )
/* */
“ “
{ }
Answer:
7) In Java, call-by-value is only used with:
objects
primitive types
this
all of the above
Answer:
8) The parameter this refers to
instance variables
local…
21
A. Build a class named car. This class is defined as follows:
It has the fields: Car ID, Car model, Car make, Car color, Car year.
Build a constructor that accepts the five parameters (Car ID, Car model, Car make, Car color, Car year).
Override the method toString() to return the string representation of Car ID, Car model, Car make, Car color, Car
year.
Build a method named display to print the values returned by toString() method.
Override the equals() method to compare the Car model, Car make, Car color of two Car objects. The method
returns true if all the values of these fields are the same, and false otherwise.
In the equals method you must check the following:
a. If you compare the Car object to itself, return true.!
b.
If you compare car object with another car object return true, otherwise return false. Hint use : instanceof
operator for this purpose.
Override the hashcode() method to return same hash codes for objects that are equal according to the equals()
method you built…
Chapter 10 Solutions
Mindtap Computing, 1 Term (6 Months) Printed Access Card For Farrell’s Java Programming, 8th
Knowledge Booster
Similar questions
- When a method is __________, it means that multiple methods in the same class have the same name but use different types of parameters. a. emulated b. versioned c. threaded d. overloadedarrow_forwardIn Python, to make a variable inside a class private so that functions that are not methods of the class (such as main() ) cannot access it, you must _____________ write the word private then a space before the variable name write the word hide then a space before the variable name start the name of the variable with two underscores do nothing because Python variables declared inside a class are private by defaultarrow_forwardPython: Design a class named Rectangle to represent a rectangle. The class contains: • Two data fields named width and height. • A constructor that creates a rectangle with the specified width and height. The default values are 1 and 2 for the width and height, respectively. • A method named get.Area() that returns the area of this rectangle. • A method named getPerimeter() that returns the perimeter. Write a test program that creates two Rectangle objects--one with width 4 and height 40 and the other with width 3.5 and height 35.7. Display the width, height, area, and perimeter of each rectangle in this order.arrow_forward
- When you make a class method const, it means ____. Multiple answers: Multiple answers are accepted for this question Select one or more answers. a the class can have two overloaded methods with seemingly identical heads: one const and the other not b the method won't be allowed to change the data of any class object c any time methods are called using a constant object, the const version is used — or a compile-time error results if no const version exists d the calling object must be a constant object e the calling object will be treated as a constant object during the callarrow_forwardCreate a class called Student that has the following attributes:• __first_name• __last_name• __final_scoreThe class should have following methods:• letter_grade: calculates the letter grade based on final• display_student_info: displays student informationWrite a Python program that creates at least five objects based on Student class. Use display_student_info method to print each object’s information as output including letter grade. Please modify the class if you think letter_grade needs to be stored as well for a class objectarrow_forwardNeed a java code Create a class called SingleItem This class represents a bag that can hold any single type of object (decided at bag-creation time), and only one item of that type at a time. You may have a zero-parameter constructor if you want one, but you must have the following three features: Add a method called (addItem()) which returns whether or not it was successfully added Add a method which removes an item from the bag and returns it (deleteAnItem()), return null if there is no item Add a method to check if an item is in the bag (hasAnIteminTheBag()) which returns true or falsearrow_forward
- Java. create a class called employeefactoryarrow_forward250. __________ represents a particular instance of a class. a. module b. block c. object d. tokenarrow_forwardCreate a class called Complex for performing arithmetic with complex numbers. Complex numbers have the form realPart + imaginaryPart * i where i is -1 Write a program to test your class. Use floating-point variables to represent the private data of the class. Provide a constructor that enables an object of this class to be initialized when it is declared. Provide a no-argument constructor with default values in case no initializers are provided. Provide public methods that perform the following operations: a) Add two Complex numbers: The real parts are added together and the imaginary parts are added together. b) Subtract two Complex numbers: The real part of the right operand is subtracted from the real part of the left operand, and the imaginary part of the right operand is sub- tracted from the imaginary part of the left operand. c) Print Complex numbers in the form (a, b), where a is the real part and b is the imaginary part.arrow_forward
- 1. Write an app that computes student average2. Create a class called Student3. Use the init () function to collect the student information: name, math, science, and English grade4. Create a method (class function) that computes the average5. Create another method that outputs (similarly to) the ff when calledName: John Math: 90Science: 90English: 90Average: 90 (Passed)6. Instantiate a Student object and utilize the defined methods***Let the user input that student infoarrow_forwardJava:arrow_forward2. Write a class named MonthDays. The class's constructor should accept two arguments: • An integer for the month (1 = January, 2= February, etc.). • An integer for the year The class should have a method named getNumberOfDays that returns the number of days in the specified month. The method should use the following criteria to identify leap years: 1. Determine whether the year is divisible by 100. If it is, then it is a leap year if and if only it is divisible by 400. For example, 2000 is a leap year but 2100 is not. 2. If the year is not divisible by 100, then it is a leap year if and if only it is divisible by 4. For example, 2008 is a leap year but 2009 is not. Demonstrate the class in a program that asks the user to enter the month (letting the user enter an integer in the range of 1 through 12) and the year. The program should then display the number of days in that month. Here is a sample run of the program: Enter a month (1-12): 2 [Enter] Enter a year: 2008 [Enter] 29 daysarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT