SlideShare a Scribd company logo
1 of 44
MARKETING EXAMPLE FINAL
1 Volvo's YCC opens its doors with a press of a button on the
car key, will parallel park the car with a self-steering system,
and has customized seat covers that can be removed and
washed. Many of these new product features were added
because Volvo sought ideas from
Answer
A.seasoned mechanics.
B.women drivers.
C.stunt drivers and professional racing car drivers.
D.loyal Volvo customers who had driven Volvos exclusively.
E.Loyal drivers of luxury automobiles other than Volvo.
2. When a small retail chain hires an accountant to do its
income taxes, the retail chain would have purchased a(n)
__________.
Answer
A.ancillary equipment
B. convenience product
C.specialty service
D.accessory personnel
E.industrial service
3. Legal counsel for patent information for a firm's research
department would most likely be classified as which type of
product?
Answer
A. ancillary equipment
B. convenience product
C. specialty services
D. accessory personnel
E. industrial services
4.
Figure 10-7 above represents the seven stages of the new-
product development process. Cubicle "2" represents the
__________ stage.
Answer
A. idea generation
B. screening and evaluation
C. business analysis
D. new-product strategy development
E. market testing
5. Which of the following is an example of an organizational
problem that can cause a new product failure?
Answer
A.Disproportionate creativity and out-of-the box thinking.
B. Too much input from different departments within the firm.
C.Intense brand recognition.
D. Excessive checks and balances prior to a new product
release.
E. Not really listening to the voice of the consumer.
6. Which of the following statements regarding goods is most
accurate?
Answer
A. In order to be classified as a product, an item must appeal to
all five senses.
B. Music is not considered a product because it only involves a
single sense-hearing.
C. In addition to appealing to the senses, some products also
have intangible attributes.
D. To market a product that contains visual attributes you
cannot use an auditory medium.
E. The aroma of chocolate chip cookies is considered a product
because it affects one's senses.
7. Which of the following is the best example of a people-base
service?
Answer
A.movie theaters
B.airlines
C.advertising agency
D.vending machines
E. taxis
8. Printer paper would be classified as which type of support
products?
Answer
a.installations
b.accessory equipment
c.supplies
d.services
e.raw materials
9. For six months, the Marriott Corporation sent a six-person
intelligence team to travel and stay at economy hotels around
the country. The purpose of this was
Answer
A.to allow the employees to reap the benefits of the new
product, Fairfield Inns, that their hard work and new-product
process had created.
B.to collect ideas from competitors' strengths and weaknesses
that could be used in their own new-product development
process.
C.check on the quality of their own product from the
perspective of a consumer.
D. to identify future members of the development team who had
shown innovation on their own in a traditionally standardized
environment.
E. identify individuals who used Marriott services but were only
one time users of the services.
10. The Vermont Teddy Bear Company sells handmade Teddy
bears designed to be given as gifts for almost every occasion
imaginable. The Love Bandit Bear is one bear designed for
people to give to each other on Valentine's Day. The Love
Bandit Bear is an example of a
Answer
A. product line.
B. product type.
C. product class.
D. product form.
E. product item.
11. Sara Burns is the owner of a company called Spice and was
looking for a new product to go with her company's line of food
condiments when a friend suggested combining spices with tea.
In the __________ stage of the new-product process, the spices
and tea mixtures were exposed to prospective consumers under
realistic purchase conditions.
Answer
A.idea generation
B.screening and evaluation
C.business analysis
D.market testing
E.commercialization
12. The new-product process an organization goes through to
identify business opportunities and convert them to a salable
good or service contains
Answer
A. three main steps: research, produce, and distribute.
B. four distinct steps: research, evaluate, produce, and
distribute.
C. five key phases ranging from idea generation to creating the
first prototype.
D. seven stages from new product strategy development to
commercialization.
E. three phases: planning, implementation, and control.
13. Mr. Clean is an antibacterial cleaning liquid for home use.
The manufacturer of Mr. Clean believed the addition of
Sparkling Apple-Scented Mr. Clean to the Mr. Clean product
line, would be
Answer
A.seen as a discontinuous innovation.
B.viewed as new from the company's perspective because it is a
product line extension.
C.viewed as a high-risk product line addition because it is new
to the market.
D.defined as new by the Federal Trade Commission for the
usual one-year period.
E.not seen as a new-product because it does not represent a
different stock keeping unit.
14. Why would the manufacturer of a new all-natural-ingredient
shampoo and conditioner put free samples of the product in
Sunday newspapers?
Answer
A.to simulate laggard usage of the product
B.to encourage product trial and adoption
C.to control innovation diffusion
D.to avoid any possibility of litigation
E.to circumvent the typical adoption cycle
15. FIGURE 11-2 Figure 11-2 above represents the stages of the
product life cycle. What does the curve labeled "BLUE"
represent in this graphic?Answer
A. total variable costs
B. total fixed costs
C. total industry profit
D.total industry revenue
E.total research and development costs
16. 3M is a master of _________ strategy. According to a 3M
manager, "we hit fast, price high, and get the heck out when the
me-too-products pour in."
A.penetration pricing
B.cost-plus pricing
C. ROI pricing
D.market-oriented pricing
E.skimming pricing
17. The FedEx brand suggests the possibility that it is
government sanctioned and fast. This perception is important
because of which unique characteristic of services?
A.Inventory costs.
B. Inseparability.
C. Inconsistency.
D.Intangibility.
E.Invisibility.
18. A strategy for managing a product's life cycle that attempts
to increase a product's use among existing customers, create
new use situations, or find new customers is referred to as
A.market modification.
B. product modification.
C.product repositioning.
D. customer orientation.
D.diversification.
19. Which of the following is the most important aspect
conveyed by the FedEx brand?
Answer
A.its international experience
B.the benefits provided by the service
C.the ownership of the company
D. the nonprofit aspect of the company
E.the patent for its service
20. To help differentiate a company's brand from competitors,
an improved version or new features are added to the original
design, and product proliferation occurs in the _________ stage
of the product life cycle.
Answer
A. introduction
B. growth
C. maturity
D. decline
E. harvest
21. Commuters in New York have often installed devices on
their cars that can be read automatically as they approach a
tollbooth. This saves time, improves traffic flow, and means
drivers don't need to keep suitable change in the car. It also
offers New York authorities the opportunity to manage traffic
flow by charging different toll amounts for different times of
day. Commuters in New York are experiencing
Answer
a. price gouging.
b. competitive pricing.
c. off-peak pricing.
d. internal marketing.
e. external marketing.
22. Four key challenges for package and label designers include
(1) cost reduction, (2) environmental concerns, (3) health,
safety, and security issues, and (4) _________.
Answer
a. a.governmental regulations
b. social and societal issues
c. competition from global markets
d. a continuing need to connect with customers
e. diminishing color, symbol, and trademark selections
23. Mars, Inc. sells Snickers, Milky Way, Twix, Skittles, Dove,
Starburst, M&Ms, and Three Musketeer candy. This variety of
names is typical of a __________ strategy.
Answer
a. co-branding
b. multibranding
c. multiproduct
d. mixed brand
e. private branding
24.Which of the following statements is most accurate?
Answer
a. The name Gatorade was chosen because as an energy drink it
"got you out the gate-fast." The name Gatorade was coined by a
team who lost to the FL Gators, attributing the Gator win to the
"aid" it got from the rehydrating beverage. The green color of
the original lemon-lime Gatorade conjured up a fast and strong
alligator in the water. The first five letters in Gatorade are the
initials of the product's inventors, with "ade" at the end
representing the product's
37
DeVry University
Online CIS355A
Course Project Guide
Business Systems Programming I--Course Project
· Project Description
· Analysis and Design
· User's Manual
· Minimum Requirements
· Sample Extended Requirements
Project Description
The importance of a graphical user interface in programming is
paramount in being successful in the business industry. This
project incorporates GUI techniques with other tools that you
have learned about in this class.
Here is your assignment: You work for a Landscape architect.
They have asked you to be a part of their team as they need a
computer programmer, analyst, and designer to aid them in
calculating engineering specification. Specifically, you have
been assigned to the Pools, Hot Tubs and Spas section of their
landscaping team. Your skills will be needed in creating a GUI
program that calculates engineering specifications.
This assignment is due in Week 7, but it is suggested that you
begin working on the course project assignment in Week 5,
which should give you ample time to complete the project. You
will find that all the lectures, Quick Test Programs, and Lab
assignments will prepare you for the course project.
Analysis and Design
In week 4, you will complete the analysis and design for the
project. You will use the information described in Chapter Two
(pages 48-49) to create the Analysis and Design documentation.
You will create the following items:
1. Request for New Application
2. Problem Analysis
3. List and description of the requirements
4. Interface Storyboard/drawing
5. Design Flowchart or pseudo code
The Analysis and Design document will be a single MS Word
document, which contains all descriptions and drawings.
User's Manual
Include a User's Manual: a Word document, with screenshots,
that explains how to run your application. Your mark will
depend both on the program quality, and the quality of the
User's Manual.
Here are some more detailed guidelines about the User's
Manual:
· It does not need to be long, probably not more than 10 pages,
including screenshots.
· Write it at the expected user's level - not too technical.
· Detail all the functionality that the application provides. Best,
structure you presentation top-down way.
· For each function, show what it its purpose and sample
execution, with a screenshot.
Minimum Requirements
This example would be the bare minimum to obtain a passing
grade (no more than a 75%):
This Swimming Pool Calculator is one that is very simple to
use. As you can see, it is a user interface that will allow the
user to enter the desired length, width, and average depth of a
pool and the program will calculate the volume of that pool
based on the entered information. This information is then
stored in a file that can be viewed. The interface contains four
text boxes for the user to enter information along with a
calculate and an exit button.
Entering Length of Pool
The length of the pool is entered here.
The user will be able to enter the length of the pool(in feet) in
the text box shown above. To enter information in the box, the
user must click in the desired box. The curser will appear
allowing the user to enter the appropriate information. To get to
the next box, all the user needs to do is either click with the
mouse the next box, or the user can hit the tab button on their
keyboard. Either method will move the cursor to the next input.
Entering the Width of the Pool
The width of the pool is entered here.
As with the length box, the width box is used in the same
fashion. The user will enter the width of the Pool(in feet) using
the keyboard. The user will then have the option to move to the
next box by either using the mouse and clicking in the average
box, or they can use the tab key on their keyboard. Either way
will move the cursor to the average depth box.
Entering the Average Depth
The average depth is entered here.
The user will now enter the average depth of the Pool(in feet).
This needs to be as exact a measurement as possible. If the user
only wants to know an about figure then the measurements do
not need to be as accurate. The more accurate the user needs the
volume to be, the more accurate the measurements need to be. If
a mistake is made, all the user needs to do is click the
backspace button on their keyboard and the entered information
will be deleted.
Calculating the Volume
The calculate button is clicked to calculate the volume of the
pool.
This is where the volume will be displayed
The final step is for the user to calculate the volume of the
Pool. This can be done in two ways. First, the user can click the
calculate button to calculate the volume of the pool. Second, the
user can use their keyboard and press Ctrl+C and the program
will calculate the volume.
Retrieving Data.Txt file
The Data.txt file is found here.
The Data.txt file can be retrieved by going into the workspace
file using Windows Explorer. Once there the user can click on
the Data file to retrieve the contents. The contents will be in
Word pad form, and will look like the following page.
The Data from the user input as it appears in the Data.txt file.
From this point, the user can either review the document or can
change any information. If the user desired, they could make
this document a read only document by going into the security
settings in Windows and setting the access. This should only be
done by the administrator.
Exiting the program
The program can also be closed by clicking here.
Exit the program by clicking here.
To exit the program, the user can do one of two things. First,
the user can click on the Exit button. This will close the
program. Two, the user can use the keyboard and click Ctrl+X.
Third, the user can click on the red X at the top of the interface.
Any of these methods will allow the program to close.
Below are some hints:
……
volume = length * width * depth; //Will calculate the volume of
the pool
volumeField.setText(num.format(volume));
//Will display the volume of the pool for the user
{
//Will write to the Data.txt file
try{
FileWriter fileW = new
FileWriter("Data.txt", true);
System.out.println("Writing data to
Data.txt file");
fileW.write("length:");
fileW.write(lengthField.getText());
fileW.write(",");
fileW.write(" ");
fileW.write("width:");
fileW.write(widthField.getText());
fileW.write(",");
fileW.write(" ");
fileW.write("avg depth:");
fileW.write(depthField.getText());
fileW.write(",");
fileW.write(" ");
fileW.write("volume:");
fileW.write(volumeField.getText());
fileW.write(",");
fileW.close();
FileReader fileR = new
FileReader("Data.txt");
BufferedReader buffIn = new
BufferedReader(fileR);
String textData = buffIn.readLine();
System.out.println(textData);
buffIn.close();
System.out.println("n");
}
catch(IOException e1)
{
JOptionPane.showMessageDialog(null,e1.getMessage(),
"ERROR",2); //Will display error message if unable to write to
file
}
}
Sample Extended Requirements
The following screenshots provide a sample of what is possible,
and could lead to a project worth the maximum grade of 100%.
Something to think about!!! Do not think this is what you have
to do to get the maximum number of points. It is just a sample!
You are only bound by your programming ability. Please do not
try and do more than you are capable of. Think, plan, design
and code YOUR course project. This is your opportunity to
show off your skills!
General Interface
The first panel simply displays today’s date – I opted to not
give the user the option to change this, as it uses the system
date. Since this is to be a generic tool, we give the user the
option to set the company name in the Options tab; doing so
will change “Enter a company name in the Options tab” to the
company name. An Exit button is provided in all tabs.
Mnemonic values are set for all buttons throughout the
application. I opted for a few different error-catching options
rather than a consistent one throughout the application, just to
show some extra functionality. All tabs can easily be set to
behave identically.
Options tab
This tab allows the user to enter a company name. Hitting Set
New Name will change the window’s title to whatever was
entered.
The result:
Customers tab
General
This tab allows the user to add new customers. It will display
the existing customers in the main area.
Functionality
General
The program checks for the existence of the customer.txt file in
the directory where the program is located. If the file does not
exist, the program tells the customer in the Message Area at the
bottom. The Customer Display will give a brief explanation of
options.
Customer Display
Message Area
Add Customer
In this window, the user can enter customers. Again, the
Message Area will display program message. The State
selection contains a list of all US state abbreviations. No error
checking is performed here, as we are dealing with strings – the
information will be stored literally as entered.
Message Area
Selecting Add Customer will attempt to write the information to
customer.txt. If the file is write-protected, the Message Area
will inform the user. If the file does not exist, it is created. If
the file already exists and can be written to, the information
will be appended to the file. Fields are not emptied when
focused on (this can easily be changed).
Successful customer addition
Below is an example of the situation where the file already
exists and can be written to; notice the message in the Message
Area:
The Delete File option gives the user the option to delete the
customer.txt file. If the file does not exist, the Message Area
will inform the user after Yes has been selected. If No is
selected, the Customer File Deletion window simply closes.
After a customer has been added and the Customers window is
closed, the user selects Refresh to refresh the Customer Display
area, which will display the contents of the customer.txt file. It
can be changed to automatically refresh the contents, but I
preferred to give the user some more control.
Contractor tab
The Contractor tab functions in exactly the same way as the
Customers tab. The file name for contractors is contractor.txt.
Pools tab
General
This tab allows for pool volume calculation. It assumes pools
are rectangular (round- and oval-shaped pools/tubs can be
calculated in the Hot Tubs tab.
Functionality
After a length, width, and depth have been entered, the user
clicks Calculate Volume and the program will display the
calculated volume (length * width * depth in cubic feet).
Anomalies caught are no input and invalid input. The user is
limited to entering only numbers and periods.
No input:
Fields not filled out
Message Area
Invalid input:
Message Area
Invalid Input
Combination invalid input/no input:
Hot Tubs tab
General
This tab allows for round and oval tubs’ volumes to be
calculated.
Functionality
When Round Tub is selected, the user cannot fill out the width
field, as it should be the same as the length (since we’re dealing
with a circle). After filling out the length and tub fields, the
Calculate Volume button will display the volume (Pi *
((length/2)^2) * depth). The width is automatically set to the
same value as the length, and the user is informed.
Again, invalid input is caught (only numbers and periods are
allowed), and the program will display the same error messages
as the Pools tab.
Automatically set to same value as length
When Oval Tub is selected, the width field is opened up:
Again, the same error messages are displayed in case of no
input/invalid values.
Formula used is Pi * (length * .5) * (width * .5) * depth;
Temp Calc tab
General
This tab offers a temperature converter (Celsius <->
Fahrenheit).
Functionality
Opposite values
The user enters a temperature, and selects either C or F. The
field after the Result display will display the opposite (if C is
selected, field will display F; if F is selected, field will display
C). I took a different approach for the System Messages here,
but the principle is the same. In this tab, the temperature value
will be automatically set to zero in case of invalid input or no
input.
No input:
Value automatically set to zero in case of no input/invalid input
Length Calc tab
General
This tab offers the user a length converter (millimeters, meters,
yards, feet, and inches).
Functionality
The user fills out one of the fields (only numerical values and
the period are allowed), and hits Convert. Only one of the
fields can be filled out at any time (changing the focus will
delete the other fields).
“Feet” was filled out; all other values are automatically
populated
The end…
In order to get full credit which is 100 points, you need to
provide a lot of extra functionalities. I prepared the following 4
examples to assist you.
1. The JTabbedPane class
2. Checkboxes and radio buttons
3. Lists and combo boxes
4. Scrollbars and sliders
The JTabbedPane Class
If you've ever dealt with the Control Panel in Windows, you
already know what a JTabbedPane is. It's a container with
labeled tabs. When you click on a tab, a new set of controls is
shown in the body of the JTabbedPane. In Swing, JTabbedPane
is simply a specialized container.
Each tab has a name. To add a tab to the JTabbedPane, simply
call addTab(). You'll need to specify the name of the tab as well
as a component that supplies the tab's contents. Typically, it's a
container holding other components.
Even though the JTabbedPane only shows one set of
components at a time, be aware that all the components on all
the pages are in memory at one time. If you have components
that hog processor time or memory, try to put them into some
"sleep" state when they are not showing.
The following example create five tabs, each tab have their own
components.
import java.awt.*;
import javax.swing.*;
public class TabDemo extends JFrame
{
public TabDemo()
{
super( "JTabbedPane Demo " );
JTabbedPane tab = new JTabbedPane();
// constructing the first panel
JLabel l1 = new JLabel( "Welcome to CIS355A",
SwingConstants.CENTER );
JPanel p1 = new JPanel();
p1.add( l1 );
tab.addTab( "Tab#1", null, p1, " Panel #1" );
// constructing the second panel
JLabel l2 = new JLabel("Welcome to JTabbedPaneDemo",
SwingConstants.CENTER);
JPanel p2 = new JPanel();
p2.setBackground( Color.blue );
p2.add( l2 );
tab.addTab( "Tab#2", null, p2, " Panel #2" );
// constructing the third panel
JLabel l3 = new JLabel( " Java is sooooooooooo fun!" );
JPanel p3 = new JPanel();
p3.setLayout( new BorderLayout() );
p3.add( new JButton( "J" ), BorderLayout.NORTH );
p3.add( new JButton( "A" ), BorderLayout.WEST );
p3.add( new JButton( "V" ), BorderLayout.EAST );
p3.add( new JButton( "A" ), BorderLayout.SOUTH );
p3.add( l3, BorderLayout.CENTER );
tab.addTab( "Tab#3", null, p3, " Panel #3" );
// constructing the fourth panel
JLabel l4 = new JLabel( "panel four" );
JPanel p4 = new JPanel();
p4.setBackground( Color.black );
JLabel digits = new JLabel( "Java" );
digits.setFont( new Font( "Serif", Font.ITALIC, 50 ) );
digits.setForeground( Color.blue );
p4.add( digits );
tab.addTab( "Tab#4", null, p4, " Panel #4" );
// constructing the last panel
JLabel l5 = new JLabel( "panel five" );
JLabel l6 = new JLabel( "The end!" );
JPanel p5 = new JPanel();
p5.add( l6 );
tab.addTab( "Tab#5", null, p5, " Panel #5" );
// add JTabbedPane to container
getContentPane().add( tab );
setSize( 250, 200 );
setVisible( true );
}
public static void main( String args[] )
{
TabDemo demo = new TabDemo();
demo.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
}
}
Checkboxes and Radio Buttons
A checkbox is a labeled toggle switch. Each time the user clicks
it, its state toggles between checked and unchecked. Swing
implements the checkbox as a special kind of button. Radio
buttons are similar to checkboxes, but they are normally used in
groups. Clicking on one radio button in the group automatically
turns the others off. They are named for the mechanical preset
buttons on old car radios (like some of us had in high school).
Checkboxes and radio buttons are represented by instances of
JCheckBox and JRadioButton, respectively. Radio buttons can
be tethered together using an instance of another class called
ButtonGroup . By now you're probably well into the swing of
things (no pun intended) and could easily master these classes
on your own. We'll use an example to illustrate a different way
of dealing with the state of components and to show off a few
more things about containers.
A JCheckBox sends ItemEvent s when it's pushed. Because a
checkbox is a kind of button, it also fires ActionEvents when
checked. For something like a checkbox, we might want to be
lazy and check on the state of the buttons only at some later
time, such as when the user commits an action. For example,
when filling out a form you may only care about the user's
choices when the submit button is pressed.
DriveThrough prints the results when we press the Place Order
button. Therefore, we can ignore all the events generated by our
checkboxes and radio buttons and listen only for the action
events generated by the regular button. //file:
DriveThrough.javaimport java.awt.*;import
java.awt.event.*;import javax.swing.*;public class
DriveThrough { public static void main(String[] args) {
JFrame frame = new JFrame("Lister v1.0"); JPanel
entreePanel = new JPanel( ); final ButtonGroup entreeGroup
= new ButtonGroup( ); JRadioButton radioButton;
entreePanel.add(radioButton = new JRadioButton("Beef"));
radioButton.setActionCommand("Beef");
entreeGroup.add(radioButton); entreePanel.add(radioButton =
new JRadioButton("Chicken"));
radioButton.setActionCommand("Chicken");
entreeGroup.add(radioButton); entreePanel.add(radioButton =
new JRadioButton("Veggie", true));
radioButton.setActionCommand("Veggie");
entreeGroup.add(radioButton); final JPanel condimentsPanel
= new JPanel( ); condimentsPanel.add(new
JCheckBox("Ketchup")); condimentsPanel.add(new
JCheckBox("Mustard")); condimentsPanel.add(new
JCheckBox("Pickles")); JPanel orderPanel = new JPanel( );
JButton orderButton = new JButton("Place Order");
orderPanel.add(orderButton); Container content =
frame.getContentPane( ); content.setLayout(new
GridLayout(3, 1)); content.add(entreePanel);
content.add(condimentsPanel); content.add(orderPanel);
orderButton.addActionListener(new ActionListener( ) {
public void actionPerformed(ActionEvent ae) { String
entree = entreeGroup.getSelection( ).getActionCommand(
); System.out.println(entree + " sandwich");
Component[] components = condimentsPanel.getComponents(
); for (int i = 0; i < components.length; i++) {
JCheckBox cb = (JCheckBox)components[i]; if
(cb.isSelected( )) System.out.println("With " +
cb.getText( )); } } });
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setSize(300, 150); frame.setVisible(true); }}
DriveThrough lays out three panels. The radio buttons in the
entreePanel are tied together through a ButtonGroup object. We
add() the buttons to a ButtonGroup to make them mutually
exclusive. The ButtonGroup object is an odd animal. One might
expect it to be a container or a component, but it isn't; it's
simply a helper object that allows only one RadioButton to be
selected at a time.
In this example, the button group forces you to choose a beef,
chicken, or veggie entree, but not more than one. The condiment
choices, which are JCheckBoxes, aren't in a button group, so
you can request any combination of ketchup, mustard, and
pickles on your sandwich.
When the Place Order button is pushed, we receive an
ActionEvent in the actionPerformed() method of our inner
ActionListener. At this point, we gather the information in the
radio buttons and checkboxes and print it. actionPerformed()
simply reads the state of the various buttons. We could have
saved references to the buttons in a number of ways; this
example demonstrates two. First, we find out which entree was
selected. To do so, we call the ButtonGroup's getSelection()
method. This returns a ButtonModel, upon which we
immediately call getActionCommand(). This returns the action
command as we set it when we created the radio buttons. The
action commands for the buttons are the entrée names, which is
exactly what we need.
To find which condiments were selected, we use a more
complicated procedure. The problem is that condiments aren't
mutually exclusive, so we don't have the convenience of a
ButtonGroup. Instead, we ask the condiments JPanel for a list of
its components. The getComponents() method returns an array
of references to the container's child components. We'll use this
to loop over the components and print the results. We cast each
element of the array back to JCheckBox and call its isSelected()
method to see if the checkbox is on or off. If we were dealing
with different types of components in the array, we could
determine each component's type with the instanceof operator.
Or, more generally, we could maintain references to the
elements of our form in some explicit way (a map by
name,perhaps).
Lists and Combo Boxes
JLists and JComboBoxes are a step up on the evolutionary chain
from JButtons and JLabels. Lists let the user choose from a
group of alternatives. They can be configured to force a single
selection or allow multiple choices. Usually, only a small group
of choices is displayed at a time; a scrollbar lets the user move
to the choices that aren't visible. The user can select an item by
clicking on it. She can expand the selection to a range of items
by holding down Shift and clicking on another item. To make
discontinuous selections, the user can hold down the Control
key instead of the Shift key (on a Mac, this is the Command
key).
A combo box is a cross-breed between a text field and a list. It
displays a single line of text (possibly with an image) and a
downward pointing arrow on one side. If you click on the arrow,
the combo box opens up and displays a list of choices. You can
select a single choice by clicking on it. After a selection is
made, the combo box closes up; the list disappears, and the new
selection is shown in the text field.
Like other components in Swing, lists and combo boxes have
data models that are distinct from visual components. The list
also has a selection model that controls how selections may be
made on the list data.
Lists and combo boxes are similar because they have similar
data models. Each is simply an array of acceptable choices. This
similarity is reflected in Swing, of course: the type of a
JComboBox's data model is a subclass of the type used for a
JList's data model. The next example demonstrates this
relationship.
The following example creates a window with a combo box, a
list, and a button. The combo box and the list use the same data
model. When you press the button, the program writes out the
current set of selected items in the list.
Here's the code for the example://file: Lister.javaimport
java.awt.*; import java.awt.event.*;import javax.swing.*;public
class Lister { public static void main(String[] args) { JFrame
frame = new JFrame("Lister v1.0"); // create a combo box
String [] items = { "uno", "due", "tre", "quattro", "cinque",
"sei", "sette", "otto", "nove", "deici", "undici",
"dodici" }; JComboBox comboBox = new JComboBox(items);
comboBox.setEditable(true); // create a list with the same data
model final JList list = new JList(comboBox.getModel( ));
// create a button; when it's pressed, print out // the selection
in the list JButton button = new JButton("Per favore");
button.addActionListener(new ActionListener( ) { public
void actionPerformed(ActionEvent ae) { Object[] selection
= list.getSelectedValues( ); System.out.println("-----");
for (int i = 0; i < selection.length; i++)
System.out.println(selection[i]); } }); // put the controls
the content pane Container c = frame.getContentPane( );
JPanel comboPanel = new JPanel( );
comboPanel.add(comboBox); c.add(comboPanel,
BorderLayout.NORTH); c.add(new JScrollPane(list),
BorderLayout.CENTER); c.add(button,
BorderLayout.SOUTH); frame.setSize(200, 200);
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setVisible(true); } }
The combo box is created from an array of strings. This is a
convenience—behind the scenes, the JComboBox constructor
creates a data model from the strings you supply and sets the
JComboBox to use that data model. The list is created using the
data model of the combo box. This works because JList expects
to use a ListModel for its data model, and the ComboBoxModel
used by the JComboBox is a subclass of ListModel.
The button's action event handler simply prints out the selected
items in the list, which are retrieved with a call to
getSelectedValues(). This method actually returns an object
array, not a string array. List and combo box items, like many
other things in Swing, are not limited to text. You can use
images, drawings, or some combination of text and images.
You might expect that selecting one item in the combo box
would select the same item in the list. In Swing components,
selection is controlled by a selection model. The combo box and
the list have distinct selection models; after all, you can select
only one item from the combo box while it's possible to select
multiple items from the list. Thus, while the two components
share a data model, they have separate selection models.
We've made the combo box editable. By default, it would not be
editable: the user could choose only one item in the drop-down
list. With an editable combo box, the user can type in a
selection, as if it were a text field. Noneditable combo boxes are
useful if you just want to offer a limited set of choices; editable
combo boxes are handy when you want to accept any input but
offer some common choices.
There's a great class tucked away in the last example that
deserves some recognition. It's JScrollPane. In Lister, you'll
notice we created one when we added the List to the main
window. JScrollPane simply wraps itself around another
Component and provides scrollbars as necessary. The scrollbars
show up if the contained Component's preferred size (as
returned by getPreferredSize() ) is greater than the size of the
JScrollPane itself.
The following example combins all the above choice boxes and
layout managers in one application – Language.
import java.awt.*;
import javax.swing.*;
public class Language extends JFrame {
private JButton button1, button2, button3, button4;
private JCheckBox check1, check2, check3, check4;
private JRadioButton radio1, radio2, radio3;
private ButtonGroup radioGroup;
private JComboBox comboBox;
private JLabel label1, label2;
private JPanel panel1, panel2, panel3, panel4, panel5,panel6,
panel7, panel8;
public Language()
{
super( "Language Choice" );
// build left north panel
label1 = new JLabel( "My favorite language" );
panel1 = new JPanel();
panel1.setLayout( new FlowLayout( FlowLayout.LEFT ) );
panel1.add( label1 );
// build right east panel
button1 = new JButton( "Reset" );
button2 = new JButton( "Clear" );
button3 = new JButton( "Confirm" );
button4 = new JButton( "Help" );
panel2 = new JPanel();
panel2.setLayout( new GridLayout( 4, 1, 5, 5 ) );
panel2.add( button1 );
panel2.add( button2 );
panel2.add( button3 );
panel2.add( button4 );
// build left south panel
label2 = new JLabel( "Class " );
comboBox = new JComboBox();
comboBox.addItem( "CIS170" );
comboBox.addItem( "CIS247" );
comboBox.addItem( "CIS355" );
check1 = new JCheckBox( "Currently taking" );
panel3 = new JPanel();
panel3.setLayout( new FlowLayout( FlowLayout.CENTER, 10,
0 ) );
panel3.add( label2 );
panel3.add( comboBox );
panel3.add( check1 );
// build left east panel
check2 = new JCheckBox( "C++" );
check3 = new JCheckBox( "C#" );
check4 = new JCheckBox( "Java", true );
panel4 = new JPanel();
panel4.setLayout( new BorderLayout( ) );
panel4.add( check2, BorderLayout.NORTH );
panel4.add( check3, BorderLayout.CENTER );
panel4.add( check4, BorderLayout.SOUTH );
// build left west panel
panel5 = new JPanel();
panel5.setLayout( new BorderLayout() );
panel5.add( radio1 = new JRadioButton( "Strongly
Recommend",true ), BorderLayout.NORTH );
panel5.add( radio2 = new JRadioButton( "Recommend", false
),BorderLayout.CENTER );
panel5.add( radio3 = new JRadioButton( "Not Recommend",
false ),BorderLayout.SOUTH );
// group the radio buttons
radioGroup = new ButtonGroup();
radioGroup.add( radio1 );
radioGroup.add( radio2 );
radioGroup.add( radio3 );
// build left center
panel8 = new JPanel();
panel8.setLayout( new FlowLayout( FlowLayout.CENTER, 30,
0 ) );
panel8.setBackground( Color.white );
panel8.add( panel4 );
panel8.add( panel5 );
// setup left panel
panel6 = new JPanel();
panel6.setLayout( new BorderLayout() );
panel6.add( panel1, BorderLayout.NORTH );
panel6.add( panel8, BorderLayout.CENTER );
panel6.add( panel3, BorderLayout.SOUTH );
// setup layout
panel7 = new JPanel();
panel7.setLayout( new FlowLayout( FlowLayout.CENTER, 10,
0 ) );
panel7.add( panel6 );
panel7.add( panel2 );
getContentPane().add( panel7 );
setSize( 500, 160 );
setVisible( true );
} // end constructor
public static void main( String args[] )
{
Language myChoice = new Language();
myChoice.setDefaultCloseOperation( EXIT_ON_CLOSE );
}
}
Scrollbars and Sliders
JScrollPane is such a handy component that you may not ever
need to use scrollbars by themselves. In fact, if you ever do find
yourself using a scrollbar by itself, chances are you really want
to use another component called a slider.
There's not much point in describing the appearance and
functionality of scrollbars and sliders. Instead, let's jump right
in with an example that includes both components. The
following case shows a simple example with both a scrollbar
and a slider.
//file: Slippery.javaimport java.awt.*;import
java.awt.event.*;import javax.swing.*;import
javax.swing.event.*;public class Slippery { public static void
main(String[] args) { JFrame frame = new JFrame("Slippery
v1.0"); Container content = frame.getContentPane( );
JPanel main = new JPanel(new GridLayout(2, 1)); JPanel
scrollBarPanel = new JPanel( ); final JScrollBar scrollBar =
new JScrollBar(JScrollBar.HORIZONTAL, 0, 48, 0, 255); int
height = scrollBar.getPreferredSize( ).height;
scrollBar.setPreferredSize(new Dimension(175, height));
scrollBarPanel.add(scrollBar); main.add(scrollBarPanel);
JPanel sliderPanel = new JPanel( ); final JSlider slider =
new JSlider(JSlider.HORIZONTAL, 0, 255, 128);
slider.setMajorTickSpacing(48);
slider.setMinorTickSpacing(16); slider.setPaintTicks(true);
sliderPanel.add(slider); main.add(sliderPanel);
content.add(main, BorderLayout.CENTER); final JLabel
statusLabel = new JLabel("Welcome to Slippery v1.0");
content.add(statusLabel, BorderLayout.SOUTH); // wire up
the event handlers scrollBar.addAdjustmentListener(new
AdjustmentListener( ) { public void
adjustmentValueChanged(AdjustmentEvent e) {
statusLabel.setText("JScrollBar's current value = "
+ scrollBar.getValue( )); } });
slider.addChangeListener(new ChangeListener( ) { public
void stateChanged(ChangeEvent e) {
statusLabel.setText("JSlider's current value = "
+ slider.getValue( )); } }); frame.pack( );
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setVisible(true); }}
All we've really done here is added a JScrollBar and a JSlider to
our main window. If the user adjusts either of these
components, the current value of the component is displayed in
a JLabel at the bottom of the window.
The JScrollBar and JSlider are both created by specifying an
orientation, either HORIZONTAL or VERTICAL. You can also
specify the minimum and maximum values for the components,
as well as the initial value. The JScrollBar supports one
additional parameter, the extent. The extent simply refers to
what range of values is represented by the slider within the
scroll bar. For example, in a scrollbar that runs from 0 to 255,
an extent of 128 means that the slider will be half the width of
the scrollable area of the scrollbar.
JSlider supports the idea of tick marks, lines drawn at certain
values along the slider's length. Major tick marks are slightly
larger than minor tick marks. To draw tick marks, just specify
an interval for major and minor tick marks, and then paint the
tick marks: slider.setMajorTickSpacing(48);
slider.setMinorTickSpacing(16); slider.setPaintTicks(true);
JSlider also supports labeling the ticks with text strings, using
the setLabelTable() method.
Responding to events from the two components is
straightforward. The JScrollBar sends out AdjustmentEvents
every time something happens; the JSlider fires off
ChangeEvents when its value changes. In our simple example,
we display the new value of the changed component in the
JLabel at the bottom of the window.
Grading scales of Course Project
The following grading rubrics are provided for each major
phase of the Course Project.
1. User's Manual
Points
Description
Sufficient length to describe the application
4
Manual contains explanation in detail of all relevant areas of
the application
Contains screen shots of the key interface components
4
Images of each section of the application
Operations are explained
4
Detailed operation of each section of the application
Written to the user's level and is not technical
4
Must not contain code or any other technical items irrelevant to
the users
Analysis and design contain sufficient detail to begin
construction
4
Application analysis and design contains enough details about
the application
Subtotal
20
2. Minimum Requirements
Points
Description
Standard header included
2
Must contain program's name, student name, and description of
the program
Program compiles
2
Program does not have any error
Program executes
2
Program runs without any error
Created main form
3
Main method exists
Created length label
3
Length label
Created length textbox
3
Length input text box
Created width label
3
Width label
Created width textbox
3
Width input text box
Created depth label
3
Depth label
Created depth textbox
3
Depth input text box
Created volume label
3
Volume label
Created volume textbox
3
Volume input text box. Make sure this field is read only.
Created Calculate button
3
Calculate Volume button
Created Calculate button event handler
3
Code to handle the Calculate Volume button. Must handle non-
numeric input and null input.
Created Exit button
3
Exit button
Created Exit button event handler
3
Code to handle the Exit button. Must exit the application and
terminate the program.
Correct output is displayed
10
When values are entered, the correct results are shown. If no
values or non-numeric values are entered, the proper error
message should display.
Subtotal
55
3. Extended Requirements
Points
Description
Included at least two additional tabs
5
There must be two or more additional tabs as shown under the
Course Project Interface document.
Each operation is implemented in its own class
10
Each button and/or text field event handler code must be
implemented in its own class.
Extended operations and classes work as expected
10
The implemented extra tabs must work as expected.
Subtotal
25
Course Project Total
Points
Description
Complete Project
100
User's Manual, Pools tab, and Extended Requirements
Course Project Examples
This document provide a sample of what is possible, and could
lead to a project worth the maximum grade of 100% Something
to think about! Do not think this is what you have to do to get
the maximum number of points. It is just a sample! You are
only bound by your programming ability. Please do not try and
do more than you are capable of. Think, plan, design and code
YOUR project. This is your opportunity to show off your skills!
Overall Appearance
Tabs should be used in this application. At a minimum, 4 fully
functioning tabs should be designed – the Pools tab, the Hot
Tubs tab, the customer tab and the Contractors tab.
General Tab
The first tab simply displays the current date. An Exit button is
provided in this tab, as well as all others. (For all buttons
throughout the application, mnemonic values are set.)
Options Tab
The user should be able to change the company name in the
Options tab. If the user returns to this tab later, the name
should be displayed in the title of the window frame.
Customers Tab
The Customers tab allows the user to add new customers and
checks for the existence of the customer.txt file in the directory
where the program is located. If the file does not exist, the
program tells the customer in the Message Area at the bottom.
The Customer Display will give a brief explanation of the user’s
options.
Message Area
Customer Display
Add Customer
When the user clicks Add Customer, an entry window should
appear. If the customer.txt file does not exist, the program tells
the customer in the Message Area at the bottom.
Message Area
In this window, the user can enter customers; the information
entered will be stored as entered.
Clicking Add Customer will attempt to write the information to
customer.txt. The user should receive an indication when a
customer is added successfully.
Successful customer addition
After a customer has been added and the Customers window is
closed, the user can click Refresh to refresh the Customer
Display area, which will display the contents of the customer.txt
file.
Contractor Tab
The Contractor tab functions in exactly the same way as the
Customers tab. The filename for contractors is contract.txt.
Pools Tab
The Pools tab should perform a calculation.
After a length, width, and depth have been entered, the user can
click Calculate Volume and the program will display the
calculated volume (length * width * depth in cubic feet).
Exception handling is used here to catch exceptions, including
incomplete forms, invalid entries, and combinations of these.
Incomplete forms:
Message Area
Fields not filled out
Invalid input:
Message Area
Invalid Input
Combination invalid input/incomplete input:
Hot Tubs Tab
The Hot Tubs tab allows for round and oval tubs’ volumes to be
calculated.
Round Tub
When Round Tub is selected, the user cannot fill out the width
field since we’re dealing with a circle. After filling out the
length and depth fields, the Calculate Volume button will
display the volume (Pi * ((length/2)^2) * depth). The width is
automatically set to the same value as the length, and the user is
informed.
Again, exception handling is used here.
Automatically set to same value as length
Oval Tub
When Oval Tub is selected, the width field is opened up:
The formula used to calculate the volume is (Pi * (length *
width)^2) * depth.
As with the Pools tab, the same error messages should be
displayed in case of no input/invalid values.
Temp Calc Tab
The Temp Calc tab offers a temperature converter (Celsius <->
Fahrenheit).
Opposite values
The user enters a temperature, and selects either C or F. The
field after the Result display will display the opposite (if C is
selected, field will display F; if F is selected, field will display
C).
No input:
Value automatically set to zero in case of no input/invalid input
The Length Calc tab offers the user a length converter
(millimeters, meters, yards, feet, and inches).
“Feet” was filled out; all other values are automatically
populated
6

More Related Content

Similar to MARKETING EXAMPLE FINAL1 Volvos YCC opens its doors with a pr.docx

MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionkainemanz
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionjohannesreidjones
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionjohannesreidjones
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionjohannesreidjones
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionbordignonbunnie
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionjohannesreidjones
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionbordignonbunnie
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionbordignonbunnie
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionbrewgabrielse
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionkainemanz
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionkainemanz
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionjohannesreidjones
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionkainemanz
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionjohannesreidjones
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionjohannesreidjones
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionbordignonbunnie
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionkainemanz
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionhironakaneely
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionmalenasugar
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionjohannesreidjones
 

Similar to MARKETING EXAMPLE FINAL1 Volvos YCC opens its doors with a pr.docx (20)

MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 version
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 version
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 version
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 version
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 version
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 version
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 version
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 version
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 version
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 version
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 version
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 version
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 version
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 version
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 version
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 version
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 version
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 version
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 version
 
MKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 versionMKT 571 Final Exam Answers 2015 version
MKT 571 Final Exam Answers 2015 version
 

More from infantsuk

Please cite and include references- Broderick & Blewitt (2015) must.docx
Please cite and include references- Broderick & Blewitt (2015) must.docxPlease cite and include references- Broderick & Blewitt (2015) must.docx
Please cite and include references- Broderick & Blewitt (2015) must.docxinfantsuk
 
Please choose 1 of the 2 topics below for this weeks assignment.docx
Please choose 1 of the 2 topics below for this weeks assignment.docxPlease choose 1 of the 2 topics below for this weeks assignment.docx
Please choose 1 of the 2 topics below for this weeks assignment.docxinfantsuk
 
Please be advised that for the second writing assignment, the clas.docx
Please be advised that for the second writing assignment, the clas.docxPlease be advised that for the second writing assignment, the clas.docx
Please be advised that for the second writing assignment, the clas.docxinfantsuk
 
Please briefly describe cross cultural variations in Consumer Beha.docx
Please briefly describe cross cultural variations in Consumer Beha.docxPlease briefly describe cross cultural variations in Consumer Beha.docx
Please briefly describe cross cultural variations in Consumer Beha.docxinfantsuk
 
Please be sure to organize your report using section headers to clea.docx
Please be sure to organize your report using section headers to clea.docxPlease be sure to organize your report using section headers to clea.docx
Please be sure to organize your report using section headers to clea.docxinfantsuk
 
Please attach two different assignments. Please first provide the dr.docx
Please attach two different assignments. Please first provide the dr.docxPlease attach two different assignments. Please first provide the dr.docx
Please attach two different assignments. Please first provide the dr.docxinfantsuk
 
Please answers some questions below (attached references)  1.Wh.docx
Please answers some questions below (attached references)  1.Wh.docxPlease answers some questions below (attached references)  1.Wh.docx
Please answers some questions below (attached references)  1.Wh.docxinfantsuk
 
Please answer these discussion questions thoroughly.  Provide re.docx
Please answer these discussion questions thoroughly.  Provide re.docxPlease answer these discussion questions thoroughly.  Provide re.docx
Please answer these discussion questions thoroughly.  Provide re.docxinfantsuk
 
Please click on this link and follow the directions to complete the .docx
Please click on this link and follow the directions to complete the .docxPlease click on this link and follow the directions to complete the .docx
Please click on this link and follow the directions to complete the .docxinfantsuk
 
Please choose one of the following questions, and post your resp.docx
Please choose one of the following questions, and post your resp.docxPlease choose one of the following questions, and post your resp.docx
Please choose one of the following questions, and post your resp.docxinfantsuk
 
Please answer the questions in paragraphs containing at least fi.docx
Please answer the questions in paragraphs containing at least fi.docxPlease answer the questions in paragraphs containing at least fi.docx
Please answer the questions in paragraphs containing at least fi.docxinfantsuk
 
Please answer the following three questions in one to two paragraphs.docx
Please answer the following three questions in one to two paragraphs.docxPlease answer the following three questions in one to two paragraphs.docx
Please answer the following three questions in one to two paragraphs.docxinfantsuk
 
Please answer the following1.  Transformational leadership and .docx
Please answer the following1.  Transformational leadership and .docxPlease answer the following1.  Transformational leadership and .docx
Please answer the following1.  Transformational leadership and .docxinfantsuk
 
Please answer the below questionDescribe social bandwidth and s.docx
Please answer the below questionDescribe social bandwidth and s.docxPlease answer the below questionDescribe social bandwidth and s.docx
Please answer the below questionDescribe social bandwidth and s.docxinfantsuk
 
Please answer the following questions1.- Please name the fu.docx
Please answer the following questions1.- Please name the fu.docxPlease answer the following questions1.- Please name the fu.docx
Please answer the following questions1.- Please name the fu.docxinfantsuk
 
Please answer the following questions1.- Please name the follow.docx
Please answer the following questions1.- Please name the follow.docxPlease answer the following questions1.- Please name the follow.docx
Please answer the following questions1.- Please name the follow.docxinfantsuk
 
Please answer the following questions with supporting examples and f.docx
Please answer the following questions with supporting examples and f.docxPlease answer the following questions with supporting examples and f.docx
Please answer the following questions with supporting examples and f.docxinfantsuk
 
Please answer the following questions about air and water pollution .docx
Please answer the following questions about air and water pollution .docxPlease answer the following questions about air and water pollution .docx
Please answer the following questions about air and water pollution .docxinfantsuk
 
please answer the following 7 questions in its entirety.  #11.C.docx
please answer the following 7 questions in its entirety.  #11.C.docxplease answer the following 7 questions in its entirety.  #11.C.docx
please answer the following 7 questions in its entirety.  #11.C.docxinfantsuk
 
Please answer the questions listed below and submit in a word docume.docx
Please answer the questions listed below and submit in a word docume.docxPlease answer the questions listed below and submit in a word docume.docx
Please answer the questions listed below and submit in a word docume.docxinfantsuk
 

More from infantsuk (20)

Please cite and include references- Broderick & Blewitt (2015) must.docx
Please cite and include references- Broderick & Blewitt (2015) must.docxPlease cite and include references- Broderick & Blewitt (2015) must.docx
Please cite and include references- Broderick & Blewitt (2015) must.docx
 
Please choose 1 of the 2 topics below for this weeks assignment.docx
Please choose 1 of the 2 topics below for this weeks assignment.docxPlease choose 1 of the 2 topics below for this weeks assignment.docx
Please choose 1 of the 2 topics below for this weeks assignment.docx
 
Please be advised that for the second writing assignment, the clas.docx
Please be advised that for the second writing assignment, the clas.docxPlease be advised that for the second writing assignment, the clas.docx
Please be advised that for the second writing assignment, the clas.docx
 
Please briefly describe cross cultural variations in Consumer Beha.docx
Please briefly describe cross cultural variations in Consumer Beha.docxPlease briefly describe cross cultural variations in Consumer Beha.docx
Please briefly describe cross cultural variations in Consumer Beha.docx
 
Please be sure to organize your report using section headers to clea.docx
Please be sure to organize your report using section headers to clea.docxPlease be sure to organize your report using section headers to clea.docx
Please be sure to organize your report using section headers to clea.docx
 
Please attach two different assignments. Please first provide the dr.docx
Please attach two different assignments. Please first provide the dr.docxPlease attach two different assignments. Please first provide the dr.docx
Please attach two different assignments. Please first provide the dr.docx
 
Please answers some questions below (attached references)  1.Wh.docx
Please answers some questions below (attached references)  1.Wh.docxPlease answers some questions below (attached references)  1.Wh.docx
Please answers some questions below (attached references)  1.Wh.docx
 
Please answer these discussion questions thoroughly.  Provide re.docx
Please answer these discussion questions thoroughly.  Provide re.docxPlease answer these discussion questions thoroughly.  Provide re.docx
Please answer these discussion questions thoroughly.  Provide re.docx
 
Please click on this link and follow the directions to complete the .docx
Please click on this link and follow the directions to complete the .docxPlease click on this link and follow the directions to complete the .docx
Please click on this link and follow the directions to complete the .docx
 
Please choose one of the following questions, and post your resp.docx
Please choose one of the following questions, and post your resp.docxPlease choose one of the following questions, and post your resp.docx
Please choose one of the following questions, and post your resp.docx
 
Please answer the questions in paragraphs containing at least fi.docx
Please answer the questions in paragraphs containing at least fi.docxPlease answer the questions in paragraphs containing at least fi.docx
Please answer the questions in paragraphs containing at least fi.docx
 
Please answer the following three questions in one to two paragraphs.docx
Please answer the following three questions in one to two paragraphs.docxPlease answer the following three questions in one to two paragraphs.docx
Please answer the following three questions in one to two paragraphs.docx
 
Please answer the following1.  Transformational leadership and .docx
Please answer the following1.  Transformational leadership and .docxPlease answer the following1.  Transformational leadership and .docx
Please answer the following1.  Transformational leadership and .docx
 
Please answer the below questionDescribe social bandwidth and s.docx
Please answer the below questionDescribe social bandwidth and s.docxPlease answer the below questionDescribe social bandwidth and s.docx
Please answer the below questionDescribe social bandwidth and s.docx
 
Please answer the following questions1.- Please name the fu.docx
Please answer the following questions1.- Please name the fu.docxPlease answer the following questions1.- Please name the fu.docx
Please answer the following questions1.- Please name the fu.docx
 
Please answer the following questions1.- Please name the follow.docx
Please answer the following questions1.- Please name the follow.docxPlease answer the following questions1.- Please name the follow.docx
Please answer the following questions1.- Please name the follow.docx
 
Please answer the following questions with supporting examples and f.docx
Please answer the following questions with supporting examples and f.docxPlease answer the following questions with supporting examples and f.docx
Please answer the following questions with supporting examples and f.docx
 
Please answer the following questions about air and water pollution .docx
Please answer the following questions about air and water pollution .docxPlease answer the following questions about air and water pollution .docx
Please answer the following questions about air and water pollution .docx
 
please answer the following 7 questions in its entirety.  #11.C.docx
please answer the following 7 questions in its entirety.  #11.C.docxplease answer the following 7 questions in its entirety.  #11.C.docx
please answer the following 7 questions in its entirety.  #11.C.docx
 
Please answer the questions listed below and submit in a word docume.docx
Please answer the questions listed below and submit in a word docume.docxPlease answer the questions listed below and submit in a word docume.docx
Please answer the questions listed below and submit in a word docume.docx
 

Recently uploaded

Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 

Recently uploaded (20)

Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 

MARKETING EXAMPLE FINAL1 Volvos YCC opens its doors with a pr.docx

  • 1. MARKETING EXAMPLE FINAL 1 Volvo's YCC opens its doors with a press of a button on the car key, will parallel park the car with a self-steering system, and has customized seat covers that can be removed and washed. Many of these new product features were added because Volvo sought ideas from Answer A.seasoned mechanics. B.women drivers. C.stunt drivers and professional racing car drivers. D.loyal Volvo customers who had driven Volvos exclusively. E.Loyal drivers of luxury automobiles other than Volvo. 2. When a small retail chain hires an accountant to do its income taxes, the retail chain would have purchased a(n) __________. Answer A.ancillary equipment B. convenience product C.specialty service D.accessory personnel E.industrial service 3. Legal counsel for patent information for a firm's research department would most likely be classified as which type of product? Answer A. ancillary equipment B. convenience product C. specialty services D. accessory personnel E. industrial services 4. Figure 10-7 above represents the seven stages of the new- product development process. Cubicle "2" represents the
  • 2. __________ stage. Answer A. idea generation B. screening and evaluation C. business analysis D. new-product strategy development E. market testing 5. Which of the following is an example of an organizational problem that can cause a new product failure? Answer A.Disproportionate creativity and out-of-the box thinking. B. Too much input from different departments within the firm. C.Intense brand recognition. D. Excessive checks and balances prior to a new product release. E. Not really listening to the voice of the consumer. 6. Which of the following statements regarding goods is most accurate? Answer A. In order to be classified as a product, an item must appeal to all five senses. B. Music is not considered a product because it only involves a single sense-hearing. C. In addition to appealing to the senses, some products also have intangible attributes. D. To market a product that contains visual attributes you cannot use an auditory medium. E. The aroma of chocolate chip cookies is considered a product because it affects one's senses. 7. Which of the following is the best example of a people-base service? Answer A.movie theaters B.airlines C.advertising agency
  • 3. D.vending machines E. taxis 8. Printer paper would be classified as which type of support products? Answer a.installations b.accessory equipment c.supplies d.services e.raw materials 9. For six months, the Marriott Corporation sent a six-person intelligence team to travel and stay at economy hotels around the country. The purpose of this was Answer A.to allow the employees to reap the benefits of the new product, Fairfield Inns, that their hard work and new-product process had created. B.to collect ideas from competitors' strengths and weaknesses that could be used in their own new-product development process. C.check on the quality of their own product from the perspective of a consumer. D. to identify future members of the development team who had shown innovation on their own in a traditionally standardized environment. E. identify individuals who used Marriott services but were only one time users of the services. 10. The Vermont Teddy Bear Company sells handmade Teddy bears designed to be given as gifts for almost every occasion imaginable. The Love Bandit Bear is one bear designed for people to give to each other on Valentine's Day. The Love Bandit Bear is an example of a Answer A. product line. B. product type. C. product class.
  • 4. D. product form. E. product item. 11. Sara Burns is the owner of a company called Spice and was looking for a new product to go with her company's line of food condiments when a friend suggested combining spices with tea. In the __________ stage of the new-product process, the spices and tea mixtures were exposed to prospective consumers under realistic purchase conditions. Answer A.idea generation B.screening and evaluation C.business analysis D.market testing E.commercialization 12. The new-product process an organization goes through to identify business opportunities and convert them to a salable good or service contains Answer A. three main steps: research, produce, and distribute. B. four distinct steps: research, evaluate, produce, and distribute. C. five key phases ranging from idea generation to creating the first prototype. D. seven stages from new product strategy development to commercialization. E. three phases: planning, implementation, and control. 13. Mr. Clean is an antibacterial cleaning liquid for home use. The manufacturer of Mr. Clean believed the addition of Sparkling Apple-Scented Mr. Clean to the Mr. Clean product line, would be Answer A.seen as a discontinuous innovation. B.viewed as new from the company's perspective because it is a product line extension. C.viewed as a high-risk product line addition because it is new to the market.
  • 5. D.defined as new by the Federal Trade Commission for the usual one-year period. E.not seen as a new-product because it does not represent a different stock keeping unit. 14. Why would the manufacturer of a new all-natural-ingredient shampoo and conditioner put free samples of the product in Sunday newspapers? Answer A.to simulate laggard usage of the product B.to encourage product trial and adoption C.to control innovation diffusion D.to avoid any possibility of litigation E.to circumvent the typical adoption cycle 15. FIGURE 11-2 Figure 11-2 above represents the stages of the product life cycle. What does the curve labeled "BLUE" represent in this graphic?Answer A. total variable costs B. total fixed costs C. total industry profit D.total industry revenue E.total research and development costs 16. 3M is a master of _________ strategy. According to a 3M manager, "we hit fast, price high, and get the heck out when the me-too-products pour in." A.penetration pricing B.cost-plus pricing C. ROI pricing D.market-oriented pricing E.skimming pricing 17. The FedEx brand suggests the possibility that it is government sanctioned and fast. This perception is important because of which unique characteristic of services? A.Inventory costs. B. Inseparability. C. Inconsistency.
  • 6. D.Intangibility. E.Invisibility. 18. A strategy for managing a product's life cycle that attempts to increase a product's use among existing customers, create new use situations, or find new customers is referred to as A.market modification. B. product modification. C.product repositioning. D. customer orientation. D.diversification. 19. Which of the following is the most important aspect conveyed by the FedEx brand? Answer A.its international experience B.the benefits provided by the service C.the ownership of the company D. the nonprofit aspect of the company E.the patent for its service 20. To help differentiate a company's brand from competitors, an improved version or new features are added to the original design, and product proliferation occurs in the _________ stage of the product life cycle. Answer A. introduction B. growth C. maturity D. decline E. harvest 21. Commuters in New York have often installed devices on their cars that can be read automatically as they approach a tollbooth. This saves time, improves traffic flow, and means drivers don't need to keep suitable change in the car. It also offers New York authorities the opportunity to manage traffic flow by charging different toll amounts for different times of day. Commuters in New York are experiencing
  • 7. Answer a. price gouging. b. competitive pricing. c. off-peak pricing. d. internal marketing. e. external marketing. 22. Four key challenges for package and label designers include (1) cost reduction, (2) environmental concerns, (3) health, safety, and security issues, and (4) _________. Answer a. a.governmental regulations b. social and societal issues c. competition from global markets d. a continuing need to connect with customers e. diminishing color, symbol, and trademark selections 23. Mars, Inc. sells Snickers, Milky Way, Twix, Skittles, Dove, Starburst, M&Ms, and Three Musketeer candy. This variety of names is typical of a __________ strategy. Answer a. co-branding b. multibranding c. multiproduct d. mixed brand e. private branding 24.Which of the following statements is most accurate? Answer a. The name Gatorade was chosen because as an energy drink it "got you out the gate-fast." The name Gatorade was coined by a team who lost to the FL Gators, attributing the Gator win to the "aid" it got from the rehydrating beverage. The green color of the original lemon-lime Gatorade conjured up a fast and strong alligator in the water. The first five letters in Gatorade are the initials of the product's inventors, with "ade" at the end representing the product's
  • 8. 37 DeVry University Online CIS355A Course Project Guide Business Systems Programming I--Course Project · Project Description · Analysis and Design · User's Manual · Minimum Requirements · Sample Extended Requirements Project Description The importance of a graphical user interface in programming is paramount in being successful in the business industry. This project incorporates GUI techniques with other tools that you have learned about in this class. Here is your assignment: You work for a Landscape architect. They have asked you to be a part of their team as they need a computer programmer, analyst, and designer to aid them in calculating engineering specification. Specifically, you have been assigned to the Pools, Hot Tubs and Spas section of their landscaping team. Your skills will be needed in creating a GUI program that calculates engineering specifications. This assignment is due in Week 7, but it is suggested that you
  • 9. begin working on the course project assignment in Week 5, which should give you ample time to complete the project. You will find that all the lectures, Quick Test Programs, and Lab assignments will prepare you for the course project. Analysis and Design In week 4, you will complete the analysis and design for the project. You will use the information described in Chapter Two (pages 48-49) to create the Analysis and Design documentation. You will create the following items: 1. Request for New Application 2. Problem Analysis 3. List and description of the requirements 4. Interface Storyboard/drawing 5. Design Flowchart or pseudo code The Analysis and Design document will be a single MS Word document, which contains all descriptions and drawings. User's Manual Include a User's Manual: a Word document, with screenshots, that explains how to run your application. Your mark will depend both on the program quality, and the quality of the User's Manual. Here are some more detailed guidelines about the User's Manual: · It does not need to be long, probably not more than 10 pages, including screenshots. · Write it at the expected user's level - not too technical. · Detail all the functionality that the application provides. Best, structure you presentation top-down way. · For each function, show what it its purpose and sample execution, with a screenshot. Minimum Requirements This example would be the bare minimum to obtain a passing
  • 10. grade (no more than a 75%): This Swimming Pool Calculator is one that is very simple to use. As you can see, it is a user interface that will allow the user to enter the desired length, width, and average depth of a pool and the program will calculate the volume of that pool based on the entered information. This information is then stored in a file that can be viewed. The interface contains four text boxes for the user to enter information along with a calculate and an exit button. Entering Length of Pool The length of the pool is entered here. The user will be able to enter the length of the pool(in feet) in the text box shown above. To enter information in the box, the user must click in the desired box. The curser will appear allowing the user to enter the appropriate information. To get to the next box, all the user needs to do is either click with the mouse the next box, or the user can hit the tab button on their keyboard. Either method will move the cursor to the next input. Entering the Width of the Pool The width of the pool is entered here.
  • 11. As with the length box, the width box is used in the same fashion. The user will enter the width of the Pool(in feet) using the keyboard. The user will then have the option to move to the next box by either using the mouse and clicking in the average box, or they can use the tab key on their keyboard. Either way will move the cursor to the average depth box. Entering the Average Depth The average depth is entered here. The user will now enter the average depth of the Pool(in feet). This needs to be as exact a measurement as possible. If the user only wants to know an about figure then the measurements do not need to be as accurate. The more accurate the user needs the volume to be, the more accurate the measurements need to be. If a mistake is made, all the user needs to do is click the backspace button on their keyboard and the entered information will be deleted. Calculating the Volume The calculate button is clicked to calculate the volume of the pool. This is where the volume will be displayed
  • 12. The final step is for the user to calculate the volume of the Pool. This can be done in two ways. First, the user can click the calculate button to calculate the volume of the pool. Second, the user can use their keyboard and press Ctrl+C and the program will calculate the volume. Retrieving Data.Txt file The Data.txt file is found here. The Data.txt file can be retrieved by going into the workspace file using Windows Explorer. Once there the user can click on the Data file to retrieve the contents. The contents will be in Word pad form, and will look like the following page. The Data from the user input as it appears in the Data.txt file. From this point, the user can either review the document or can change any information. If the user desired, they could make this document a read only document by going into the security settings in Windows and setting the access. This should only be done by the administrator. Exiting the program
  • 13. The program can also be closed by clicking here. Exit the program by clicking here. To exit the program, the user can do one of two things. First, the user can click on the Exit button. This will close the program. Two, the user can use the keyboard and click Ctrl+X. Third, the user can click on the red X at the top of the interface. Any of these methods will allow the program to close. Below are some hints: …… volume = length * width * depth; //Will calculate the volume of the pool volumeField.setText(num.format(volume)); //Will display the volume of the pool for the user { //Will write to the Data.txt file try{ FileWriter fileW = new FileWriter("Data.txt", true); System.out.println("Writing data to Data.txt file"); fileW.write("length:"); fileW.write(lengthField.getText());
  • 14. fileW.write(","); fileW.write(" "); fileW.write("width:"); fileW.write(widthField.getText()); fileW.write(","); fileW.write(" "); fileW.write("avg depth:"); fileW.write(depthField.getText()); fileW.write(","); fileW.write(" "); fileW.write("volume:"); fileW.write(volumeField.getText()); fileW.write(","); fileW.close(); FileReader fileR = new FileReader("Data.txt"); BufferedReader buffIn = new BufferedReader(fileR); String textData = buffIn.readLine(); System.out.println(textData); buffIn.close(); System.out.println("n"); } catch(IOException e1) { JOptionPane.showMessageDialog(null,e1.getMessage(), "ERROR",2); //Will display error message if unable to write to file
  • 15. } } Sample Extended Requirements The following screenshots provide a sample of what is possible, and could lead to a project worth the maximum grade of 100%. Something to think about!!! Do not think this is what you have to do to get the maximum number of points. It is just a sample! You are only bound by your programming ability. Please do not try and do more than you are capable of. Think, plan, design and code YOUR course project. This is your opportunity to show off your skills! General Interface The first panel simply displays today’s date – I opted to not give the user the option to change this, as it uses the system date. Since this is to be a generic tool, we give the user the option to set the company name in the Options tab; doing so will change “Enter a company name in the Options tab” to the company name. An Exit button is provided in all tabs. Mnemonic values are set for all buttons throughout the application. I opted for a few different error-catching options rather than a consistent one throughout the application, just to show some extra functionality. All tabs can easily be set to behave identically. Options tab This tab allows the user to enter a company name. Hitting Set
  • 16. New Name will change the window’s title to whatever was entered. The result: Customers tab General This tab allows the user to add new customers. It will display the existing customers in the main area. Functionality General The program checks for the existence of the customer.txt file in the directory where the program is located. If the file does not exist, the program tells the customer in the Message Area at the bottom. The Customer Display will give a brief explanation of options. Customer Display Message Area Add Customer In this window, the user can enter customers. Again, the Message Area will display program message. The State selection contains a list of all US state abbreviations. No error
  • 17. checking is performed here, as we are dealing with strings – the information will be stored literally as entered. Message Area Selecting Add Customer will attempt to write the information to customer.txt. If the file is write-protected, the Message Area will inform the user. If the file does not exist, it is created. If the file already exists and can be written to, the information will be appended to the file. Fields are not emptied when focused on (this can easily be changed). Successful customer addition Below is an example of the situation where the file already exists and can be written to; notice the message in the Message Area: The Delete File option gives the user the option to delete the customer.txt file. If the file does not exist, the Message Area will inform the user after Yes has been selected. If No is selected, the Customer File Deletion window simply closes.
  • 18. After a customer has been added and the Customers window is closed, the user selects Refresh to refresh the Customer Display area, which will display the contents of the customer.txt file. It can be changed to automatically refresh the contents, but I preferred to give the user some more control. Contractor tab The Contractor tab functions in exactly the same way as the Customers tab. The file name for contractors is contractor.txt. Pools tab General This tab allows for pool volume calculation. It assumes pools are rectangular (round- and oval-shaped pools/tubs can be calculated in the Hot Tubs tab. Functionality After a length, width, and depth have been entered, the user clicks Calculate Volume and the program will display the calculated volume (length * width * depth in cubic feet). Anomalies caught are no input and invalid input. The user is limited to entering only numbers and periods.
  • 19. No input: Fields not filled out Message Area Invalid input: Message Area Invalid Input Combination invalid input/no input: Hot Tubs tab General This tab allows for round and oval tubs’ volumes to be calculated. Functionality When Round Tub is selected, the user cannot fill out the width field, as it should be the same as the length (since we’re dealing with a circle). After filling out the length and tub fields, the Calculate Volume button will display the volume (Pi *
  • 20. ((length/2)^2) * depth). The width is automatically set to the same value as the length, and the user is informed. Again, invalid input is caught (only numbers and periods are allowed), and the program will display the same error messages as the Pools tab. Automatically set to same value as length When Oval Tub is selected, the width field is opened up: Again, the same error messages are displayed in case of no input/invalid values. Formula used is Pi * (length * .5) * (width * .5) * depth; Temp Calc tab General This tab offers a temperature converter (Celsius <-> Fahrenheit). Functionality Opposite values The user enters a temperature, and selects either C or F. The field after the Result display will display the opposite (if C is selected, field will display F; if F is selected, field will display C). I took a different approach for the System Messages here, but the principle is the same. In this tab, the temperature value will be automatically set to zero in case of invalid input or no
  • 21. input. No input: Value automatically set to zero in case of no input/invalid input Length Calc tab General This tab offers the user a length converter (millimeters, meters, yards, feet, and inches). Functionality The user fills out one of the fields (only numerical values and the period are allowed), and hits Convert. Only one of the fields can be filled out at any time (changing the focus will delete the other fields). “Feet” was filled out; all other values are automatically populated
  • 22. The end… In order to get full credit which is 100 points, you need to provide a lot of extra functionalities. I prepared the following 4 examples to assist you. 1. The JTabbedPane class 2. Checkboxes and radio buttons 3. Lists and combo boxes 4. Scrollbars and sliders The JTabbedPane Class If you've ever dealt with the Control Panel in Windows, you already know what a JTabbedPane is. It's a container with labeled tabs. When you click on a tab, a new set of controls is shown in the body of the JTabbedPane. In Swing, JTabbedPane is simply a specialized container. Each tab has a name. To add a tab to the JTabbedPane, simply
  • 23. call addTab(). You'll need to specify the name of the tab as well as a component that supplies the tab's contents. Typically, it's a container holding other components. Even though the JTabbedPane only shows one set of components at a time, be aware that all the components on all the pages are in memory at one time. If you have components that hog processor time or memory, try to put them into some "sleep" state when they are not showing. The following example create five tabs, each tab have their own components. import java.awt.*; import javax.swing.*; public class TabDemo extends JFrame { public TabDemo() { super( "JTabbedPane Demo " ); JTabbedPane tab = new JTabbedPane(); // constructing the first panel JLabel l1 = new JLabel( "Welcome to CIS355A", SwingConstants.CENTER ); JPanel p1 = new JPanel(); p1.add( l1 ); tab.addTab( "Tab#1", null, p1, " Panel #1" ); // constructing the second panel JLabel l2 = new JLabel("Welcome to JTabbedPaneDemo", SwingConstants.CENTER); JPanel p2 = new JPanel();
  • 24. p2.setBackground( Color.blue ); p2.add( l2 ); tab.addTab( "Tab#2", null, p2, " Panel #2" ); // constructing the third panel JLabel l3 = new JLabel( " Java is sooooooooooo fun!" ); JPanel p3 = new JPanel(); p3.setLayout( new BorderLayout() ); p3.add( new JButton( "J" ), BorderLayout.NORTH ); p3.add( new JButton( "A" ), BorderLayout.WEST ); p3.add( new JButton( "V" ), BorderLayout.EAST ); p3.add( new JButton( "A" ), BorderLayout.SOUTH ); p3.add( l3, BorderLayout.CENTER ); tab.addTab( "Tab#3", null, p3, " Panel #3" ); // constructing the fourth panel JLabel l4 = new JLabel( "panel four" ); JPanel p4 = new JPanel(); p4.setBackground( Color.black ); JLabel digits = new JLabel( "Java" ); digits.setFont( new Font( "Serif", Font.ITALIC, 50 ) ); digits.setForeground( Color.blue ); p4.add( digits ); tab.addTab( "Tab#4", null, p4, " Panel #4" ); // constructing the last panel JLabel l5 = new JLabel( "panel five" ); JLabel l6 = new JLabel( "The end!" ); JPanel p5 = new JPanel(); p5.add( l6 ); tab.addTab( "Tab#5", null, p5, " Panel #5" ); // add JTabbedPane to container getContentPane().add( tab ); setSize( 250, 200 ); setVisible( true ); } public static void main( String args[] )
  • 25. { TabDemo demo = new TabDemo(); demo.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); } } Checkboxes and Radio Buttons A checkbox is a labeled toggle switch. Each time the user clicks it, its state toggles between checked and unchecked. Swing implements the checkbox as a special kind of button. Radio buttons are similar to checkboxes, but they are normally used in groups. Clicking on one radio button in the group automatically turns the others off. They are named for the mechanical preset buttons on old car radios (like some of us had in high school). Checkboxes and radio buttons are represented by instances of JCheckBox and JRadioButton, respectively. Radio buttons can be tethered together using an instance of another class called ButtonGroup . By now you're probably well into the swing of things (no pun intended) and could easily master these classes on your own. We'll use an example to illustrate a different way of dealing with the state of components and to show off a few more things about containers. A JCheckBox sends ItemEvent s when it's pushed. Because a checkbox is a kind of button, it also fires ActionEvents when checked. For something like a checkbox, we might want to be lazy and check on the state of the buttons only at some later time, such as when the user commits an action. For example, when filling out a form you may only care about the user's choices when the submit button is pressed. DriveThrough prints the results when we press the Place Order button. Therefore, we can ignore all the events generated by our checkboxes and radio buttons and listen only for the action events generated by the regular button. //file:
  • 26. DriveThrough.javaimport java.awt.*;import java.awt.event.*;import javax.swing.*;public class DriveThrough { public static void main(String[] args) { JFrame frame = new JFrame("Lister v1.0"); JPanel entreePanel = new JPanel( ); final ButtonGroup entreeGroup = new ButtonGroup( ); JRadioButton radioButton; entreePanel.add(radioButton = new JRadioButton("Beef")); radioButton.setActionCommand("Beef"); entreeGroup.add(radioButton); entreePanel.add(radioButton = new JRadioButton("Chicken")); radioButton.setActionCommand("Chicken"); entreeGroup.add(radioButton); entreePanel.add(radioButton = new JRadioButton("Veggie", true)); radioButton.setActionCommand("Veggie"); entreeGroup.add(radioButton); final JPanel condimentsPanel = new JPanel( ); condimentsPanel.add(new JCheckBox("Ketchup")); condimentsPanel.add(new JCheckBox("Mustard")); condimentsPanel.add(new JCheckBox("Pickles")); JPanel orderPanel = new JPanel( ); JButton orderButton = new JButton("Place Order"); orderPanel.add(orderButton); Container content = frame.getContentPane( ); content.setLayout(new GridLayout(3, 1)); content.add(entreePanel); content.add(condimentsPanel); content.add(orderPanel); orderButton.addActionListener(new ActionListener( ) { public void actionPerformed(ActionEvent ae) { String entree = entreeGroup.getSelection( ).getActionCommand( ); System.out.println(entree + " sandwich"); Component[] components = condimentsPanel.getComponents( ); for (int i = 0; i < components.length; i++) { JCheckBox cb = (JCheckBox)components[i]; if (cb.isSelected( )) System.out.println("With " + cb.getText( )); } } }); frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); frame.setSize(300, 150); frame.setVisible(true); }} DriveThrough lays out three panels. The radio buttons in the
  • 27. entreePanel are tied together through a ButtonGroup object. We add() the buttons to a ButtonGroup to make them mutually exclusive. The ButtonGroup object is an odd animal. One might expect it to be a container or a component, but it isn't; it's simply a helper object that allows only one RadioButton to be selected at a time. In this example, the button group forces you to choose a beef, chicken, or veggie entree, but not more than one. The condiment choices, which are JCheckBoxes, aren't in a button group, so you can request any combination of ketchup, mustard, and pickles on your sandwich. When the Place Order button is pushed, we receive an ActionEvent in the actionPerformed() method of our inner ActionListener. At this point, we gather the information in the radio buttons and checkboxes and print it. actionPerformed() simply reads the state of the various buttons. We could have saved references to the buttons in a number of ways; this example demonstrates two. First, we find out which entree was selected. To do so, we call the ButtonGroup's getSelection() method. This returns a ButtonModel, upon which we immediately call getActionCommand(). This returns the action command as we set it when we created the radio buttons. The action commands for the buttons are the entrée names, which is exactly what we need. To find which condiments were selected, we use a more complicated procedure. The problem is that condiments aren't mutually exclusive, so we don't have the convenience of a ButtonGroup. Instead, we ask the condiments JPanel for a list of its components. The getComponents() method returns an array of references to the container's child components. We'll use this to loop over the components and print the results. We cast each element of the array back to JCheckBox and call its isSelected() method to see if the checkbox is on or off. If we were dealing with different types of components in the array, we could determine each component's type with the instanceof operator. Or, more generally, we could maintain references to the
  • 28. elements of our form in some explicit way (a map by name,perhaps). Lists and Combo Boxes JLists and JComboBoxes are a step up on the evolutionary chain from JButtons and JLabels. Lists let the user choose from a group of alternatives. They can be configured to force a single selection or allow multiple choices. Usually, only a small group of choices is displayed at a time; a scrollbar lets the user move to the choices that aren't visible. The user can select an item by clicking on it. She can expand the selection to a range of items by holding down Shift and clicking on another item. To make discontinuous selections, the user can hold down the Control key instead of the Shift key (on a Mac, this is the Command key). A combo box is a cross-breed between a text field and a list. It displays a single line of text (possibly with an image) and a downward pointing arrow on one side. If you click on the arrow, the combo box opens up and displays a list of choices. You can select a single choice by clicking on it. After a selection is made, the combo box closes up; the list disappears, and the new selection is shown in the text field. Like other components in Swing, lists and combo boxes have data models that are distinct from visual components. The list also has a selection model that controls how selections may be made on the list data. Lists and combo boxes are similar because they have similar data models. Each is simply an array of acceptable choices. This similarity is reflected in Swing, of course: the type of a JComboBox's data model is a subclass of the type used for a JList's data model. The next example demonstrates this relationship. The following example creates a window with a combo box, a list, and a button. The combo box and the list use the same data model. When you press the button, the program writes out the
  • 29. current set of selected items in the list. Here's the code for the example://file: Lister.javaimport java.awt.*; import java.awt.event.*;import javax.swing.*;public class Lister { public static void main(String[] args) { JFrame frame = new JFrame("Lister v1.0"); // create a combo box String [] items = { "uno", "due", "tre", "quattro", "cinque", "sei", "sette", "otto", "nove", "deici", "undici", "dodici" }; JComboBox comboBox = new JComboBox(items); comboBox.setEditable(true); // create a list with the same data model final JList list = new JList(comboBox.getModel( )); // create a button; when it's pressed, print out // the selection in the list JButton button = new JButton("Per favore"); button.addActionListener(new ActionListener( ) { public void actionPerformed(ActionEvent ae) { Object[] selection = list.getSelectedValues( ); System.out.println("-----"); for (int i = 0; i < selection.length; i++) System.out.println(selection[i]); } }); // put the controls the content pane Container c = frame.getContentPane( ); JPanel comboPanel = new JPanel( ); comboPanel.add(comboBox); c.add(comboPanel, BorderLayout.NORTH); c.add(new JScrollPane(list), BorderLayout.CENTER); c.add(button, BorderLayout.SOUTH); frame.setSize(200, 200); frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); frame.setVisible(true); } } The combo box is created from an array of strings. This is a convenience—behind the scenes, the JComboBox constructor creates a data model from the strings you supply and sets the JComboBox to use that data model. The list is created using the data model of the combo box. This works because JList expects to use a ListModel for its data model, and the ComboBoxModel used by the JComboBox is a subclass of ListModel. The button's action event handler simply prints out the selected
  • 30. items in the list, which are retrieved with a call to getSelectedValues(). This method actually returns an object array, not a string array. List and combo box items, like many other things in Swing, are not limited to text. You can use images, drawings, or some combination of text and images. You might expect that selecting one item in the combo box would select the same item in the list. In Swing components, selection is controlled by a selection model. The combo box and the list have distinct selection models; after all, you can select only one item from the combo box while it's possible to select multiple items from the list. Thus, while the two components share a data model, they have separate selection models. We've made the combo box editable. By default, it would not be editable: the user could choose only one item in the drop-down list. With an editable combo box, the user can type in a selection, as if it were a text field. Noneditable combo boxes are useful if you just want to offer a limited set of choices; editable combo boxes are handy when you want to accept any input but offer some common choices. There's a great class tucked away in the last example that deserves some recognition. It's JScrollPane. In Lister, you'll notice we created one when we added the List to the main window. JScrollPane simply wraps itself around another Component and provides scrollbars as necessary. The scrollbars show up if the contained Component's preferred size (as returned by getPreferredSize() ) is greater than the size of the JScrollPane itself. The following example combins all the above choice boxes and layout managers in one application – Language. import java.awt.*; import javax.swing.*; public class Language extends JFrame {
  • 31. private JButton button1, button2, button3, button4; private JCheckBox check1, check2, check3, check4; private JRadioButton radio1, radio2, radio3; private ButtonGroup radioGroup; private JComboBox comboBox; private JLabel label1, label2; private JPanel panel1, panel2, panel3, panel4, panel5,panel6, panel7, panel8; public Language() { super( "Language Choice" ); // build left north panel label1 = new JLabel( "My favorite language" ); panel1 = new JPanel(); panel1.setLayout( new FlowLayout( FlowLayout.LEFT ) ); panel1.add( label1 ); // build right east panel button1 = new JButton( "Reset" ); button2 = new JButton( "Clear" ); button3 = new JButton( "Confirm" ); button4 = new JButton( "Help" ); panel2 = new JPanel(); panel2.setLayout( new GridLayout( 4, 1, 5, 5 ) ); panel2.add( button1 ); panel2.add( button2 ); panel2.add( button3 ); panel2.add( button4 ); // build left south panel label2 = new JLabel( "Class " ); comboBox = new JComboBox(); comboBox.addItem( "CIS170" ); comboBox.addItem( "CIS247" ); comboBox.addItem( "CIS355" );
  • 32. check1 = new JCheckBox( "Currently taking" ); panel3 = new JPanel(); panel3.setLayout( new FlowLayout( FlowLayout.CENTER, 10, 0 ) ); panel3.add( label2 ); panel3.add( comboBox ); panel3.add( check1 ); // build left east panel check2 = new JCheckBox( "C++" ); check3 = new JCheckBox( "C#" ); check4 = new JCheckBox( "Java", true ); panel4 = new JPanel(); panel4.setLayout( new BorderLayout( ) ); panel4.add( check2, BorderLayout.NORTH ); panel4.add( check3, BorderLayout.CENTER ); panel4.add( check4, BorderLayout.SOUTH ); // build left west panel panel5 = new JPanel(); panel5.setLayout( new BorderLayout() ); panel5.add( radio1 = new JRadioButton( "Strongly Recommend",true ), BorderLayout.NORTH ); panel5.add( radio2 = new JRadioButton( "Recommend", false ),BorderLayout.CENTER ); panel5.add( radio3 = new JRadioButton( "Not Recommend", false ),BorderLayout.SOUTH ); // group the radio buttons radioGroup = new ButtonGroup(); radioGroup.add( radio1 ); radioGroup.add( radio2 ); radioGroup.add( radio3 ); // build left center panel8 = new JPanel(); panel8.setLayout( new FlowLayout( FlowLayout.CENTER, 30, 0 ) ); panel8.setBackground( Color.white ); panel8.add( panel4 );
  • 33. panel8.add( panel5 ); // setup left panel panel6 = new JPanel(); panel6.setLayout( new BorderLayout() ); panel6.add( panel1, BorderLayout.NORTH ); panel6.add( panel8, BorderLayout.CENTER ); panel6.add( panel3, BorderLayout.SOUTH ); // setup layout panel7 = new JPanel(); panel7.setLayout( new FlowLayout( FlowLayout.CENTER, 10, 0 ) ); panel7.add( panel6 ); panel7.add( panel2 ); getContentPane().add( panel7 ); setSize( 500, 160 ); setVisible( true ); } // end constructor public static void main( String args[] ) { Language myChoice = new Language(); myChoice.setDefaultCloseOperation( EXIT_ON_CLOSE ); } } Scrollbars and Sliders JScrollPane is such a handy component that you may not ever need to use scrollbars by themselves. In fact, if you ever do find yourself using a scrollbar by itself, chances are you really want to use another component called a slider. There's not much point in describing the appearance and functionality of scrollbars and sliders. Instead, let's jump right in with an example that includes both components. The
  • 34. following case shows a simple example with both a scrollbar and a slider. //file: Slippery.javaimport java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.event.*;public class Slippery { public static void main(String[] args) { JFrame frame = new JFrame("Slippery v1.0"); Container content = frame.getContentPane( ); JPanel main = new JPanel(new GridLayout(2, 1)); JPanel scrollBarPanel = new JPanel( ); final JScrollBar scrollBar = new JScrollBar(JScrollBar.HORIZONTAL, 0, 48, 0, 255); int height = scrollBar.getPreferredSize( ).height; scrollBar.setPreferredSize(new Dimension(175, height)); scrollBarPanel.add(scrollBar); main.add(scrollBarPanel); JPanel sliderPanel = new JPanel( ); final JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 255, 128); slider.setMajorTickSpacing(48); slider.setMinorTickSpacing(16); slider.setPaintTicks(true); sliderPanel.add(slider); main.add(sliderPanel); content.add(main, BorderLayout.CENTER); final JLabel statusLabel = new JLabel("Welcome to Slippery v1.0"); content.add(statusLabel, BorderLayout.SOUTH); // wire up the event handlers scrollBar.addAdjustmentListener(new AdjustmentListener( ) { public void adjustmentValueChanged(AdjustmentEvent e) { statusLabel.setText("JScrollBar's current value = " + scrollBar.getValue( )); } }); slider.addChangeListener(new ChangeListener( ) { public void stateChanged(ChangeEvent e) { statusLabel.setText("JSlider's current value = " + slider.getValue( )); } }); frame.pack( ); frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); frame.setVisible(true); }} All we've really done here is added a JScrollBar and a JSlider to our main window. If the user adjusts either of these components, the current value of the component is displayed in
  • 35. a JLabel at the bottom of the window. The JScrollBar and JSlider are both created by specifying an orientation, either HORIZONTAL or VERTICAL. You can also specify the minimum and maximum values for the components, as well as the initial value. The JScrollBar supports one additional parameter, the extent. The extent simply refers to what range of values is represented by the slider within the scroll bar. For example, in a scrollbar that runs from 0 to 255, an extent of 128 means that the slider will be half the width of the scrollable area of the scrollbar. JSlider supports the idea of tick marks, lines drawn at certain values along the slider's length. Major tick marks are slightly larger than minor tick marks. To draw tick marks, just specify an interval for major and minor tick marks, and then paint the tick marks: slider.setMajorTickSpacing(48); slider.setMinorTickSpacing(16); slider.setPaintTicks(true); JSlider also supports labeling the ticks with text strings, using the setLabelTable() method. Responding to events from the two components is straightforward. The JScrollBar sends out AdjustmentEvents every time something happens; the JSlider fires off ChangeEvents when its value changes. In our simple example, we display the new value of the changed component in the JLabel at the bottom of the window. Grading scales of Course Project The following grading rubrics are provided for each major phase of the Course Project. 1. User's Manual Points Description Sufficient length to describe the application 4
  • 36. Manual contains explanation in detail of all relevant areas of the application Contains screen shots of the key interface components 4 Images of each section of the application Operations are explained 4 Detailed operation of each section of the application Written to the user's level and is not technical 4 Must not contain code or any other technical items irrelevant to the users Analysis and design contain sufficient detail to begin construction 4 Application analysis and design contains enough details about the application Subtotal 20 2. Minimum Requirements Points Description Standard header included 2 Must contain program's name, student name, and description of the program Program compiles 2 Program does not have any error Program executes 2 Program runs without any error Created main form 3
  • 37. Main method exists Created length label 3 Length label Created length textbox 3 Length input text box Created width label 3 Width label Created width textbox 3 Width input text box Created depth label 3 Depth label Created depth textbox 3 Depth input text box Created volume label 3 Volume label Created volume textbox 3 Volume input text box. Make sure this field is read only. Created Calculate button 3 Calculate Volume button Created Calculate button event handler 3 Code to handle the Calculate Volume button. Must handle non- numeric input and null input. Created Exit button 3 Exit button Created Exit button event handler
  • 38. 3 Code to handle the Exit button. Must exit the application and terminate the program. Correct output is displayed 10 When values are entered, the correct results are shown. If no values or non-numeric values are entered, the proper error message should display. Subtotal 55 3. Extended Requirements Points Description Included at least two additional tabs 5 There must be two or more additional tabs as shown under the Course Project Interface document. Each operation is implemented in its own class 10 Each button and/or text field event handler code must be implemented in its own class. Extended operations and classes work as expected 10 The implemented extra tabs must work as expected. Subtotal 25 Course Project Total Points Description Complete Project 100 User's Manual, Pools tab, and Extended Requirements
  • 39. Course Project Examples This document provide a sample of what is possible, and could lead to a project worth the maximum grade of 100% Something to think about! Do not think this is what you have to do to get the maximum number of points. It is just a sample! You are only bound by your programming ability. Please do not try and do more than you are capable of. Think, plan, design and code YOUR project. This is your opportunity to show off your skills! Overall Appearance Tabs should be used in this application. At a minimum, 4 fully functioning tabs should be designed – the Pools tab, the Hot Tubs tab, the customer tab and the Contractors tab. General Tab The first tab simply displays the current date. An Exit button is provided in this tab, as well as all others. (For all buttons throughout the application, mnemonic values are set.) Options Tab The user should be able to change the company name in the Options tab. If the user returns to this tab later, the name should be displayed in the title of the window frame.
  • 40. Customers Tab The Customers tab allows the user to add new customers and checks for the existence of the customer.txt file in the directory where the program is located. If the file does not exist, the program tells the customer in the Message Area at the bottom. The Customer Display will give a brief explanation of the user’s options. Message Area Customer Display Add Customer When the user clicks Add Customer, an entry window should appear. If the customer.txt file does not exist, the program tells the customer in the Message Area at the bottom.
  • 41. Message Area In this window, the user can enter customers; the information entered will be stored as entered. Clicking Add Customer will attempt to write the information to customer.txt. The user should receive an indication when a customer is added successfully. Successful customer addition After a customer has been added and the Customers window is closed, the user can click Refresh to refresh the Customer Display area, which will display the contents of the customer.txt file. Contractor Tab The Contractor tab functions in exactly the same way as the
  • 42. Customers tab. The filename for contractors is contract.txt. Pools Tab The Pools tab should perform a calculation. After a length, width, and depth have been entered, the user can click Calculate Volume and the program will display the calculated volume (length * width * depth in cubic feet). Exception handling is used here to catch exceptions, including incomplete forms, invalid entries, and combinations of these. Incomplete forms: Message Area Fields not filled out Invalid input: Message Area Invalid Input Combination invalid input/incomplete input: Hot Tubs Tab
  • 43. The Hot Tubs tab allows for round and oval tubs’ volumes to be calculated. Round Tub When Round Tub is selected, the user cannot fill out the width field since we’re dealing with a circle. After filling out the length and depth fields, the Calculate Volume button will display the volume (Pi * ((length/2)^2) * depth). The width is automatically set to the same value as the length, and the user is informed. Again, exception handling is used here. Automatically set to same value as length Oval Tub When Oval Tub is selected, the width field is opened up: The formula used to calculate the volume is (Pi * (length * width)^2) * depth. As with the Pools tab, the same error messages should be displayed in case of no input/invalid values. Temp Calc Tab The Temp Calc tab offers a temperature converter (Celsius <->
  • 44. Fahrenheit). Opposite values The user enters a temperature, and selects either C or F. The field after the Result display will display the opposite (if C is selected, field will display F; if F is selected, field will display C). No input: Value automatically set to zero in case of no input/invalid input The Length Calc tab offers the user a length converter (millimeters, meters, yards, feet, and inches). “Feet” was filled out; all other values are automatically populated 6