Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

1) Write an application class that contains several methods. 

The first method should be named greeting () and should display a JOptionPane that is customized in the following ways (Figure 1):

  1. There should be no icon on this message box.
  2. The title bar on this message box should read "Welcome!"
  3. The message box should display "Welcome to my program!"

1429_Write an application.png

Figure 1

The second method should be named getName() and should display a JOptionPane that is customized in the following ways (Figure 2):

  1. There should be a question mark icon on this message box.
  2. The title bar on this message box should read "Name?"
  3. The message box should allow the user to input his or her name.

1898_Write an application1.png

Figure 2

The third method should be named getAge() and should display a JOptionPane that is customized in the following ways (Figure 3):

  1. There should be a question mark icon on this message box.
  2. The title bar on this message box should read "Age?"
  3. The message box should allow the user to input his or her age.

1570_Write an application2.png

Figure 3

The fourth method should be named displayMessages() and should display JOptionPanes as follows (Figure 4, Figure 5):

  1. The method should first display a JOptionPane with an information icon that has "Summary" as the title bar text.
  2. This message box should display the user's name (X) and age (Y) in the format "X, you are Y years old!"

494_Write an application3.png

Figure 4

  1. After the user closes the first message box, a second one should display that does the following:
    1. Displays a warning icon.
    2. Has "Guess What?" as the title bar text.
    3. Displays the message "In 10 years, you will be (correct age) years old!"

1085_Write an application4.png

Figure 5

  1. In order to accomplish this task, you will need to discover how to convert a String to an integer to perform the calculation.

Write a driver class. This class should use the main method to call four methods in the application class that will display our JOptionPanes.

Remember to write the source code for each class in a separate file which must have the same name as the class name with the extension '.java'.  Remember also that by convention, class names commence with a capital letter.

As with all programs you write, you should provide a well-structured solution that is easy to read.  You should use meaningful identifier names and should provide useful comments.  A large portion of the marks for this assignment will be for the structure of the classes, not whether they work correctly or not.

The focus of the assignment is for you to familiarise yourself with the Java concepts introduced in this seminar (classes, instances, instance methods, constructors, method calls, JOptionPanes, etc).

It is a good idea to work in a step by step top-down manner.  First define the general structure of a class with empty methods and compile the class.  Once it compiles successfully, then add further detail, recompiling after every few lines.  This way, the risk of getting several error messages at once is reduced.

Java, Programming

  • Category:- Java
  • Reference No.:- M9749978

Have any Question?


Related Questions in Java

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Answer the following question whats the difference public

Answer the following Question : What's the difference public inheritance and private inheritance? What can derived classes inherit from base classes? What cannot be inherited from base classes?

Can someone kindly help me to consider whether java

Can someone kindly help me to consider whether Java provides the facility of operator overloading? If it does, may you kindly describe how overloading operators can be accomplished? If not, may you kindly describe why yo ...

Object-oriented software development1 introduction 11

OBJECT-ORIENTED SOFTWARE DEVELOPMENT 1. Introduction 1.1 Assignment Requirement 1.2 Deliverables and Structure (what to submit) 1.3 Software Restrictions 1.4 How to score high... 1.5 Assumptions 2. System Requirements 2. ...

In ruby the hash class inherits from enumerable suggesting

In Ruby, the Hash class inherits from Enumerable, suggesting to a programmer that Hashes are collections. In Java, however, the Map classes are not part of the JCF (Java Collections Framework). For each language, provide ...

Retail price calculatorwrite a java program that asks the

Retail Price Calculator Write a JAVA program that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: (If an item's wholesale cost is 5. ...

Simple order processing systemquestion given the classes

Simple Order Processing System Question: Given the classes Ship (with getter and setter), Speedboat, and SpeedboatTest. Answer the following questions: Refine the whole application (all classes) and create Abstract class ...

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As