Java Programming
Java Programming
9th Edition
ISBN: 9780357616635
Author: Joyce Farrell
Publisher: CENGAGE L
bartleby

Concept explainers

bartleby

Videos

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

Shipping cost

Program plan:

Filename: “InsuredPackage.java”

  • Define of “InsuredPackage” class
    • Define constructor
      • Call the “super” method
      • Declare the constant variables with the values.
      • Check “getCost ()” is less than “LOWCOST”
        • Set “i” is “LOWINS”
      • Check “getCost ()” is less than “MEDCOST”
        • Set “i” is “MEDINS”
      • Otherwise, set “i” is “HIGHINS”
      • Call the “increaseCost()” method.

Filename: “Package.java”

  • Define the “Package” class
    • Declare the required private variables
    • Define the parameterized constructor
      • Set the values
      • Call the method
    • Define the “calculateCost” method
      • Declare the variable
      • Check “w” is less than “LOWWT”
        • Check “m” is equal to “AIR”
          • Set “c” is “LOWAIR”
        • Otherwise, check “m” is equal to “TRUCK”
          • Set “c” is “LOWTRUCK”
        • Otherwise, set “c” is “LOWMAIL”
            • Check “w” is less than “MEDWT”
              • Check “m” is equal to “AIR”
                • Set “c” is “MEDAIR”
              • Otherwise, check “m” is equal to “TRUCK”
                • Set “c” is “MEDTRUCK”
              • Otherwise, set “c” is “MEDMAIL”
            • Check “w” is less than “HIGHWT”
              • Check “m” is equal to “AIR”
                • Set “c” is “HIGHAIR”
              • Otherwise, check “m” is equal to “TRUCK”
                • Set “c” is “HIGHTRUCK”
              • Otherwise, set “c” is “HIGHMAIL”
            • Return the value
    • Define the “display” method
      • Display the result
    • Define the “getCost” method
      • Return the cost
    • Define the “increaseCost” method
      • Calculate the cost value

Filename: “UsePackage.java”

  • Define the “UsePackage” class
    • Define the main method
      • Create three objects for “Package” class with different values
      • Create three objects for “InsuredPackage” class with different values
      • Call the “display” method with different objects of “Package” and “InsuredPackage” classes.

Blurred answer
Students have asked these similar questions
A Dia file has been created for you to extend and can be found on Company.dia represents a completed ER schema which, models some of the information implemented in the system, as a starting point for this exercise. Understanding the ER schema for the Company database. To demonstrate that you understand the information represented by the schema, explain using EMPLOYEE, DEPARTMENT, PROJECT and DEPENDENT as examples: attributes, entities and relationships cardinality & participation constraints on relationships You should explain questions a and b using the schema you have been given to more easily explain your answers. Creating and Extending Entity Relationship (EER) Diagrams. To demonstrate you can create entity relationship diagrams extend the ER as described in Company.dia by modelling new requirements as follows: Create subclasses to extend Employee. The employee type may be distinguished further based on the job type (SECRETARY, ENGINEER, MANAGER, and TECHNICIAN) and based…
Computer programs can be very complex, containing thousands (or millions) of lines of code and performing millions of operations per second. Given this, how can we possibly know that a particular computer program's results are correct? Do some research on this topic then think carefully about your response. Also, explain how YOU would approach testing a large problem. Your answer must be thoughtful and give some insight into why you believe your steps would be helpful when testing a large program.
Could you fix this? My marker has commented, What's missing? The input list is the link below.  https://gmierzwinski.github.io/bishops/cs321/resources/CS321_Assignment_1_Input.txt     result.put(true, dishwasherSum);        result.put(false, sinkSum);        return result;    }}
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
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
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 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
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3); Author: CS Dojo;https://www.youtube.com/watch?v=8yjkWGRlUmY;License: Standard YouTube License, CC-BY