Home Tutorialhelp Comment need programme of following java1

 
 

Comment

rajesh jasani
need programme of following java1,
April 22, 2009 at 10:01 PM

JAVA 1

Objective: To use Swing widgets to develop a GUI
Write an application that presents a colorful ordering screen for Lonny’s Lucky Logos Inc. which sells selected items with team logos to sports arena shops. You will display JButtons for the logos available: Tigers ($2.00), Lions ($3.00), Pistons ($4.00) and Redwings($5.00). The buttons should have icons and text showing the price of each. You will display JCheckBox for the items available: Tee Shirts, Sweat Shirts and Caps. These will be labeled, but do not have to have icons The user may choose only ONE logo, but as many of the items as he wishes to make up a gift set. You will also have a JTextField where the user can enter how many of these sets he wants to order.
When he is finished he will press a done button. You will present a bill as shown in the JOptionPane – see sample screen below. When he has placed his order and seen his bill, he will press a clear button which will erase the Computer bill from the screen so that another user can place an order.






1.Globally declare:
The 6 JButtons, 4 JCheckBoxs and 1 JTextField, any JLabels you need
‘constants’ for the price of each logo as given above (private final double lionlogo=2.0;)
An int variable (numOrdered) to store the number to order entered in the JTextField
A cost (to strore the cost of the logo selected (initialize to 0)
An itemcost to accumulate the cost of all souvenir items ordereds(initialize to 0)
A String initialized to null to accumulate all output
Three Strings initialized to null: capStr, teeStr,sweatStr to store the item selected and to allow deselection
A contentPane
Any ImageIcons desired
private ImageIcon lionlogo = new ImageIcon("lionsp7.gif");
DecimalFormat $###.00 or NumberFormat using US currency
Any font desired
Font f1 = new Font("serif",Font.BOLD,72);
(to apply to any widget: myJLbl.setFont(f1);

2.Write the main
Create an object of this JFrame child, set its size, set its visiblilbty

3.Write the constructor to place all widgets on the screen similar to my example above.
a. Use FlowLayout for the easiest implementation.
b. create and add each widget in the order it should appear on the screen
c. Create an object of a class for handling JButtons (implements ActionListener) and one for handling JCheckBox objects (implements ItemListener) and register components appropriately.

4. in the event handler for JButtons:
Set the global generic cost variable to the selected logo cost based on the button that was clicked and assign to the global string variable an appropriate message and price , like
str = "Pistons @ $ "+df.format(cost); //where mf is an object of the NumberFormat class used for currency formatting
(Use chained if structure since only one of logo can be selected)

If the done button was clicked:
a. Extract the input from the JTextField and convert to integer.
b. Add to the String that is accumulating all your output the sum of the capStr, teeStr, sweatStr (if one or more has been deselected in the execution of the code, it will have a “” (null) value
c. Then add the cost of the logo and itemcost (see JCheckBox info below) and multiply by the number ordered. Output the string and the total cost in a JOptionPane as shown below.














If the clear button is clicked,
a. deslect each JCheckBox: jtb.setSelected(false);
b. set all accumulating variables to 0
c. set all strings to null, and
d. Set the JTextField value to “0”: jtf.setText("0");
e. and finally give the command: repaint(); to clear the screen


5. in the event handler for JCheckBoxs: accumulate values in the global generic variable itemcost

if that JCheckBox is selected, and append an appropriate message to the string, for example
itemcost += capcost;
capStr = "\nCap @ $ "+df.format(capcost);
if that JCheckBox is deselected,
subtract the cost from the itemcost variable and
set the capStr to null
(same logic for all JCheckBoxes)





View All Comments | View Tutorial
Advertisement
Related Tutorial and Articles
Tools For Java Technology

Introduction to java arrays
Introduction to java arrays   ... of Arrays in Java Programming language. You will learn how the Array class... arrays. To meet this feature java has provided an Array class which abstracts 

Java Tips and Examples

Introduction to java arrays
Introduction to java arrays     ... in Java Programming language. You will learn how the Array class in java  helps.... Structure of Arrays Now lets study the structure of Arrays in java. Array 

Java Tips and Examples

Introduction to Java Arrays
Introduction to Java Arrays     ... in Java Programming language. You will learn how the Array class in java  helps.... Structure of Arrays Now lets study the structure of Arrays in java. Array 

Java3D Questions

about java1
about java1  Sir, i want to know how we develop 3d button ,lable,textfield etc. in java . sir plz give one program as well Thank you 

Java Beginners

Arrays
Arrays   Hi I need help with the following exercises. Exercise 1: Write a Java application in which the user is prompted for the total number... of all the values as well. Exercise 2: Write a Java application in which you 

Java Tips and Examples

Introduction to Java Arrays
Introduction to Java Arrays       In this section you will be introduced to the concept of Arrays in Java Programming language. You will learn how the Array class in java  

Java Interview Questions

JAVA programme - Java Interview Questions
JAVA programme  Perpare a class "package_example" following the basic functionality of "string" type in JAVA.Use of dynamic character arrays for such class is encouraged.Following is expected from the programme: a.Use of 3 

JDBC Questions

JAVA programme - JDBC
JAVA programme  Prepare a class ?String_Example? following the basic functionality of ?String ?type of JAVA. Use of dynamic character arrays for such class is encouraged. Following is expected from the completed Program 

Java Beginners

programme - Java Beginners
programme  java programme to implement stack operation?use stack... visit the following link to get the stack implementation: http://www.roseindia.net/java/example/java/util/StackImplement.shtml Use following code 

Swing AWT

need a java program for the following
need a java program for the following  Write a java program with three horizontal sliders. Name the sliders, the first one as red, the second one as green and the third one as blue. You design the program such that on varying 

Java Beginners

java programme
java programme   1.....programme for reading 10 values for 10 variables using scanner class 2....declares all types of primitive data inside main method 

Java Beginners

lucky no programme - Java Beginners
lucky no programme   Sir , with due respect , iam a beginner level programmer i need some hint in making lucky no programmme . So please send me lucky no programmme on my mail 

Programming Tutorials

Introduction
; Introduction Applet is java program that can be embedded into HTML pages. Java applets runs on the java enables web browsers such as mozila and internet explorer... written in java programming language and embedded within HTML page. It run 

Java Beginners

java programme
java programme   i have to write a java programe that calculates the average of 10 students in Test 1 ,Test 2 and Test 3....Values of the marks in all the test for a student should be hardcore.Ialso have to tell the maixmum 

Java Beginners

Java programme
Java programme  Write a program to get student grade for 3 different subjects, and display the CGPA for them 

Java Beginners

java arrays
java arrays  i need a java program to store student details like id,name,addr,marks,average,total..using arrays..input data using scanner class and by using class, object and constructor 

Struts 2 Tutorials

Introduction To Application
in the examination he need to login on the website then, he / she can select the language... test paper of that particular language. For example- if he selects java the he can only see the java language test paper. After submitting the test paper he 

Java Beginners

please solve the programme
please solve the programme  Develop a java program to find the roots of a quadratic equation ax2+bx+c=0, with the following specification :- Class name :- Quad Data members float a,b,c,d, with a,b,c are the co-efficient 

Java Beginners

guys,, need help,, in java programing,, arrays
guys,, need help,, in java programing,, arrays  create a program where you will input 10 numbers and arrange it in ascending way using arrays 

Java Beginners

arrays
arrays  using arrays in methods   Java use arrays in methods import java.util.*; class ArrayExample{ public static int getMaxValue(int[] arr){ int maxValue = arr[0]; for(int i=1;i < arr.length;i 

Java Beginners

Arrays - Java Beginners
Arrays  I need to ask you for one more help with this. pLs Write a program called ThreeArrayLists.java that declares three arrayLists referenced..., 3, 5.4, 2.9 4.8.   Hi Friend, Try the following code: import 

Development process Questions

Need the Following MobileApplication Related Code
Need the Following MobileApplication Related Code  Hi, I need java coding for the following requirements in Collections.. Mobile Subscriber name...: and one Daemon Thread class need's to run while doing the above operations and if you 

Java Beginners

java arrays
java arrays  Suppose that you are required to store information about students for the module Data structures and Algorithms. The information... the following menu and allows a user to enter a value in the range 1 to 5: 1 

Java Interview Questions

Arrays
Implement Java code which takes 2 dimensional integer array as input and prints out heaviest island  Implement Java code which takes 2 dimensional integer array as input and prints out heaviest island 

Java Beginners

Arrays
Arrays  Write a program in java(BlueJ) to store the numbers in single dimensional array(S.D.A)into another S.D.A in reverse order of the location 

Java Beginners

arrays
arrays  public class Country{ string countryName; string location; int population; double area; } a.write a java statement to create an array of 10 country objects called mycountry using the Country class. b.Assuming 

Java Beginners

menu driven programme
menu driven programme   calculate the area of circle, square, rectangle in menu driven programme in java 

General

Introduction to the JSP Java Server Pages
source code. Introduction to JSP Java Server Pages or JSP... applications.   JSP Tutorials - Introducing Java Server Pages Technology JavaServer Pages (JSP) technology is the Java platform 

Java Beginners

Java programme - Java Beginners
Java programme  Develop a multi-threaded GUI application using java application 

Java Server Faces Questions

java programme - Java Server Faces Questions
java programme  Write a complete program, which prints all Fibonacci numbers that are less than 1600.  Hi Friend, Try the following code: public class FibonnaciSeries { public static void main(String[] args 

Java Tips and Examples

Arrays -- Multi-dimensional
Java NotesArrays -- Multi-dimensional All arrays in Java are really linear... from these, and Java has features in the language to help you do...] | | | +-----+-----+-----+-----+ +-----+ In Java two-dimensional arrays are implemented is a one-dimensional array 

Applet Questions

applet images sleeping programme - Applet
static int LINES = 50; public void init() { // create arrays to hold... -------------------------------------------------------- Read for more information. http://www.roseindia.net/java/example/java/applet/ Thanks 

General

Introduction to Java
Introduction to Java       This section introduces you the Java programming language. These days Java... the origin of Web.   Java as an Internet Language Java 

Date Calendar

Java programme - Date Calendar
Java programme  Can you provide me the coding for Date class provided by java util package 

General

Introduction to Generics in Java
Introduction to Generics in Java: What are the benefits of using Generics... for generic programming in the Java programming language. With the help of Generics... in the year 1998. Following is simple example of Generics in Java: List< 

Java Beginners

Problem on JAVA Programme
Problem on JAVA Programme  public class AA { int add(int i) { int y = i; y += 20; if (y <= 100){ y +=30;add(y);} System.out.println("Final Value of y : " + y); return y; } public static void main 

Programming Tutorials

Arrays in java
Arrays in java Arrays are the data structure of java , we use array where we need contiguous memory allocation. Array stores same type of data structure... an array of length 5.  For more details click here : Java Array Tutorial 

Java Beginners

Arrays in java
Arrays in java  what is param array in java 

Java-Tutorials

Introduction
Java as an Object Oriented Language       Introduction:  In this section, we.... But in case of java,  it is a fully Object Oriented language because 

Java Tips and Examples

Java Arrays Tutorial
download. Introduction to Java Arrays In this section you will be introduced to the concept of Arrays in Java Programming language. You... Java Arrays Tutorial       

General

Java Arrays Tutorials
(). Browse the following code to Learn Java Arrays in detail...The java.util.Arrays class helps the programmers to manipulating the arrays. It provides the methods to easily manipulate the arrays. Methods provided 

CVS Questions

hotel management programme in c language?
hotel management programme in c language?  hotel management programme in c language 

Programming Tutorials

An Overview of Java      Java is a programming language      Java is Object Oriented Programming
will be introduced to the concept of Arrays in Java Programming language. You...; Java as a programming language Java is an Object oriented application programming language developed by Sun Microsystems. Java is a very 

Java Interview Questions

arrays - Java Interview Questions
a program that take arrays A & B as input and find missing element in B array... then it should return -1?  Hi Friend, Try the following code: 1 

Java Beginners

java arrays
java arrays  can i know how can we intilize the three dimentional arrays in java? and how can we assign thae values to that array 

JavaScript Questions

javascript introduction for programmers
javascript introduction for programmers  A brief Introduction of JavaScript(web scripting language) for Java Programmers 

Java Beginners

arrays - Java Beginners
]; int num; Write Java statements that do the following: a. Call the method... components of the type int.What is stored in list after the following Java code 

Java Beginners

ARRAYS - Java Beginners
the following link: http://www.roseindia.net/tutorial/java/core/assignSeats.html... Friend, Try the following code: import java.io.*; import java.util.*; import 

Java Beginners

Arrays - Java Beginners
) with the following methods: promptUser // prompts user for int input loadArray // fills... your program  Hi Friend, Try the following code: import java.io. 

Java Beginners

Java with Arrays
Java with Arrays  I was given the assignment to create two parallel arrays; both of size 50 (declares 50 as a constant) One is an array of strings... and store it in the arrays. The input for the problem should be provided in a text 

Java Beginners

arrays - Java Beginners
and smallest with all the user inputs.   Hi Friend, Try the following 

JEE Technologies

Introduction to the Java Persistence API
Persistence Query Language The Java Persistence Query Language or simple JPQL... to introduce you about the Java Persistence API. The Java Persistence API is Java standard for persisting the Java Objects (Entity) to the relational database 

Java Beginners

java arrays
java arrays  how do you write the code for multipliying 2 double arrays to be in a 3rd double array? here is my code: package employeepay; /** * * @author Owner */ public class Main { /** * @param args the command line 

Java Beginners

Java using arrays - Java Beginners
Java using arrays  Write a program to input a possibly integer n(n<=10);followed by n real values into an array a of size n and the program must perform the following: Display back the values input Sort the values 

General

Introduction to Java Technology
Introduction to Java Technologies and what it can do? In this first tutorial I... the applications of various types. Java is Programming Language as it provides the API... on different operating system. Java as a Programming Language Java 

Hibernate-Tutorials

Introduction To Hibernate Query Language (HQL)
Introduction To Hibernate Query Language (HQL) In this tutorial you will learn about Hibernate Query Language. HQL is an abbreviation of Hibernate Query Language. It is a powerful query language, inspired by SQL that the Hibernate uses 

Java Beginners

java; arrays - Java Beginners
java arrays example  How can you create a program, by using arrays and the output would be X. by using char or string.Thank you 

Hibernate-Tutorials

Hibernate Query Language
Hibernate Query Language           Introduction to Hibernate Query Language Hibernate Query Language or HQL for short is extremely powerful query language. HQL 

Java Interview Questions

arrays program - Java Interview Questions
arrays program  how to write our own array program to find out n'th highest and n'th least i want source code plz replyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy  Hi Friend, Try the following 

Java Tips and Examples

Arrays
Java NotesArrays Java arrays are similar to ideas in mathematics An array... arrays Java 2 added anonymous arrays, which allow you to create a new array... by specifying a subscript or index. "Array" in Java means approximately the same 

Java Beginners

arrays in java - Java Beginners
arrays in java  Hi All, I have two arrays. in this two array some name are same. I want to merge those arrays into single. But while merging I want to delete duplicate entries. How merge those arrays. Thanks, mln15584 

Java Beginners

arrays part 2 - Java Beginners
arrays part 2  Question 2: Useful Array Algorithms and Operations (5 marks) Upgrade the program in Question 1 so that the program includes..., and prints the result.   Hi Friend, Try the following code: import 

Java Beginners

merge sorting in arrays - Java Beginners
merge sorting in arrays  Write a program to insert string or characters to an array and apply merge sorting on this array  Hi Friend, Please visit the following link: http://www.roseindia.net/java/beginners 

Java Technology Tutorials

Java Programming Language
Introduction to Java programming Language Java is one of the Object-Oriented... A. Gosling developed the Java programming language in the year 1995 at Sun... JME - For developing Mobile applications Java programming language In Java 

Java Tips and Examples

Arrays -- Examples
Java NotesArrays -- Examples This applet shows a number of methods that use arrays. The source code for the methods is also given below. This applet will not display correctly unless your browser supports Java 1.2. Sort 

Java Technology Tutorials

Object-Oriented Language: Java / APIs, Java OOPs
; of Java. This will give you brief introduction to the oops features of Java. Java is one of the useful Object Oriented programming language. Other Object... language. Java is used to develop desktop, mobile, web and embedded device 

General

Java Language
will be introduced to the concept of Arrays in Java Programming language. You will learn how... Java Language       Java Comments To comprehend any programming language 

General

Introduction to Collection Algorithms
Introduction to Collection Algorithms       Algorithms: The Collections and Arrays classes.... The  Java platform provides great majority of the algorithms to perform 

Java Tips and Examples

Arrays -- 2-dimensional
Java NotesArrays -- 2-dimensional Multi-dimensional arrays Java, as with most languages, supports multi-dimensional arrays - 1-dimensional, 2-dimensional... 2-dimensional arrays are processed with nested for loops. Notice in the following 

Programming Tutorials

Spring JDBC Introduction
a brief introduction about Spring DAO JDBC. The following table  describe...Spring JDBC Introduction The Spring's DAO(Data access object) make it easy... persistence technology without any overhead. Also you don't need to worry about 

Java-Tutorials

Introduction to Java
Java is an open source object oriented programming language... features it provide to them over other languages. Java is a simple language..., Mike Sheridan under James Goslings decided to develop a programming language 

Hibernate Tutorial Example

Hibernate Query Language
for the names of the Java Classes and properties. Hibernate Query Language is used... Hibernate Query Language       Hibernate Query Language or HQL for short is extremely powerful 

Java Beginners

Write a java program that prints out the following menu???
Write a java program that prints out the following menu???  Write a java program that prints out the following menu. Auser can interact with the menu.... 5. Enter two arrays of size 5, send them to function that returns true if equals 

Java Beginners

Concatenate 2D arrays
(); } }   Please visit the following link: http://www.roseindia.net/tutorial/java/poi/readExcelFile.html 

PHP Tutorial

PHP Introduction
In this section I will introduce you with the PHP scripting language. The PHP scripting language is cross-platform and can run on Windows, Linux, Mac, Solaris... source server-side scripting language, mostly used for the development of web 

Java-Tutorials

Arrays in java 7
This tutorial describes the concept of Arrays in java

Java Beginners

intersection of two java arrays
intersection of two java arrays  I am trying to figure out how to compare two arrays and get the intersection and put this into a third array of the correct size. I know how to copy the two arrays into the third array but am 

Java Beginners

How to concatenate two arrays in Java?
How to concatenate two arrays in Java?  How to concatenate two arrays in Java 

Java Beginners

arrays
arrays  can anyone help me out with this two programs plz?? in a main class ,create an array {4,34,5,3,6,8,1} remove 3 and 5th element and shift following left and adding zero at the end of array... another one is to search 

Java Beginners

reverse arrays in java
reverse arrays in java  how do i write a program in array of size n*m where both n and m are greater than 20 such that the 1st element of an array becomes the last and vice verse 

Java Beginners

reverse arrays in java
reverse arrays in java  how do i make a code that can be used to reverse the elements of an array in two dimension such that the last element of an array becomes the first element of the array and the first element of an array 

General

Introduction to POJO (Plain Old Java Object) Programming Model
Introduction to POJO (Plain Old Java Object) Programming Model.... Therefore, all normal Java objects are POJO?s only. The following classes... features of added by Sun Microsystems in EJB 3.0 is POJO (Plain Old Java 

Java Beginners

java language
java language  Define a class named Doctor whose objects are records for a clinic‚??s doctors. Derive this class from the class Person given in Listing 8.1. A Doctor record has the doctor‚??s name‚??defined in the class Person‚ 

General

Introduction to Collections Framework
: The Java Collections Framework provides the following benefits: Reduces... Introduction to Collections Framework   ... that consists the following collections:   Interfaces 

General

Introduction To Enterprise Java Bean(EJB). WebLogic 6.0 Tutorial.
  Introduction To Enterprise Java Bean... component-based distributed application using the java language. EJB... Applications with Enterprise Java Beans) (Online WebLogic 6.0 

Java Beginners

Need Help in Java programming
Need Help in Java programming  Hello. Can someone please help me with writing the following program Java program that gives assignment details such as:assignment number,assignment name,due date,submission date,percentage marks 

Java Technology Tutorials

Introduction to Java
Introduction to Java      ... Quickly Java is an object oriented programming language developed by Sun... as the Platform independent) is one of the important key feature of java language 

Java Beginners

covert the following using java
covert the following using java  how to convert (for eg : 2.89) . this decimal to binary in java 

Java Interview Questions

Arrays - Java Interview Questions
a program that take arrays A & B as input and find missing element in B array 

General

Basic Java Language Elements
you will be introduced to the concept of Arrays in Java Programming language... Basic Java Language Elements      ... in the program.   Java Comments To comprehend any programming language 

General

Using Beans in JSP. A brief introduction to JSP and Java Beans.
by following a few simple rules regarding method names. The Java BEAN...;     Java Beans Java Beans are reusable components 

Hibernate Tutorial Example

Introduction to Hibernate Framework
these principals of Java while working with the Hibernate framework. Following... Hibernate Tutorial: an introduction to Hibernate Framework, its features... of using Hibernate in your projects. What is Hibernate Framework? Hibernate is Java 

Training

Java Training and Tutorials, Core Java Training
Java Training and Tutorials, Core Java Training Introduction to online...; Java Language: Java Virtual... Tools: Java as a Programming Language 

Java Beginners

java 2d arrays
java 2d arrays  Create a program that will: a) Create the array and populate it with the given values. 9, 8 2, 17 49, 4 13, 119 2, 19 11, 47.... and if i do it manualy it is wrong. public class Arrays { public static void main 

Java Beginners

Please provide coding for following problem
Please provide coding for following problem  Please provide the coding for the following problem: You will write a java program that will read data... arrays: Firstname array, LastName array, and a score array. The output 

Java Interview Questions

How to add a file in GZIP file format in Java programme.
How to add a file in GZIP file format in Java programme.  Hi please help me. How to add a file GZIP File format in Java program. If example... in Gzip file format. For details visit http://www.roseindia.net/java/examples 

Java Beginners

arrays help - Java Beginners
arrays help  Write a program that sorts values. ? The program includes readIntegers() that o reads the user inputs o stores them in an array, and o returns the array   ? The program includes easySort() that o sorts 

Java Beginners

Need Help - Java Beginners
Need Help  Hello Sir, Am a beginner of Java. Also i did course... projects in Java as well as J2EE... Can u help me and guide to do a project.   Hi Friend, Please visit the following links: http 

Java Beginners

need a java program - Java Beginners
need a java program  Draw a bar chart for the following data using frames Year: 2000 2001 2002 2003 2004 2005 TurnOver:7 8 4 5 9 12 

General

Why Java as a programming Language?
Why Java as a programming Language?       Why Java as a  programming Language? Java is a general... programming Language? Java is a statically typed object-oriented language that uses 

Advertisements Advertisements
 

 

 

DMCA.com