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
Expert Solution & Answer
Chapter 12, Problem 5AW
Explanation of Solution
- The constructor of “FlowLayout()” should pass the alignment to the content pane for the components. To add the components to the left edge of each row, the “FlowLayout()” should pass the argument in constructor using the following way:
FlowLayout(FlowLayout.LEFT)
- If the class inherits from the “JFrame” class, the object variable of the class should call the method “setLayout()” to set the layout for content pane...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
1. Create Main Program that will instantiate the whole
registration.
2. Create a design class that define an Animal
3. the Animal can be described by: Name, Type, Description
4. Create a registration class that can store the List of
Animals
5. the registration should be able to Add, Edit, Delete, and
Retrieve the List of Animals
6. Create a AnimalDisplay class
7. AnimalDisplay class should be able to Display All animals
and can Display the Animals based on their types
8. Lastly the main program should do the calling for all this
classes, the data input will be coming from the main
program, the process should be done by registration and the
display should be done by AnimalDisplay.
Rectangle Object Monitoring
Create a Rectangle class that can compute the total area of all the created rectangle objects using static fields (variables). Remember that a Rectangle has two attributes: Length and Width. Implement the class by creating a computer program that will ask the user about three rectangle dimensions. The program should be able to display the total area of the three rectangle objects. For this exercise, you are required to apply all OOP concepts that you learned in class.
Sample output:
Enter Length R1: 1
Enter Width R1: 1
Enter Length R2: 2
Enter Width R2: 2
Enter Length R3: 3
Enter Width R3: 3
The total area of the rectangles is 14.00
Note: All characters in boldface are user inputs.
Guide to working through the project
Steps:
Write the GradeBook constructor that reads student information from the data file into the ArrayList roster). For now, ignore the grades. Test your GradeBook class before proceeding to the next step.
Create the Grade class. Test your Grade class before proceeding to the next step.
Modify the Student class to include an ArrayList of Grade. Test the Student class before proceeding to the next step.
Finish writing the GradeBook constructor to process the grades as they are read in from the data file. Test the GradeBook class before proceeding to the next step.
Add additional functionality to the GradeBook and Student classes one method at a time.
Here is Grade.jave code is shown below.
public class Grade {
// TODO: complete this class as described in this task write-up
}
GradeBook Class
The GradeBook class has a single instance variable roster, an ArrayList of Student. This class performs all operations related to the scores of all…
Chapter 12 Solutions
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Ch. 12.2 - Prob. 12.1CPCh. 12.2 - Prob. 12.2CPCh. 12.2 - Prob. 12.3CPCh. 12.2 - Prob. 12.4CPCh. 12.2 - Prob. 12.5CPCh. 12.2 - Prob. 12.6CPCh. 12.2 - If you are writing an event listener class for a...Ch. 12.2 - Prob. 12.8CPCh. 12.2 - Prob. 12.9CPCh. 12.3 - Prob. 12.10CP
Ch. 12.3 - Prob. 12.11CPCh. 12.3 - Which layout manager arranges components in a row,...Ch. 12.3 - Prob. 12.13CPCh. 12.3 - Prob. 12.14CPCh. 12.3 - Prob. 12.15CPCh. 12.3 - Prob. 12.16CPCh. 12.3 - Prob. 12.17CPCh. 12.4 - Prob. 12.18CPCh. 12.4 - Prob. 12.19CPCh. 12.4 - Prob. 12.20CPCh. 12.4 - Prob. 12.21CPCh. 12.4 - Prob. 12.22CPCh. 12.4 - Prob. 12.23CPCh. 12.4 - Prob. 12.24CPCh. 12.4 - Prob. 12.25CPCh. 12.5 - Prob. 12.26CPCh. 12.5 - Prob. 12.27CPCh. 12 - With Swing, you use this class to create a frame....Ch. 12 - Prob. 2MCCh. 12 - Prob. 3MCCh. 12 - Prob. 4MCCh. 12 - Prob. 5MCCh. 12 - Prob. 6MCCh. 12 - Prob. 7MCCh. 12 - Prob. 8MCCh. 12 - Prob. 9MCCh. 12 - Prob. 10MCCh. 12 - Prob. 11MCCh. 12 - Prob. 12TFCh. 12 - Prob. 13TFCh. 12 - Prob. 14TFCh. 12 - Prob. 15TFCh. 12 - Prob. 16TFCh. 12 - Prob. 17TFCh. 12 - Prob. 18TFCh. 12 - Prob. 19TFCh. 12 - Prob. 20TFCh. 12 - The following statement is in a class that uses...Ch. 12 - Prob. 2FTECh. 12 - Prob. 3FTECh. 12 - Prob. 4FTECh. 12 - Prob. 5FTECh. 12 - Prob. 1AWCh. 12 - Prob. 2AWCh. 12 - The variable myWindow references a JFrame object....Ch. 12 - Prob. 4AWCh. 12 - Prob. 5AWCh. 12 - Prob. 6AWCh. 12 - Prob. 7AWCh. 12 - Prob. 8AWCh. 12 - Prob. 9AWCh. 12 - Prob. 1SACh. 12 - Prob. 2SACh. 12 - Prob. 3SACh. 12 - Prob. 4SACh. 12 - Retail Price Calculator Create a GUI application...Ch. 12 - Prob. 2PCCh. 12 - Prob. 3PCCh. 12 - Travel Expenses Create a GUI application that...Ch. 12 - Prob. 5PCCh. 12 - Joes Automotive Joes Automotive performs the...Ch. 12 - Prob. 8PC
Knowledge Booster
Similar questions
- Assume that a class named Window has been defined. The Window class has a member function named clone that takes no arguments and returns a pointer to a new copy of the Window object. Also, assume that a class named GraphicProgram has been defined with the following members: executableName, a variable of the string type windowPtr, a variable of the Window* type Write a copy constructor for the GraphicProgram class that uses the clone function to make a proper copy of the Window object that windowPtr points to. The executableName member may be copied using simple assignment. Don't use GraphicProgram:: notation. Also put in c++ formatarrow_forwardCreational Patternarrow_forwardAssignment #1 • Create a Java application whose main window contains a tabbed pane (look the Figure). The tabbed pane contains multiple components each of which is displayed on a separate tab. The application should be extendable so that new components can be added without modifying the code. The user is expected to design a new component as a separate class. Use the factory pattern plus other 00P principles to support such a design. TabbedPaneDemo Tab 1 Tab 2 Tab 3 Tab 4 Panel #1 Does nothing at allarrow_forward
- Create the VisualCounter class, which supports both increment and decrement actions. Take the function Object() { [native code] }'s two arguments N and max, where N specifies the maximum action number and max specifies the counter's maximum absolute value. Make a plot that displays the worth of the counter each time its tally changes as a byproduct.arrow_forwardSuper Ghost Project Rule changes: The premise of the game remains the same, there are two players adding words to a growing word fragment. Each player will take turns attempting to add letters to a growing word fragment. The letter you select should attempt to force your opponent to spell a word or create a word fragment that has no possibility of creating a word. Unlike the prior ghost competition, when it is your turn you are allowed to add a letter to either the front or back of the word fragment. Winning Criteria: If your opponent spells a word that is at least 6 characters long if your opponent creates a word fragment that has no possibility of creating a word if your opponent takes longer than 60 seconds to select a word. Tip: If you are the first player you can only spell words that are odd length thus you can only lose when you spell words that are odd but you can win when your opponent spells words that are even length. Accordingly, if you are the first player you should…arrow_forwardJavaarrow_forward
- Creates a class StudentPhD extending the class Student with two more attributes: specialty and supervisorName; a. Add a constructor to create a StudentPhd b. Add a display method: display need to override (polymorphism) the previous display method of Student class;arrow_forwardThe Circle class inherits from the Shape base class. Circle overrides the display() function defined in the Shape base class. Which of the following will call the base class display function from the Circle display function? this->display() Shape::display() display() ::display()arrow_forwardJavaScript Assignment For this assignment you are only to use external CSS and JavaScript. This assignment shouldhave no templates or frameworks. The Fruits to be used are Apple, Orange, Pear, and Pineapple. Write the code in a way that allows it to pull the images from a folder inside the main folder named “images." The file names are as follows Apple.png, Orange.png, Pear.png, and Pineapple.png. You are to create a child's game. The game will have a title in the head of the boilerplate withyour name. The name of the game will be Fruit Game which will need to be included in theheader of the browser using a h1 element. You will display an image of a fruit. Under the imagethere will be room for text for the name of the fruit but not displayed at the start. You will havefour buttons with names for the fruits available. When the button with the fruit name is clickedthe name of the fruit will appear under the image of the fruit. If the button and the name of thefruit is the same then you…arrow_forward
- StockReader Class • This class will contain the method necessary to read and parse the .csv file of stock information. • This class shall contain a default constructor with no parameters. The constructor should be made private. . This is to prevent the class from being instantiated since the class will only contain static methods. • This class shall contain no data fields. • This class shall have a method called readStockData: . This method shall be a public, static, method. . This method shall return a StockList object once all data has been processed. . This method will take a File object as a parameter. This File object should link to the stock market data in your files folder created previously. . This method must validate that the given File object is a .csv file. If it is not, then this method shall throw an IllegalArgumentException. . This method shall read the File object and process all of the stock data into TeslaStock objects and store each object in a StockList. NOTE: The…arrow_forwardDesign a GUI for Book view class for the following Library Information System, which you have worked on 1 with the following details: Library Item Class Design and TestingDesign a class that holds the Library Item Information, with item name, author, publisher. Write appropriate accessor and mutator methods. Also, write a tester program that creates three instances/objects of the Library Items class. Extending Library Item Class (Library and Book Classes): Extend the Library Item class in (1) with a Book class with data attributes for a book’s title, author, publisher and an additional attributes as number of pages, and a Boolean data attribute indicating whether there is both hard copy as well as eBook version of the book. Demonstrate Book Class in a Tester Program with an object of Book class.arrow_forwardObjectives: 1. To utilize the predefined methods found in the Graphics class under the AWT package. 2. To demonstrate creativity in designing graphics for a certain class. Activity: Write a program that shows your own happy face character using the different shapes found in the Graphics class. The program should ask for a name and asks the user to choose from a list of at least 3 colors using JOptionPane. The name will appear in the Graphics canvas on top or below the character, while the color will be applied to the character's main face. Required: There exists at least one or more of each of the following methods: - drawOval()/fillOval() - drawRect()/fillRect() - drawPolygon()/fillPolygon() - drawline() - drawArc()/fillArc() - setColor(new Color(R,G,B)) - setFont(new Font(type, style, size)) - drawstring()arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT