Big Java Late Objects
Big Java Late Objects
2nd Edition
ISBN: 9781119330455
Author: Horstmann
Publisher: WILEY
Question
Book Icon
Chapter 7, Problem 13PP
Program Plan Intro

Covalent bonds

Program plan:

  • Include the required header files in the program
  • Define the “BondQuery” class
    • Define the “findMatchBonds” method
      • Create an object for “ArrayList”
      • Declare the variable
      • Check the data is in the file
        • Check “datum” is equal to “query”
          • Call the “add” method with an object
        • Increment the “i” value
      • Return the value
    • Define the “printBonds” method
      • Check “index” is in the “bondIndices”
        • Get the input value from the user
    • Define the main method
      • Create an object for “Scanner” class
      • In the “try” block, create an object for “Scanner” class and pass a file name as an argument
        • Declare the variables
        • Create the different objects for “ArrayList”
        • Iterate the loop until it reaches the end of the file
          • Create an object for “Scanner” class
          • Call the methods with different objects
        • Check the “done” value is true
          • Get the input value from the user
          • Check the “option” is equal to “T”
            • Get the type from the user
            • Call the “findMatchBonds” and “printBonds” methods and store the result in a variable.
              • Check the “option” is equal to “E”
                • Get the energy from the user
                • Call the “findMatchBonds” and “printBonds” methods and store the result in a variable.
              • Check the “option” is equal to “L”
                • Get the length from the user
                • Call the “findMatchBonds” and “printBonds” methods and store the result in a variable.
              • Check the “option” is equal to “Q”
                • Set the “done” value as true.
      • In the “catch” block, display an invalid input message
      • In the “catch” block, display a file not found message.

Blurred answer
Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education