Write the flow of execution of application

Assignment Help JAVA Programming
Reference no: EM13544946

(Date and String Builder)

936_Java.png

Source code for above Panel is provided.

(a) When the Update button is clicked, the Cost and Delivery Date text fields should be filled in based on data in the other fields. These two textfields should not be editable by the user (note that JTextFields have a setEditable() method).

• Modify PackageCostNDatePanel.java to set the fields non-editable.

(b) Cost for a package is computed as $2 per pound plus 3 times the difference between destination region and departure region (thus the further a package is going, and the more a package weighs, the more the cost). For example, if the package weighs 4 pounds and is going from region 5 to region 3, the cost is computed as: 2*4 + 3*abs(5-3) which evaluates to 8+6 or $14.

• Modify getCost() of Package.java to calculate cost.

(c) The delivery date should be 3 business days after the entry date. For example, if the entry date were 4/22/2014, then the delivery date should be computed as 4/25/2014 (package is dropped off on a Tuesday and delivered 3 business days later on a Friday). If the entry date were 4/25/2014, then the delivery date should be computed as 4/30/2014 (package is dropped off on a Friday and three business days later is a Wednesday). For the purposes of this lab, you may ignore holidays. Any weekday (Monday thru Friday) should be considered a business day. You should have used the GregorianCalendar class in previous labs.

You'll want to parse the Entry Date and create a GregorianCalendar object to represent it. Note that the GregorianCalendar class has an add() function that allows you to add a certain number of days to the current date. You can also find out what day of the week, a date falls on (by using the get() method). Thus, for the Delivery Date, you can make a copy of the Entry Date (what function would you use to do that?) and then adjust the date so it is three business days later. For more information on GregorianCalendar, read the lecture notes, the course textbook, and refer to the Java Sun API website at:

https://java.sun.com/javase/6/docs/api

• Modify setDeliveryDate() of Package.java

(d) When the Reset button is clicked, the UI components should be cleared (reset the UI).

• Modify reset() of PackageInfoPanel.java

• Modify reset() of PackageCostNDatePanel.java

(e) Modify toString() of Package.java to print the Package information.

Section A (Exception Handling):

• Create a new class named BadPackageDataException following the exception chaining approach taught in class by professor (refer Exception Handling.pdf) and use this class for throwing exceptions:

Data validation in PackageInfoPanel.java

• Check all the data entered are valid integers, if nothing is entered or non-integer value is entered then throw BadPackageDataException with appropriate message.

• Check if package number entered is greater than zero, if not, throw BadPackageDataException with appropriate message.

• Check if weight entered is greater than zero, if not, throw BadPackageDataException with appropriate message.

Entry Date validation in Package.java

• Check if the data entered is in the format of MM/DD/YYYY, if not, throw BadPackageDataException with appropriate message.

• Check if the year in entry data should not be less than 2014, if so, throw BadPackageDataException with appropriate message.

Section B (Threads):

• Modify PackagePanel.java to make it a thread.

• Modify ImplementPackage.java to start a new thread of PackagePanel.java.

Section C (Flow of execution):

• Write the flow of execution of this application step by step and briefly explain the functionality of each function being called (like the first step would be to instantiate Frame and then instantiate Panel and place it into the Frame).

Reference no: EM13544946

Questions Cloud

Find what is the change in the area of the hole : The coefficient of linear expansion of copper is 17 × 10-6 K-1. A sheet of copper has a round hole of radius 1.5 m cut out of it. what is the change in the area of the hole
Estimate the angular acceleration of the ferris wheel : A Ferris wheel is moving at an initial angular velocity of 1.0 rev/39 s. If the operator then brings it to a stop in 3.3 min, what is the angular acceleration of the Ferris wheel
Explain what amino acids will be placed in the peptide chain : What amino acids will be placed in the peptide chain for the following portion of DNA? CCA-TGA-TCC-CTT-AGA. A. Gly-Thr-Arg-Glu-Ser
Calculate the average linear acceleration of a tire : A car starts from rest and then accelerates uniformly to a linear speed of 14 m/s in 38 s. If the tires have a radius of 28 cm, calculate the average linear acceleration of a tire
Write the flow of execution of application : Write the flow of execution of application step by step and briefly explain the functionality of each function being called (like the first step would be to instantiate Frame and then instantiate Panel and place it into the Frame).
Compute the activation energy for the reaction : The rate constant (K) for a reaction was measured as a function of temperature. A plot of ln K versus 1/T (in K) is linear and has a slope of -9.50×10^3 K. Calculate the activation energy for the reaction.
Explain how much slag are produced by a modern blast furnace : How many tons of slag are produced by a modern blast furnace using 2.55×104 of limestone,. Assume that slag is pure calcium silicate () and that all reactions go to completion.
Determine what is the balls angular velocity : Consider a tennis ball that is hit by a player at the baseline with a horizontal velocity of 50 m/s (about 110 mi/h). What is the ball's angular velocity
Explain the chemical formula of salt : State the chemical formula of salt and classify the bond as ionic, polar covalent or non covalent

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write ijvm program to multiply two hexadecimal numbers

Write the IJVM program that multiplies two (hexadecimal) numbers. The user inputs the hex numbers and the result is printed out. The program then accepts another pair of numbers.

  Find the solution of all these java question

find the solution of all these java question

  What is an illustration of a javascriptr framework in the

what is an example of a javascriptr framework? in the framework you have described what is an example of an application

  Develop java package comprising of class using encapsulation

Develop the Java package comprising of Class and Student with the given requirements. Encapsulation, Method to print student details alone.

  Create a package called people

Create a second package called ‘task01'. Within this package provide classes which perform the following tasks.

  Java application that calculates the body mass index

Write a Java application that calculates and displays the body mass index (BMI) for N people

  In light of wrestling with ethics

In light of "Wrestling With Ethics" and other research/articles that you are able to draw upon, should profitability drive social responsibility? Be sure to support your discussion question responses with evidence from the readings and/or additional ..

  Write a java program using the java graphics

Your task for this assignment is to write a Java program using the Java Graphics class to create an example of a computer generated image. This is an opportunity for you to explore computer graphics and exercise some individual creativity.

  Define an adt for character strings.

Define an ADT for character strings. Your ADT should consist of typical functions that can be performed on strings, with each function defined in terms of its input and output. Then define two different physical representations for strings.

  Develop java code to compute monthly rent for housing units

Develop a java code that computes monthly rent for 3 housing units namely Bungalows,Apartments and hostels. All housing units have got size,color and monthly rental rate.

  Java project

Prompt the user for an int between lower and upper boundary.

  Create a deque class based on the discussion of deques

Create a Deque class based on the discussion of deques (double-ended queues) in this chapter. It should include insertLeft(), insertRight(), removeLeft(), removeRight(), isEmpty(), and isFull() methods.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd