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

Separate files for each Sale

Program plan:

Filename: “Sale.java”

  • Include the required header files in the program
  • Define the “Sale” class
    • Declare the private variables
    • Define the parameterized constructor
      • Set the value
    • Define the “getName” method
      • Return the name
    • Define the “getServiceCategory” method
      • Return the service
    • Define the “getAmount” method
      • Return the amount
    • Define the “getDate” method
      • Return the date

Filename: “SalesSales.java”

  • Include the required header files in the program
  • Define the “SalesSales” class
    • Define the “getFileName” method
      • Declare the variable
      • Get the filename from the user
      • Iterate the loop until the loop ends the last line in the file
        • Get the values
      • Return the value
    • Define the “readSaleEntry” method
      • Declare the variable and get the values
      • Separate the values using “;”
      • Declare the variables and get the values
      • Call the “Sale” class with the parameters and return the values
    • Define the “readSalesFile” method
      • Create an object for “ArrayList”
      • Check filename is not equal to null
      • In the “try” block, create an object for “Scanner” class
        • Iterate the loop until the loop ends the last line in the file
          • Add the values by calling the “readSaleEntry” method
      • Return the sales.
    • Define the “gatherCategories” method
      • Create an object for “ArrayList”
      • Iterate the values
        • Check the categories are not equal to 0
          • Add the values
      • Return the categories
    • Define the “writeSale” method
      • Call the “getName” method and display the name
      • Call the “getServiceCategory” method and display the category
      • Call the “getAmount” method and display the amount
      • Call the “getDate” method and display the date
    • Define the “writeCategorySalesToFile” method
      • In the “try” block, create an object for “PrintWriter” class
        • Iterate the values
          • Check the service category is equal to category
            • Call the “writeSale” method
              • In the “catch” block, display a file not found error message
    • Define the “writeCategorySales” method
      • Iterate the values
        • Call the “writeCategorySalesToFile” method
    • Define the main method
      • Create an object for “Scanner” class
      • Call the “getFileName” method and set the value
      • In the “try” block,
        • Call the “readSalesFile” method and store the value in “sales” variable.
        • Call the “gatherCategories” method and store the value in “categories” variable.
        • Call the “writeCategorySales” method
        • Display the successive message
      • In the “catch” block, display a file not found error message
      • In the “catch” block, display a no such element error message

Blurred answer
Students have asked these similar questions
S A B D FL I C J E G H T K L Figure 1: Search tree 1. Uninformed search algorithms (6 points) Based on the search tree in Figure 1, provide the trace to find a path from the start node S to a goal node T for the following three uninformed search algorithms. When a node has multiple successors, use the left-to-right convention. a. Depth first search (2 points) b. Breadth first search (2 points) c. Iterative deepening search (2 points)
We want to get an idea of how many tickets we have and what our issues are. Print the ticket ID number, ticket description, ticket priority, ticket status, and, if the information is available, employee first name assigned to it for our records. Include all tickets regardless of whether they have been assigned to an employee or not. Sort it alphabetically by ticket status, and then numerically by ticket ID, with the lower ticket IDs on top.
Figure 1 shows an ASM chart representing the operation of a controller. Stateassignments for each state are indicated in square brackets for [Q1, Q0].Using the ASM design technique:(a) Produce a State Transition Table from the ASM Chart in Figure 1.(b) Extract minimised Boolean expressions from your state transition tablefor Q1, Q0, DISPATCH and REJECT. Show all your working.(c) Implement your design using AND/OR/NOT logic gates and risingedgetriggered D-type Flip Flops. Your answer should include a circuitschematic.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
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