Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
3rd Edition
ISBN: 9780134038179
Author: Tony Gaddis, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 14.3, Problem 14.12CP
Program Plan Intro
Applet:
Applet is a small program which is written by using java
- This program will be executed on all internet browsers by using Java Virtual Machine (JVM).
- This applet program displays the result on a frame of the webpage, any application window, or applet viewer which is the product of Sun Microsystems.
- Usually, this application will be written by java, but sometimes other languages also can be used.
- Languages such as JRuby, Pascal, Jython and so on.
- Applet program can be easily passed over any network, because most of the browsers will support applet applications.
JFrame:
JFrame is a type of window that includes one or more instances related to JPanel. It is created by using Swing Graphical User Interface (GUI). It includes the feature like to hide or close the window using the method “setDefaultCloseOperation(int)”.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Which is true?
Group of answer choices
A class can implement multiple interfaces
A class can inherit from multiple classes
A class can implement only one interface
An interface can implement multiple classes
In Java: Implementing a Superclass Employee
Part 1: Implement a superclass Employee that has the following fields and methods.
Fields: string firstName
string lastName
int employeeID
double salary
Methods: constructor method - initialize salary field to zero.
setters and getters for firstName, lastName, and employeeID employee
Summary method - prints all account attributes
Part 2: Implement a Manager class that inherits from the Employee class.
Fields: string department a
Methods: employeeSummary method - prints all superclass and subclass attributes
Ensure that your program has the two required classes and a test class.
Books can come in various formats, like paper books, audio books, ebooks, etc. Create a generic classBook that has as common attributes the title, the year of publication, and the author. The constructor of thisclass should instantiate all three attributes. Override the toString method of class Book that returns a stringthat contains the values of its attributes. Create a subclass PrintBook that extends Book with attributesPublisher and ISBN. Create another subclass AudioBook which has the book’s size (in MB), its playlength and the playback artist’s name as attributes. Both PrintBook and AudioBook classes override thetoString method inherited from Book. Write a Java application to demonstrate the usage of this hierarchy.
Chapter 14 Solutions
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Ch. 14.1 - Prob. 14.1CPCh. 14.1 - Prob. 14.2CPCh. 14.2 - Prob. 14.3CPCh. 14.2 - Prob. 14.4CPCh. 14.2 - Prob. 14.5CPCh. 14.2 - Prob. 14.6CPCh. 14.2 - Prob. 14.7CPCh. 14.2 - Prob. 14.8CPCh. 14.2 - Prob. 14.9CPCh. 14.2 - Prob. 14.10CP
Ch. 14.2 - Prob. 14.11CPCh. 14.3 - Prob. 14.12CPCh. 14.3 - Prob. 14.13CPCh. 14.3 - Prob. 14.14CPCh. 14.3 - Prob. 14.15CPCh. 14.4 - Prob. 14.16CPCh. 14.4 - Prob. 14.17CPCh. 14.5 - Prob. 14.18CPCh. 14.5 - Prob. 14.19CPCh. 14.5 - Prob. 14.20CPCh. 14.5 - Prob. 14.21CPCh. 14.5 - Prob. 14.22CPCh. 14.5 - Prob. 14.23CPCh. 14.5 - Prob. 14.24CPCh. 14.5 - What Graphics class methods do you use to perform...Ch. 14.6 - Prob. 14.26CPCh. 14.6 - Prob. 14.27CPCh. 14.6 - Prob. 14.28CPCh. 14.6 - Prob. 14.29CPCh. 14.6 - Prob. 14.30CPCh. 14.7 - Prob. 14.31CPCh. 14.7 - Prob. 14.32CPCh. 14.7 - Prob. 14.33CPCh. 14.7 - Prob. 14.34CPCh. 14.8 - Prob. 14.35CPCh. 14.8 - Prob. 14.36CPCh. 14.8 - Prob. 14.37CPCh. 14.8 - Prob. 14.38CPCh. 14 - Prob. 1MCCh. 14 - Prob. 2MCCh. 14 - Prob. 3MCCh. 14 - Prob. 4MCCh. 14 - When using Swing to write an applet, you extend...Ch. 14 - Prob. 6MCCh. 14 - Prob. 7MCCh. 14 - Prob. 8MCCh. 14 - Prob. 9MCCh. 14 - Prob. 10MCCh. 14 - Prob. 11MCCh. 14 - Prob. 12MCCh. 14 - Prob. 13MCCh. 14 - Prob. 14MCCh. 14 - Prob. 15MCCh. 14 - Prob. 16MCCh. 14 - Prob. 17MCCh. 14 - Prob. 18MCCh. 14 - Prob. 19MCCh. 14 - Prob. 20MCCh. 14 - Prob. 21MCCh. 14 - Prob. 22MCCh. 14 - Prob. 23TFCh. 14 - Prob. 24TFCh. 14 - Prob. 25TFCh. 14 - Prob. 26TFCh. 14 - Prob. 27TFCh. 14 - Prob. 28TFCh. 14 - Prob. 29TFCh. 14 - Prob. 30TFCh. 14 - Prob. 31TFCh. 14 - Prob. 32TFCh. 14 - Prob. 33TFCh. 14 - Prob. 34TFCh. 14 - Prob. 35TFCh. 14 - Prob. 1FTECh. 14 - Prob. 2FTECh. 14 - Prob. 3FTECh. 14 - Prob. 4FTECh. 14 - Prob. 5FTECh. 14 - Prob. 6FTECh. 14 - Prob. 1AWCh. 14 - Prob. 2AWCh. 14 - Prob. 3AWCh. 14 - Prob. 4AWCh. 14 - Prob. 5AWCh. 14 - Prob. 6AWCh. 14 - Prob. 1SACh. 14 - Prob. 2SACh. 14 - Prob. 3SACh. 14 - Prob. 4SACh. 14 - Prob. 5SACh. 14 - Prob. 6SACh. 14 - Prob. 7SACh. 14 - Prob. 8SACh. 14 - Prob. 9SACh. 14 - Prob. 1PCCh. 14 - House Applet Write an applet that draws the house...Ch. 14 - Prob. 3PCCh. 14 - Thermometer Applet Write an applet that displays a...Ch. 14 - Prob. 5PCCh. 14 - Prob. 6PCCh. 14 - Prob. 7PCCh. 14 - Prob. 8PCCh. 14 - Prob. 9PC
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
- Because a class may inherit from several interfaces, interfaces help establish stronger is-a connections. whether anything is real or fakearrow_forwardJava allows implementing multiple interfaces through a single class declaration statement such as: public class Student implements Comparable, Cloneable{ //code goes here } Select one: True Falsearrow_forwardYour assignment for this course is to implement a beginner level Book Management System (BMS) in Java language. BMS contains 2 classes: Bookand BookList. The Book class has the following attributes: code: a String object, that hold the book’s code. title: a String object, that hold the book’s title. qua: int variable, that hold the number of books with the same code in the library. price: a double variable, that hold the book’s price. The BookList class contains only one data member: ArrayList<Book> t. When running the program display the menu as below:1. Input & add book(s) to the end.2. Display all books.3. Search a book for given code.4. Update the book’s price for given code.5. Find the (first) max price value.6. Sort the list ascendingly by code.7. Remove the book having given code.8. Load data from file.0. Exit.Notes:(1) The book’s code must be unique in the list.(2) Display all books in format (code, title, quantity, price).(5)…arrow_forward
- Java - Interface 1. Create an interface Employee which has the attribute: rate, and the method getSalary(). 2. Implement the Employee interface with two classes: Hourly and Commissioned. 3. Hourly employee has the following additional attribute: hoursWorked. Hourly wage is 300 money. 4. Commissioned employee has the following additional attribute: itemSold. Commissioned employees get 200 money per item sold. If item sold is greater than 100, any items sold after 100 has +10 money bonus. Inputs 1. First line contains the type of Employee (H or C) 2. Second line is for the hours worked or the items sold depending on the type of employee Sample Output Enter type of employee: H Enter hours worked: 10 Salary: 3000arrow_forwardIn pythonarrow_forwardCreate a subclass named Square from the superclass GeometricObject. Create an instance variable named width with initial value 0. Create a no-arg constructor. Create the another constructor, which has one parameter named wid. Assign the wid to the instance variable named width. Create the getWidth() method, the setWidth() method. Override the getArea() method. Override the getPerimeter() method. Create a test class named Test to create an instance with wid= 6 from Square class. Call the getArea() and getPermeter() methods to print out the area and perimeter of the square with width=6.arrow_forward
- JAVA HELP! Can you add questions and covert chapter numbers into points and make an application that calls them over 100? Create a new NetBeans 8.2 Java 8 project called TestSimulator.Add the eight classes from the UML class diagram in a package called “testsimulator” as shown below. Create a class stub for each class such as below:public class ClassName { }Add the necessary additional keywords for classes that inherit from interfaces or abstract classes.Part 2:Main menu Consult the UML class diagram and add implementation to the TestSimulator class as follows:getSelection() method: • Print the following menu-based messages:Welcome to the TestSimulator program menu.Select from one of the following options.(1) New test. (2) Test summary. (3) Exit. Enter your selection:• Accept the choice from the user. • Ask the user to enter their choice again if a non-number is received.main() method: • Add a loop that runs the getSelection() method until the user enters option (3). • Add a…arrow_forwardJavascript Create an object, Gremlin, that extends the Monster interface and takes the same argument language. Gremlins inherits how a monster eats. Gremlins speaks differently. Gremlins replace each word in a sentence with its only known language, "gar". For example, if the sentence is "I like chicken", the speak() method will turn it into "gar gar gar". class Monster { constructor(language){ this.language = language; this.stomach = Array(); } // takes a food_item STRING and returns everything eaten so far ARRAY eat(food_item) { this.stomach.push(food_item); } // takes in a sentence STRING and returns the passed in sentence STRING with no change speak(sentence) { returnsentence; } }arrow_forwardIn java language Deeper Class Design - the Square, Circle, Picture Class he Bigger Picture – The ObjectList (or ArrayList (v1.0)) Class A picture is simply a composition of shapes, and in this last section, we’ll build a class used to manage such a picture. We’ll create this new class by reusing code from an existing piece of software. We’ll create an Picture class that will contain, amongst other state items (data), an array (or list) of Objects that are the Squares and Circles in the Picture to be drawn. Picture.java will be a simple abstraction here, and will just “draw” shapes to the console in the order that they appear in the list –ignoring the coordinate pairs stored in each Shape for now. Again, note the static storage restriction of only 100 shapes per picture; in future sections, we’ll learn how to dynamically resize our arrays. Aside: when we get to working with any of the Java graphics framework classes and/or swing, then a simple use of this Picture class (called a…arrow_forward
- Write a program in Java that performs the following tasks: Creates a class called Person having attributes personName, personID. Creates a subclass called Student of Person class having attributes stdGPA, stdMajor. Creates a subclass called Teacher of Person class having attributes teacherCourse, teacherSalary. Write the constructors for Person, Student and Teacher class to initialize the attributes(fields). Write a method displayDetails() in Student and Teacher class to print all attributes of superclass and subclass.arrow_forwardInterface This lab is a small demonstration of how interfaces work. Type up the code and submit the results. CODE public class InterfaceExample { public static void main(String[] args) { DemoClass myObj = new DemoClass(); myObj.myMethod(); myObj.myOtherMethod(); } public interface InterfaceOne { public void myMethod(); // interface method } public interface Interface Two { public void myOtherMethod(); // interface method } public class DemoClass implements InterfaceOne, Interface Two { public void myMethod() { System.out.println("Some text.."); } public void myOtherMethod() { System.out.println("Some other text..."); }arrow_forwardNo, an anonymous inner class does not have to extend another class to implement an interface.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT