Blessings Young

 

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

Part 1

Modify your Java application so that it is an easy-to-use GUI  application where all of the interaction is performed on one screen. You  will now take the individual components and translate them to a single  interactive GUI interface using the following GUI components, container,  the event listeners, and event subclasses to enhance your application  as a more GUI-appropriate interface:

  • GUI components  
  • Container  
  • Event listeners  
  • Event subclasses (at least 3–4 utilized)   

    ActionEvent  
    ItemEvent  
    FocusEvent  
    KeyEvent  
    MouseEvent  
    WindowEvent 

  • ActionPerformed Method 

Part 2

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

For this assignment, you are being asked to make sure you are  exception handling by verifying that all of the customer-entered  information is valid before the order is submitted to ensure order  accuracy. 

The customer information that the customer must now enter that should be validated includes the following:

  • Entered user name (must fill in a name)  
  • Entered at least one sub to order  
  • Selected all three attributes for sub (such as bread type, sub type, and sub size)  
  • Entered delivery address that includes street, city, state, and zip code  
  • Entered telephone number xxx-xxx-xxxx 

In this assignment, you are adding in error handling to make sure the customer is filling in all of the required information.

To accomplish this task, you will be utilizing the following Java classes:

  • Methods in the character class and StringBuilder class to validate and manipulate characters in a string  
  • Try… Catch for the exception handling of all input fields 

IP3/build.xml

Builds, tests, and runs the project IP3.

IP3/build/classes/.netbeans_automatic_build

IP3/build/classes/.netbeans_update_resources

IP3/build/classes/ip3/IP3.class
package ip3;
public synchronized class IP3 extends Sub {
public void IP3();
public static void main(String[]);
}

IP3/build/classes/ip3/Sub.class
package ip3;
public synchronized class Sub {
private String name;
private String address;
private String beverage;
private String bread;
private String type;
private String size;
public void Sub();
public void Sub(String, String);
public String getName();
public void setName(String);
public String getAddress();
public void setAddress(String);
public String getBeverage();
public void setBeverage(String);
public String getBread();
public void setBread(String);
public String getType();
public void setType(String);
public String getSize();
public void setSize(String);
}

IP3/manifest.mf
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build

IP3/nbproject/build-impl.xml

Must set src.dir
Must set test.src.dir
Must set build.dir
Must set dist.dir
Must set build.classes.dir
Must set dist.javadoc.dir
Must set build.test.classes.dir
Must set build.test.results.dir
Must set build.classes.excludes
Must set dist.jar

Must set javac.includes

No tests executed.

Must set JVM to use for profiling in profiler.info.jvm
Must set profiler agent JVM arguments in profiler.info.jvmargs.agent

Must select some files in the IDE or set javac.includes

To run this application from the command line without Ant, try:

java -jar “${dist.jar.resolved}”

Must select one file in the IDE or set run.class

Must select one file in the IDE or set run.class

Must select one file in the IDE or set debug.class

Must select one file in the IDE or set debug.class

Must set fix.includes

This target only works when run from inside the NetBeans IDE.

Must select one file in the IDE or set profile.class
This target only works when run from inside the NetBeans IDE.

This target only works when run from inside the NetBeans IDE.

This target only works when run from inside the NetBeans IDE.

Must select one file in the IDE or set run.class

Must select some files in the IDE or set test.includes

Must select one file in the IDE or set run.class

Must select one file in the IDE or set applet.url

Must select some files in the IDE or set javac.includes

Some tests failed; see details above.

Must select some files in the IDE or set test.includes

Some tests failed; see details above.

Must select some files in the IDE or set test.class
Must select some method in the IDE or set test.method

Some tests failed; see details above.

Must select one file in the IDE or set test.class

Must select one file in the IDE or set test.class
Must select some method in the IDE or set test.method

Must select one file in the IDE or set applet.url

Must select one file in the IDE or set applet.url

IP3/nbproject/genfiles.properties
build.xml.data.CRC32=379c7270
build.xml.script.CRC32=4880a0b6
build.xml.stylesheet.CRC32=8064a381@1.75.2.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=379c7270
nbproject/build-impl.xml.script.CRC32=43f0144f
nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48

IP3/nbproject/private/private.properties
compile.on.save=true
user.properties.file=C:\\Users\\Pete\\AppData\\Roaming\\NetBeans\\8.0.2\\build.properties

IP3/nbproject/private/private.xml

IP3/nbproject/project.properties
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processor.options=
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# Files in build.classes.dir which should be excluded from distribution jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/IP3.jar
dist.javadoc.dir=${dist.dir}/javadoc
excludes=
includes=**
jar.compress=false
javac.classpath=
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.processorpath=\
${javac.classpath}
javac.source=1.7
javac.target=1.7
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
main.class=ip3.IP3
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test

IP3/nbproject/project.xml

org.netbeans.modules.java.j2seproject

IP3

IP3/src/ip3/IP3.java
IP3/src/ip3/IP3.java
/*

 * To change this license header, choose License Headers in Project Properties.

 * To change this template file, choose Tools | Templates

 * and open the template in the editor.

 */

package
 ip3
;

import
 java
.
util
.
ArrayList
;

import
 javax
.
swing
.
JOptionPane
;

/**

 *

 * 
@author
 Pete

 */

public
 
class
 IP3 
extends
 
Sub
 
{

    
/**

     * 
@param
 args the command line arguments

     */

    
public
 
static
 
void
 main
(
String
[]
 args
)
 
{

        
ArrayList
< Sub >
 subList 
=
 
new
 
ArrayList
< Sub >
();

        
double
 totalCost 
=
 
0
;

        
double
 ordersCost 
=
 
0
;

        
String
 drinkType 
=
 
“Select Beverage:”

                
+
 
“\nEnter 1 for Coke”

                
+
 
“\nEnter 2 for Bottled Water”

                
+
 
“\nEnter 3 for Coffee”

                
+
 
“\nEnter 4 for Milkshake”
;

        

        
String
 bType 
=
 
“Select Bread:”

                
+
 
“\nEnter 1 for Whole Wheat”

                
+
 
“\nEnter 2 for White Bread”

                
+
 
“\nEnter 3 for Italian Bread”
;

        
String
 sType 
=
 
“Select Sandwich Type:”

                
+
 
“\nEnter 1 for BLT”

                
+
 
“\nEnter 2 for Italian Combo”

                
+
 
“\nEnter 3 for Vegetarian”

                
+
 
“\nenter 4 for Eggplant Parm”
;

        

        
String
 name 
=
 
JOptionPane
.
showInputDialog
(
“Enter Your Name”
);

        
String
 address 
=
 
JOptionPane
.
showInputDialog
(
“Enter Your Address”
);
   

        
String
 welcomeMsg 
=
 
“Welcome ”
 
+
 name 
+
 
” to\n”
 
+
 
“Famous Favorite Subs\n”
;

        
String
 choice 
=
 
“Y”
;

        
String
 output 
=
 
“”
;

        

        
while
 
(
“Y”
.
equalsIgnoreCase
(
choice
))
 
{

            
int
 drinkTypeInt 
=
 
Integer
.
parseInt
(
JOptionPane
.
showInputDialog
(
drinkType
));

            
String
 beverage 
=
 
“”
;

            
if
 
(
drinkTypeInt 
==
 
1
)
 
{

                beverage 
=
 
“Coke”
;

                totalCost 
=
 totalCost 
+
 
1
;

            
}
 
else
 
if
 
(
drinkTypeInt 
==
 
2
)
 
{

                beverage 
=
 
“Bottle Water”
;

            
}
 
else
 
if
 
(
drinkTypeInt 
==
 
3
)
 
{

                beverage 
=
 
“Coffee”
;

            
}
 
else
 
if
 
(
drinkTypeInt 
==
 
4
)
 
{

                beverage 
=
 
“Milkshake”
;

            
}

            

            
int
 breadTypeInt 
=
 
Integer
.
parseInt
(
JOptionPane
.
showInputDialog
(
bType
));

            
String
 bread 
=
 
“”
;

            
if
 
(
breadTypeInt 
==
 
1
)
 
{

                bread 
=
 
“Whole Wheat”
;

            
}
 
else
 
if
 
(
breadTypeInt 
==
 
2
)
 
{

                bread 
=
 
“White Bread”
;

            
}
 
else
 
if
 
(
breadTypeInt 
==
 
3
)
 
{

                bread 
=
 
“Italian Bread”
;

            
}
            

            

            
int
 sTypeInt 
=
 
Integer
.
parseInt
(
JOptionPane
.
showInputDialog
(
sType
));

            
String
 sandwichType 
=
 
“”
;

            
if
 
(
sTypeInt 
==
 
1
)
 
{

                sandwichType 
=
 
“BLT”
;

            
}
 
else
 
if
 
(
sTypeInt 
==
 
2
)
 
{

                sandwichType 
=
 
“Italian Combo”
;

            
}
 
else
 
if
 
(
sTypeInt 
==
 
3
)
 
{

                sandwichType 
=
 
“Vegitarian”
;

            
}
 
else
 
if
 
(
sTypeInt 
==
 
4
)
 
{

                sandwichType 
=
 
“Eggplant Parm”
;

            
}

            

            
String
 sizeType 
=
 
“Select Sandwich Size:”

                    
+
 
“\n enter 1 for Footlong”

                    
+
 
“\n enter 2 for six inch”
;

            
int
 sizeInt 
=
 
Integer
.
parseInt
(
JOptionPane
.
showInputDialog
(
sizeType
));

            
if
 
(
sizeInt 
==
 
1
)
 
{

                totalCost 
=
 totalCost 
+
 
6.25
;

            
}
 
else
 
if
 
(
sizeInt 
==
 
2
)
 
{

                totalCost 
=
 totalCost 
+
 
4
;

                

            
}

            

            
String
 size 
=
 sizeInt 
+
 
“”
;

            
Sub
 obj 
=
 
new
 
Sub
(
name
,
 address
);

            obj
.
setBeverage
(
beverage
);

            obj
.
setBread
(
bread
);

            obj
.
setType
(
sandwichType
);

            obj
.
setSize
(
size
);

            output 
+=
 
“\n\nBeverage : ”
 
+
 obj
.
getBeverage
()
 
+
 
“\nBread : ”
 
+
 obj
.
getBread
()
 
+
 
“\n Type : ”
 
+
 obj
.
getType
()
 
+
 
“\n Size : ”
 
+
 obj
.
getSize
()

                    
+
 
“\nSub Total: $”
 
+
 totalCost
;

            ordersCost 
=
 ordersCost 
+
 totalCost
;

            totalCost 
=
 
0
;

            choice 
=
 
JOptionPane
.
showInputDialog
(
“Does this conclude your order: (Y/N): ”
).
toUpperCase
();

        
}

        output 
=
 welcomeMsg 
+
 output

                
+
 
“\n\nTotal: ”
 
+
 ordersCost

                
+
 
“\n\nYour order will be delivered to:\n”
 
+
 address
;

        
JOptionPane
.
showMessageDialog
(
null
,
 output
);

    
}

}

        

        

        

        

        

        

        

        

        

    

    

