Program using ide application, JAVA Programming

Assignment Help:

Instructions:

Please make sure your solutions are original, in your own words, expressing your own ideas. Any copying from others' home-works, text books or online sources will be penalized.

IMPORTANT: You can use any IDE for creating your programs. Create the programs and save them. Compile and run the programs. Save the screenshot of the successfully run programs and submit the screenshots with the corresponding source code files on the Blackboard. Any exceptions to this should be pre-approved by the Instructor; Late submissions are liable to be penalized, if permitted.

Programs should be well-commented to make their understanding easy. Variable-names should be so chosen that it is easily to visualize what is going on, inside the program.

It is highly recommended that students keep a soft copy of the assignment files with them.

10.1/366 (The Time class) Design a class named Time. The class contains:

1.  Data fields hour, minute and second that represent a time.

2.  A no-arg constructor that creates a Time object for the current time. (The values of the data fields will represent the current time.)

3.  A constructor that constructs a Time object with a specified elapsed time since midnight, Jan 1, 1970, in milliseconds. (The values of the data fields win represent this time.)

4.  A constructor that constructs a Time object with the specified hour, minute, and second.

5.  Three get methods for the data fields hour, minute, and second, respectively.

6.  A method named setTime(long el apseTime) that sets a new time for the object using the elapsed time.

Draw the UML diagram for the class. Implement the class. Write a test program that creates two Time objects (using new Time() and new Time(555550000)) and display their hour, minute and second. (Hint: The first two constructors will extract hour, minute, and second from the elapsed time. For example, if the elapsed time is 555550 seconds, the hour is 10, the minute is 19, and the second is 9. For the no-arg constructor, the current time can be obtained using System .currentTimeMills(), as shown in Listing 2.6, ShowCurrentTime.java.)

(Geometry: The Circ1e2D class) Define the Circle2D class that contains:

1.  Two double data fields named x and y that specify the center of the circle with get methods.

2.  A data field radius with a get method.

3.  A no-arg constructor that creates a default circle with (0, 0) for (x, y) and 1 for radius.

4.  A constructor that creates a circle with the specified x, y, and radius.

5.  A method getArea() that returns the area of the circle.

6.  A method getPerimeter() that returns the perimeter of the circle.

7.  A method contains (double x, double y) that returns true if the specified point (x, y) is inside this circle.

8.  A method contains (Circle2D circle) that returns true if the specified circle is inside this circle.

9.  A method overlaps(Circle2D circle) that returns true if the specified circle overlaps with this circle.

Draw the UML diagram for the class. Implement the class. Write a test program that creates a Circle2D object c1 (new Circle2D(2 , 2, 5. 5)), displays its area and perimeter, and displays the result of c1.contai ns (3 , 3), c1.contains(new Circle20(4 , 5, 10 . 5)), and c1.overlaps(new Circle2D(3, 5, 2 .3)).

11.2 (The Person, Student, Employee, Faculty, and Staff classes) Design a class named Person and its two subclasses named Student and Employee. Make Faculty and Staff subclasses of Employee. A person has a name, address, phone number and email address. A student has a class status (freshman, sophomore, junior, or senior). Define the status as a constant. An employee has an office, salary, and pay-grade. A faculty member has office hours and a rank. A staff member has a title. Override the toString method in each class to display the class name and the person's name.

Draw the UML diagram for the classes and implement them. Write a test program that creates a Person, Student, Employee, Faculty and Staff, and invokes their toString( ) methods.

11.3 (Subclasses of Account) In programming Exercise 8.7 (given in the last assignment), the Account class was defined to model a bank account. An account has the properties account number, balance, annual interest rate, and date created, and methods to deposit and withdraw funds. Create two subclasses for checking and saving accounts. A checking account has an overdraft limit, but a savings account cannot be overdrawn.

Draw the UML diagram for the classes and then implement them. Write a test program that creates objects of Account, SavingsAccount, and CheckingAccount and invokes their toString( ) methods.

Create a frame and set its layout to FlowLayout.

Create two panels and add them to frame.

Each panel contains three buttons. The panel uses Flowlayout.

1334_button.png

Write a program that draws a checkerboard on a JPanel using the drawing methods in the Graphics class, as shown in the figure. Use the drawRect method to draw each cell in the checkerboard.

2499_chess borad.png

PS: Be sure to follow the instructions related to Input/Output, coding conventions, directions on comments, naming conventions, indentation, spacing, block styles and what to turn in - as specified after assignment 1 while writing your programs.

 

 

 


Related Discussions:- Program using ide application

How can you define a readable program, How can you define a readable progra...

How can you define a readable program? A program that is easy to read & understand also easy to maintain and enhance. Readability is the ease in that text can be read and under

What is mixing data types, What is Mixing Data Types? As well as mergin...

What is Mixing Data Types? As well as merging various operations, you can mix and match various numeric data types on the similar line. The program below uses both ints and dou

What is setter methods explain with an example, What is Setter Methods expl...

What is Setter Methods explain with an example? Setter methods, also called as mutator methods, merely set the value of a field to a value specified through the argument to the

What are the components of struts, Struts components can be classify into M...

Struts components can be classify into Model, View and Controller: ? Model: Components like business logic /business processes and data are the type of model. ? View: HTML, J

Explain the java.net package, Explain The java.net package Each package...

Explain The java.net package Each package describes a number of classes, interfaces, exceptions, and errors. For instance, the java.net package contains these, classes, interfa

What is the role of the jms provider, The JMS provider handles security of ...

The JMS provider handles security of the messages, data conversion and the client triggering. The JMS provider verifies the level of encryption and the security level of the messag

Minimum shelfs, send me the java code for minimum shelf program

send me the java code for minimum shelf program

What does a simple spring application contain, These applications are like ...

These applications are like any Java application. They are made up of not many classes, each performing a particular purpose within the application. But these classes are configure

Write Your Message!

Captcha
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