Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write code please. Do not use javax.swingutilities in the program. Assignment 3 GUI & Polymorphism Before attempting this project, be sure you have completed all

write code please. Do not use javax.swingutilities in the program.
image text in transcribed
image text in transcribed
image text in transcribed
Assignment 3 GUI \& Polymorphism Before attempting this project, be sure you have completed all the reading assignments, non-graded exercises, discussions, and assignments to date. Caution: This assignment uses GUI as part of the requirements. The GUI interface exists to make the display of the program look more user friendly. The GUI interface has nothing to do with the purpose of the program: to convert values from one mode to another. Do not consider making the GUl element the class for the assignment. Converter is the class of the program; GUI can be removed, and the program will still perform its task of converting. Many folks get caught up in working on the GUI part. Please put it in perspective: it is a tool to enhance the program and make it more user-friendly. There is only one java file for all the coding of this assignment allowed. Multiple java files are not acceptable. Design and implement Java program as follows: 1) Implement converter class hierarchy as follows: a. Converter class which includes: - Private attribute for input of data type double - Default constructor with no parameter which sets input to Double. NaN [Not a Number] - Overloaded constructor with input for parameter - Method convert) which returns input value b. TemperatureConverter class which is a child of Converter class and includes: - Constructors which call parent constructors - Overridden converto method to convert input Fahrnheit temperature to Celsius and returns the value. If the instance has no input value or not a number, it should return Double.NaN - Use the following formula for conversion: C=((F32)5)/9 c. DistanceConverter class which is a child of Converter class and includes: - Constructors which call parent constructors - Overridden converto method to convert input distance in miles to distance in kilometers and returss the value. If the instance has no input value or not a number, it should retur Double. NaN d. Use the following formula for conversion: KM=M=1.609 2) Do not use iavax.swing. SwingUtilities in this program. 3) Implement GUIConverter class using JFrame and JPanel as follows a. The window should be centered in the computer screen. [Hint: framesect LocationRelativeTo(null):] b. GUI will have 3 buttons: Distance, Temperature, and Exit that gencrate prompts. Please select which converter you would like: c. When user clicks Exit, the program will terminate. d. When user clicks Distance, an input dialog will pop up where user can type value and click OK. e. Once user clicks OK, message dialog will pop up. f. After review of the result, the OK is clicked the program returns to the original window. Converter Please select which converter you woald mhes 8. When user clicks on Temperature button, an input dialog will pop up to input value and then when clicks OK, the message dialog with pop up with converted result: ? Inpet fahreaheit temp to coovert to Celsius: h. The fomat for the windows should be appropriately sized. As a guideline for the window the three buttons should all be of the same dimension surrounded by not more than 1/4 or 1/2 inch of space. In this case, the two conversion buttons should be on one line and the Exit on another. All the buttons should be surrounded by not more than an inch of space. 4) There is a main 0 method at the end of the program. - The method begins with instantiation of the Converter class. - An Interface is displayed either in this anethod or ealled by another method. - The Interface will consist of the two options [Temperature and Distance] and an exit button. [See above illastration]. - The main 0 should be considered as a driver, that is, only the minimum number of code lines are in it. Most of the coding is done in methods that are outside of the main 0 method. SUGGESTIONS: - For the inpat dialog you can use JOption Pane.showinputDialog. - The Actiont istener for each Converter bution should create the appropriate Converter child instance, set the inpat, and call its convert 0 method. - For the pop up with coaverted value you can use JOption?ane shorvMessageDialog. Style as d ocamentationt. Make sure your Java program is using the recommended style ruch ai? - Javadoc comment up froot with your nume as author, date, and brief purpose of the proggan. - Comments for variables and blocks of code to describe major functionalaty (refer to the Documentation of Programs found in Week 1). - Meaningful variable names and prompts - 00 single character that is meaningless. CMsza?i Aswarinent ? Pase 3 bi 6 i Sairine 2ies Claci names are wnitien in upper CamelCaie Ccestants are written in All Capitals the proger spacing and aryby lines to make code moore bacr-triendly

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

Step: 3

blur-text-image

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

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions

Question

5. Wyeth Pharmaceuticals

Answered: 1 week ago