IP3/src/ip3/Sub.java
IP3/src/ip3/Sub.java
/*

 * To change this license header, choose License Headers in Project Properties.

 * To change this template file, choose Tools | Templates

 * and open the template in the editor.

 */

package
 ip3
;

/**

 *

 * 
@author
 Pete

 */

public
 
class
 
Sub
 
{

    
private
 
String
 name
;

    
private
 
String
 address
;

    
private
 
String
 beverage
;

    
private
 
String
 bread
;

    
private
 
String
 type
;

    
private
 
String
 size
;

    
public
 
Sub
()
 
{

    
}

    

    
public
 
Sub
 
(
String
 name
,
 
String
 address
)
 
{

        
this
.
name 
=
 name
;

        
this
.
address 
=
 address
;
      

    
}

    
public
 
String
 getName
()
 
{

        
return
 name
;

    
}

    
public
 
void
 setName
(
String
 name
)
 
{

        
this
.
name 
=
 name
;

    
}

    
public
 
String
 getAddress
()
 
{

       
return
 address
;

   
}

   
public
 
void
 setAddress
(
String
 address
)
 
{

       
this
.
address 
=
 address
;

   
}

   
public
 
String
 getBeverage
()
 
{

       
return
 beverage
;

   
}

   
public
 
void
 setBeverage
(
String
 beverage
)
 
{

       
this
.
beverage 
=
 beverage
;

   
}

   
public
 
String
 getBread
()
 
{

       
return
 bread
;

   
}

   
public
 
void
 setBread
(
String
 bread
)
 
{

       
this
.
bread 
=
 bread
;

   
}

   
public
 
String
 getType
()
 
{

       
return
 type
;

       

   
}

   
public
 
void
 setType
(
String
 type
)
 
{

       
this
.
type 
=
 type
;

   
}

   
public
 
String
 getSize
()
 
{

       
return
 size
;

   
}

   
public
 
void
 setSize
(
String
 size
)
 
{

       
this
.
size 
=
 size
;

   
}

}

    

    

    

            

            

            

            

            

            

Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER