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 java program to evaluate postfix expressions

Write a java program to evaluate postfix expressions containing complex numbers using a stack. This program should contain two classes.

  Communication with an smtp server

Develop a graphical user interface based java program that can communicate with a real SMTP email server for sending emails

  Development of a simple program involving multiple classes

Development of a Simple Program Involving Multiple Classes and development of a basic Class, development of the Country and World classes

  Write a java program that will read a sequence of names

Write a java program that will read a sequence of names (first name followed by last name, separated by at least one space) from a text file and will 1) remove all duplicate names and 2) write the names (last name followed by a comma, followed by one..

  Prepare executable programs a translate program and a

prepare executable programs. a translate program and a dictionary program. the programs will be written in any

  Cmpet 301 lab 11 overview

CMPET 301: Lab 11 Overview, Create a class for one playing card. Make a deck of playing cards by instantiating an array of 52 playing cards playing cards.

  Modify the book class to accommodate multiple authors

modify the Book class to accommodate multiple authors using one of the components from the Java Collection Framework.

  A program that reads a four-digit number from the keyb

Write a program that reads a four-digit number from the keyboard as a string and then converts it into decimal. For example, if the input is 1100, the output should be 12. Hint: Break the string into characters and then convert each character to a va..

  Write an app that allows user to enter a seven-digit number

Write an application that prompts the user to enter the sales for each employee, then it calculates the salesperson's salary. The process repeats until the user finishes entering all employees' information

  Mean and standard deviation using using eclipse

Java programming to calculate Mean and standard deviation using Using Eclipse.

  Determine product a inferior or normal good

Research illustrates that prices of related goods are given by Py = $5,900 and ; Pz = $90, while average income of individuals consuming this product is M = $55,000. Is X inferior or normal good?

  Develop class which implements interface

Let the ADT called SquareMatrix. (The matrix can be represented by 2-D array of ints w/ n rows and n columns.) Write specification for ADT as Java interface. Develop the class which implements interface.

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