Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. (14 points) The first problem includes the following: (a) Write a class encapsulating the concept of an address, called Address, having a streetAddress, city,

image text in transcribed

1. (14 points) The first problem includes the following: (a) Write a class encapsulating the concept of an address, called Address, having a streetAddress, city, state, and zipCode as instance variables. The Address class contains a toString0 method for returning a string of an address (b) Write a class encapsulating the concept of a package, called Package, which contains instance variables for TrackinglD, Weight (in ounces), Cost, shipMethod, and Destination. shipMethod is a variable of an enumerated type called Shipping, which defines the following constants for a shipping method {Air, Ground, Sea\. Destination is a reference to an object of the Address class. The Package class includes the following: . A constructor that accepts arguments for the weight, and shipping method. The constructor calls a method called calculateCost0 to determine the shipping cost . The calculateCost) method computes the cost of a package delivery based on the method of shipping. The shipping cost is determined based on the following table: Weight (ounces) Air Ground Sea 1-8 9-16 17 and over 4.00 6.00 9.00 1.80 2.80 4.00 0.55 1.50 2.00 Accessesor, mutator methods for the Weight, shipMethod, and Destination instance variables The mutator methods for the Weight and shipMethod should call the calculateCost0 method in order to recalculate the package cost A method, called GeneratelD, that accepts a Random class object which is used to generate and set the TrackingID by a random number of 6 digits, then returns its value toString) method that returns a nicely formatted string of the package information. * . (c) Write a client class, called PackageDelivery, that allows the user to create any number of packages and stores all the user entries in a packageList as an ArralyList object of Package objects. The client prompts the user for the required fields for the package weight, shipping method, and destination The client uses the method, GeneratelD, of the package class to generate a tracking ID of 6 digits The client should display the contents of the packageList object on the screen. Implement a scenario for removing and adding some packages from the packageList then display it again. (Note Implement the classes in separate files.) 2. (6 points) Write a JavaFX application that draws 100 circles of random size and color at random locations within a defined window size. All circles greater than a specified radius value (e.g., 10) are drawn with no fill color, while all circles with radius value equal to or less than the specified value are

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions

Question

What are market anomalies? Describe four.

Answered: 1 week ago