Java Programming (MindTap Course List)
9th Edition
ISBN: 9781337397070
Author: Joyce Farrell
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 3, Problem 3RQ
Program Description Answer
In Java the statement used to call a method computeSum() of ClassA from within ClassB is “ClassA.computeSum()”.
Hence, the correct answer is option “A”.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Java - Constructors
Create a class named Book that has the following attributes:
Publisher - String Year Published - Integer Price - Double Title - String
Create a constructor for the class Book that has the parameters from the attributes of the class. After, create a method for the class that displays all attributes. Ask the user for inputs for the attributes and use the constructor to create the object. Lastly, print the values of the attributes.
Inputs
1. Publisher
2. Year Published
3. Price
4. Book Title
XYZ Publishing 2020 1000.00 How to Win?
Sample Output
Published: ABC Publishing
Year Published: 2022
Price: 150.00
Book Title: Stooping too low
Stooping too low is published by ABC Publishing on 2022. It sells at the price of Php150.00.
In Java Programming, 2 class needs a no-arg constructor and a constructor that initializes all fields with data (The ProductionWorker class constructor should receive data for the Employee class fields as well). I need help to create a method within the Employee and ProductionWorker classes called displayInfo. (displayInfo accepts no arguments and returns void). To display the data for each constructor, the demonstration class will call the subclass displayInfo method and it will call the superclass displayInfo method. User input is not required for the demonstration class.
Have a class named "Employee" with the following fields:
- Employee Name
- Employee Number in format XXX-L, X = digit w/ range 0-9 & L = letter w/ range A-M.
- Hire Date
Then one or more constructors and the appropriate accessor and mutator methods for the class.
Also, another class named "ProductionWorker" that extends "Employee" class. The "ProductionWorker" class should have the following fields to hold…
This is object oriented programming
Chapter 3 Solutions
Java Programming (MindTap Course List)
Ch. 3 - Prob. 1RQCh. 3 - Prob. 2RQCh. 3 - Prob. 3RQCh. 3 - Prob. 4RQCh. 3 - Prob. 5RQCh. 3 - Prob. 6RQCh. 3 - Prob. 7RQCh. 3 - Prob. 8RQCh. 3 - Prob. 9RQCh. 3 - Prob. 10RQ
Ch. 3 - Prob. 11RQCh. 3 - Prob. 12RQCh. 3 - Prob. 13RQCh. 3 - Prob. 14RQCh. 3 - Prob. 15RQCh. 3 - Prob. 16RQCh. 3 - Prob. 17RQCh. 3 - Prob. 18RQCh. 3 - Prob. 19RQCh. 3 - Prob. 20RQCh. 3 - Prob. 1PECh. 3 - Prob. 2PECh. 3 - Prob. 3PECh. 3 - Prob. 4PECh. 3 - Prob. 5PECh. 3 - Prob. 6PECh. 3 - Prob. 7PECh. 3 - Prob. 8PECh. 3 - Prob. 9PECh. 3 - Prob. 10PECh. 3 - Prob. 11PECh. 3 - Prob. 12PECh. 3 - Prob. 13PECh. 3 - Prob. 1GZCh. 3 - Prob. 2GZCh. 3 - Prob. 1CP
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
- Write a program named SalespersonDemo that instantiates objects using classes named Real EstateSalesperson and GirlScout. Demonstrate that each object can use a SalesSpeech() method appropriately. Also, use a MakeSale() method two or three times with each object, and display the final contents of each objects data fields. First, create an abstract class named Salesperson. Fields include first and last names; the Salesperson constructor requires both these values. Include properties for the fields. Include a method that returns a string that holds the Salespersons full name—the first and last names separated by a space. Then perform the following Create two child classes of Salesperson: Real EstateSalesperson and Girl Scout. The Real EstateSalesperson class contains fields for total value sold in dollars and total commission earned (both of which are initialized to 0), and a commission rate field required by the class constructor. The Girl Scout class includes a field to hold the number of boxes of cookies sold, which is initialized to 0. Include properties for every field. Create an interface named ISell able that contains two methods: SalesSpeech() and MakeSale(). In each Real EstateSalesperson and Girl Scout class, implement SalesSpeech() to display an appropriate one- or two-sentence sales speech that the objects of the class could use. In the Real Estatesalesperson class, implement the MakeSale() method to accept an integer dollar value for a house, add the value to the Real EstateSalespersons total value sold, and compute the total commission earned. In the Girl Scout class, implement the MakeSale() method to accept an integer representing the number of boxes of cookies sold and add it to the total field.arrow_forwardDesign a class named StopWatch. The class contains:■ The private data fields startTime and endTime with get methods.■ A constructor that initializes startTime with the current time.■ A method named start() that resets the startTime to the current time.■ A method named stop() that sets the endTime to the current time.■ A method named getElapsedTime() that returns the elapsed time for thestop watch in milliseconds.Draw the UML diagram for the class, and then implement the class. Write a test program that measures the execution time of adding numbers from 1 to 1,000,000.arrow_forwardDesign a class named StopWatch. The class contains:■■ Private data fields startTime and endTime with getter methods.■■ A no-arg constructor that initializes startTime with the current time.■■ A method named start() that resets the startTime to the current time.■■ A method named stop() that sets the endTime to the current time.■■ A method named getElapsedTime() that returns the elapsed time for thestopwatch in milliseconds.Draw the UML diagram for the class then implement the class. Write a test programthat measures the execution time of sorting 100,000 numbers using selection sort.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_forwardCreate an Employee Class that will have ● Two instance variable: name and workingPeriod ● A class method named employeeByJoiningYear(): o To create an Employee object by joining year for calculating the working period o It will have two Parameter name and year ● A static method experienceCheck() to check if an Employee is experienced or not o It will take working period and gender as parameter o If an employee’s working period is less than 3, he or she is not experienced [You are not allowed to change the code below] # Write your code here employee1 = Employee('Dororo', 3) employee2 = Employee.employeeByJoiningYear('Harry', 2016) print(employee1.workingPeriod) print(employee2.workingPeriod) print(employee1.name) print(employee2.name) print(Employee.experienceCheck(2, "male")) print(Employee.experienceCheck(3, "female")) Output 3 5 Dororo Harry He is not experienced She is experiencedarrow_forwardIn java language on netbeans design a console application that will print the game sales for a particular game in 2021. Use an abstract class named Games that contains variables to store the game name, game genre and the total sales. Create a constructor that accepts the game name, game genre and the total game sales as parameters. In this class also create get methods for the variables. The Games class must implement an iGames interface that contains the following: public interface iGames { public void printSales(); public String getGame(); public String getGameGenre(); public int getGameSales(); } Create a subclass called Game Sales that extends the Games class. The Games Sales class must contain a constructor to accept the game name, game genre and total game sales as parameters. Then, write code for the Print Sales method, which prints the game sales report for 2021. Finally, write a Use Games class to instantiate the Games Sales class.arrow_forward
- Create an Employee Class that will have Two instance variable: name and workingPeriod A class method named employeeByJoiningYear(): • To create an Employee object by joining year for calculating the working period o it will have two Parameter name and year • A static method experienceCheck() to check if an Employee is experienced or not o It will take working period and gender as parameter o If an employee's working period is less than 3, he or she is not experienced [You are not allowed to change the code below] # Write your code here employee1 = Employee('Dororo', 3) employee2 = Employee.employeeByJoiningYear('Harry', 2016) 6 print(employee1.workingPeriod) print(employee2.workingPeriod) print(employee1.name) print(employee2.name) print(Employee.experienceCheck(2, "male")) print(Employee.experienceCheck(3, "female")) Оutput 3 Dororo Harry He is not experienced She is experiencedarrow_forwardIn Java Write a CashRegister class that can be used with the RetailItem class that you wrote inChapter 6’s Programming Challenge 4. The CashRegister class should simulate the sale ofa retail item. It should have a constructor that accepts a RetailItem object as an argument.The constructor should also accept an integer that represents the quantity of items beingpurchased. In addition, the class should have the following methods:• The getSubtotal method should return the subtotal of the sale, which is the quantitymultiplied by the price. This method must get the price from the RetailItem objectthat was passed as an argument to the constructor.• The getTax method should return the amount of sales tax on the purchase. The salestax rate is 6 percent of a retail sale.• The getTotal method should return the total of the sale, which is the subtotal plus thesales tax.Demonstrate the class in a program that asks the user for the quantity of items being purchased,and then displays the sale’s…arrow_forwardDesign a class named Rectangle to represent a rectangle. The class must have the following: • double data fields named width and height. The default values are 1 for both width and height A no-argument constructor that creates a default bag. A constructor that creates a rectangle with the specified width and height A getParameter() method to return the perimeter. • A getArear() method to return the area of the Rectangle. Create two Rectangle objects. One with width 4.0 and height 10.0. The other object has width 6.3 and height 10.5.arrow_forward
- JAVAarrow_forwardDesign a class named MyPoint to represent a point withx- and y-coordinates. The class contains:■■ The data fields x and y that represent the coordinates with getter methods.■■ A no-arg constructor that creates a point (0, 0).■■ A constructor that constructs a point with specified coordinates.■■ A method named distance that returns the distance from this point to aspecified point of the MyPoint type.■■ A method named distance that returns the distance from this point toanother point with specified x- and y-coordinates.■■ A static method named distance that returns the distance from two MyPointobjects.Draw the UML diagram for the class then implement the class. Write a testprogram that creates the two points (0, 0) and (10, 30.5) and displays the distancebetween them.arrow_forwardDesign a class named MyInteger. The class contains: ■ An int data field named value that stores the int value represented by this object. ■ A constructor that creates a MyInteger object for the specified int value. ■ A get method that returns the int value. ■ The methods isEven(), isOdd(), and isPrime() that return true if the value in this object is even, odd, or prime, respectively. ■ The static methods isEven(int), isOdd(int), and isPrime(int) that return true if the specified value is even, odd, or prime, respectively. ■ The static methods isEven(MyInteger), isOdd(MyInteger), and isPrime(MyInteger) that return true if the specified value is even, odd, or prime, respectively. ■ The methods equals(int) and equals(MyInteger) that return true if the value in this object is equal to the specified value. ■ A static method parseInt(char[]) that converts an array of numeric characters to an int value. ■ A static method parseInt(String) that converts a string into an int value. Draw the UML…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Memory Management Tutorial in Java | Java Stack vs Heap | Java Training | Edureka; Author: edureka!;https://www.youtube.com/watch?v=fM8yj93X80s;License: Standard YouTube License, CC-BY