Write an application class that contains several methods

Assignment Help JAVA Programming
Reference no: EM13192732

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.

Reference no: EM13192732

Questions Cloud

What role is government trying to play : What role is government trying to play here What is an externality How does the government of Costa Rica change an externality into a tool for economic development and caring for the environment. How does the government lead the market and lead ch..
Methanol and water or acetone are viable solvent systems : Water/methanol and water/acetone are viable solvent systems for recrystallization, but water/chloroform and water/pentane are not
What is the core issue in this interest group politics : What is the core issue in this interest group politics Which groups are pro limits Which groups would you imagine are lobbying against Are these peak associations or public interest groups What does Goldsmith mean by industry capture
Emergency control room for a call-logging component : Design the Requires and the Provides interfaces of at least two components that might be used in a system in an emergency control room for a call-logging component that records calls made.
Write an application class that contains several methods : Write a driver class. This class should use the main method to call four methods in the application class that will display our JOptionPanes - Write an application class that contains several methods.
State what kinetic energy must the electrons : What kinetic energy must the electrons have in order to resolve a protein molecule that is 2.30 nm in diameter? Take the mass of an electron to be 9.11× 10-31 kg.
State the equation for the relationship : Experiment you measured teh effect of changing temperature on the pressure of a conatined gas at constant volume.
How does business use politics : What is the evidence of wrongdoing here How does business use politics here Is this government failure Is this market failure Who benefits and how Who loses What is the role of the media
Chloride and water in the orginal solution for each trial : The question in the lab is asking what percentage by mass is the calcium, chloride and water in the orginal solution for each trial. In this lab we performed two trials, in each, we added 50 mL water to 2.0 g of CaCl2.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Correct example of inheritance

Which of the following relationships is not a correct example of inheritance?  Parent to Children  Aunt to Uncle  Grandparent to Grandchild

  Write java program to compute how much federal need to pay

Write a java application to calculate how much federal and state tax you need to pay. The program should accomplish the following task.

  Application that reads the lengths of sides of a triangle

Write a java application that reads the lengths of the sides of a triangle from the user.

  Complete the twins() method

Complete the twins() method, which takes an integer argument n and prints all the sets of twin primes that are less than n, one pair per line

  Implement a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

  Write a bag class with a generic type

Write a Bag class with a generic type. Write a class such as item that has a name and price. Add objects of item to the bag and find the average and the total of the price of all items in the bag.

  To report the amount of the fine

To report the amount of the fine, which is $25 for the first hour or pan of an hour that the car is illegally parked, plus $10 for every additional hour or part of an hour that the car is illegally parked

  Write a program displaying a text file that is in a text are

Write a program displaying a text file that is in a text area. The user enteres a file name in a text field and clicks the view button; the file is then displayed in the text area. Do not use BufferedInputStream.

  Write a java application to ask number of assignments

Write a java application that accomplishes the following tasks with built in exception handling: ask the number of homework assignment students have submitted in a semester

  Write java program to read present basic hourly wage

Write down a java program which will input 1. Read present basic hourly wage. Read in workers fist name and socond name.

  Ask the user to input a grade (integer from 1-100)

Program should still ask the user to input a grade (integer from 1-100) and then output the letter grade.  Scale:  Greater than 90 is an "A"; Greater than 80 to 90 is a "B", Greater than 70 to 80 is a "C", Greater than 60 to 70 is a "D", and 60 or le..

  Program with backtracking removing all gotos

Please fix the below program with backtracking removing all gotos  and also run the program before posting it and please comment before each line or explain such as what this line means or does .

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