Share on Google+Share on Google+

Jessica Jenkins
0 Answer(s)      7 years ago
Posted in : Java Beginners

Problem 4.1 Design an implement an application that displays a button and a label on a screen. Every time the button is pushed, the label will display a random number between 1 and 1000, inclusive. Name your class RandomNum. You will need two classes to implement this.

Problem 4.2

Create an application comprised of three classes. The first class called Crayon represents one crayon of a particular color and length (height). Make sure that the constructor is overloaded and accepts a color passed in that is used as the crayon?s color. Design an implement another class called BoxOfCrayons that draws a box of four crayons, each of different color, using the Crayon objects. The third class is BoxOfCrayonsPanel which is going to be the panel holding all the crayon objects.

Problem 4.3

Design and implement a program with a class called Flight that represents an airline flight. It should contain instance data that represents the airline name (ex. NWA, Delta, AA), flight number (4 digits) and the flight?s origin and destination cities (ex. SHV, DFW, HOU, BOS).

?Define the Flight constructor to accept and initialize all instance data.

?Include getter and setter methods for all instance data.

?Include a toString method that returns a one-line description of the light, use tabs to separate the information on the line.

?Create a driver class called FlightTest whose main method instantiates and updates several Flight objects. Two classes are required for this project: Flight and FlightTest.

Answer above question as programming projects in NetBeans.

View Answers

Related Tutorials/Questions & Answers:


Advertisement null