MINDTAPV2.0 JAVA PROGRAMMING 2021, 1TERM
MINDTAPV2.0 JAVA PROGRAMMING 2021, 1TERM
9th Edition
ISBN: 9780357505526
Author: FARRELL
Publisher: CENGAGE L
bartleby

Concept explainers

Question
Book Icon
Chapter 12, Problem 7PE
Program Plan Intro

Display list

Program plan:

Filename: “UsedCarException.java”

  • Define “UsedCarException” class which extends from “Exception” class
    • Define the constructor
      • Call the super method.

Filename: “UsedCar.java”

  • Define the “UsedCar” class
    • Declare the required variables and set the values
    • Define the default constructor
      • Set the values
    • Define the parameterized constructor
      • Set the values
      • Check “num” length is not equal to “VIN_NUM_LENGTH”
        • Set the value
          • Iterate “x” until it reaches “num” length
            • Check “num” is not a digit
              • Set the value
          • Iterate “x” until it reaches “MALES” length
            • Check “carMake” is not equal to “MAKES [x]”
              • Set the value
          • Check “isGoodMake” is false
            • Set the value
          • Check “carYear” is less than “LOW_YEAR” or greater than “HIGH_YEAR or “miles” less than 0 or “pr” less than 0
            • Set the value
          • Check “isBad” is true
            • Throw an exception
          • Set the values
    • Define the “getVin” method
      • Set the values
    • Define the “toString” method
      • Return the values.

Filename: “ThrowUsedCarException.java”

  • Define the class “ThrowUsedCarException”
    • Define the “main” method
      • Create an object for “UsedCar” class
      • Declare the variables and set the required values to the variables
      • Iterate “for” loop until it reaches length of the “UsedCar”
        • Set the values to the object
      • Iterate “for” loop until it reaches length of the “UsedCar”
        • In “try” block, set the values
        • In “catch” block, display the course and error
      • Display the course values

Blurred answer
Students have asked these similar questions
Modular Program Structure. Analysis of Structured Programming Examples. Ways to Reduce Coupling. Based on the given problem, create an algorithm and a block diagram, and write the program code: Function: y=xsin⁡x Interval: [0,π] Requirements: Create a graph of the function. Show the coordinates (x and y). Choose your own scale and show it in the block diagram. Create a block diagram based on the algorithm. Write the program code in Python. Requirements: Each step in the block diagram must be clearly shown. The graph of the function must be drawn and saved (in PNG format). Write the code in a modular way (functions and the main part should be separate). Please explain and describe the results in detail.
Based on the given problem, create an algorithm and a block diagram, and write the program code: Function: y=xsin⁡x Interval: [0,π] Requirements: Create a graph of the function. Show the coordinates (x and y). Choose your own scale and show it in the block diagram. Create a block diagram based on the algorithm. Write the program code in Python. Requirements: Each step in the block diagram must be clearly shown. The graph of the function must be drawn and saved (in PNG format). Write the code in a modular way (functions and the main part should be separate). Please explain and describe the results in detail.
Based on the given problem, create an algorithm and a block diagram, and write the program code: Function: y=xsin⁡x Interval: [0,π] Requirements: Create a graph of the function. Show the coordinates (x and y). Choose your own scale and show it in the block diagram. Create a block diagram based on the algorithm. Write the program code in Python. Requirements: Each step in the block diagram must be clearly shown. The graph of the function must be drawn and saved (in PNG format). Write the code in a modular way (functions and the main part should be separate). Please explain and describe the results in detail.
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT