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

  Vehicle in vehicle.java

Create a class called Vehicle in Vehicle.java with instance variables make (such as Ford, GM, Chrysler, Toyota, or Honda), year, and horsepower (200, 300, and 400). Add the necessary constructor and set and get methods.

  Write a class named test scores

Write a class named TestScores.The class constructor should accept an array of test scores as an argument.The class should have a method that returns the average of the test scores.

  Implement a portable file system

Implement a Portable File System and allocate a file. Move files from the Windows file system into your file

  Overriding the equals method

Use the equals method, which Player inherits from the Object class, to determine whether two players are the same. Are the results what you expect?

  Java program to compute invoice for client

You need a java program to compute the invoice for client and then print out invoice to the screen. The consulting rate is $200 per hour.

  Java program ask user to enter 10-character telephone number

Write a Java program that asks the user to enter a 10-character telephone number in the format XXX-XXX-XXXX. The program should display the telephone number with any alphabetic characters

  Part - a1nbsp to compile and run a java source file

part - a1.nbsp to compile and run a java source file hello.java that contains a main method which of the following are

  Design and implement a small and simple email server using

design and implement a small and simple email server using the concept of web based information system. your system

  Depicts a model for recording flight and passenger

This assignment requires you to design, implement and test a program using Java features from the first half of the subject content. You are required to implement in Java all the classes presented in the conceptual model according the specificatio..

  Use random function to create account number

Add a static method numAccounts that returns the total number of accounts. (Think about why this method should be static -- its information is not related to any particular account.)

  A client or server prepare to use udp in a java application

How does a client or server prepare to use UDP in a Java application? Are there any differences in what the client does and what the server does?

  Construct java program named collegelist

Construct a set of classes for a college to use in many student service and personnel applications. Classes you require to design include following:

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