SlideShare a Scribd company logo
1 of 16
Assignment6/~$signment6.docx
Assignment6/Assignment6.docx
Assignment #6
Important: This is an individual assignment. Please do not
collaborate.
No late assignment will be accepted.
Make sure that you write every line of your code. Using code
written by someone else will be considered a violation of the
academic integrity and will result in a report to the Dean's
office.
Requirements to get full credits in Documentation
1. The assignment number, your name, student ID, lecture
number, and a class/file description need to be included at the
top of each file/class.
2. A description of each method is also needed.
3. Some additional comments inside of methods to explain code
that are hard to follow should be written.
You can look at the Java programs in the text book to see how
comments are added to programs.
Minimal Submitted Files
You are required, but not limited, to turn in the following
source files:
Assignment6.java (The Assignment6 class extends JApplet)
Project.java
Budget.javaCreatePanel.java - to be completed (it
extends JPanel and contains ButtonListener nested class)
ProjectSpendingPanel.java - to be completed (it
extends JPanel and contains ButtonListener nested class)
You can download the above files and use them to complete this
assignment. You might need to add more methods than the
specified ones.
Skills to be Applied:
Swing/AWT, Vector (very similar to ArrayList class)
Classes may be needed:
JApplet, JButton, JTextField, JTextArea, JLabel,
Container, JPanel, JTabbedPane, JList, and ActionListener. You
may use other classes.
How to run an applet program:
-Create an html file, say "hw6.html" with the following
content:
--------------------------------------------------------
<html>
<head>
<title>Assignment 6 Applet</title>
</head>
<body>
<applet code="Assignment6.class" width=900 height=350>
</applet>
</body>
</html>
------------------------------------------------------
-Compile your java program as usual.
-In a console, type:
appletviewer hw6.html
(instead of typing "java Assignment6").
-In the TextPad, choose Tool->Run Java Applet or
press Ctrl-3 (press control key and 3 at the same time).
-In the jGrasp,
choose Run->Run as Applet.
To test to see if your machine is set to view an applet, please go
to the following site:
Click this page
Program Description
Suggested Class Diagram:
Write a Java program that constructs an Applet. Your program
should provide labels and textfields to a user to enter
information regarding projects.
The Applet (JApplet) of your program should contain two tabs.
The first tab is labeled "Project creation" and the second tab is
labeled "Project spending".
(The size of the applet here is approximately 900 X 350).
The section under the first tab should be divided into two parts:
The left part contains labels, textfields, and a button for a user
to enter some project information. The right part shows "No
project" at the beginning (it is done usingJTextArea).
A user can enter some project information, and push "Create a
project" button.
Then the project information should appear on the right hand
side panel (note that the format of the project information can
be using toString() method of the Project class). A message
"Project added" should also appear with red color at the top of
the panel.
Error handling:
1. If a user forgets to enter some field and pushes "Create a
project" button, show a message "Please fill all fields" with red
color, and nothing should be added to the right hand side panel.
2. If a user enters a non-numeric value for project number or
initial funding, and push "Create a project" button, show a
message "Please enter a numeric value for project number and
initial funding" with red color, and nothing should be added to
the right hand side panel.
After entering several projects, the applet will have the
following appearance. Note that a scroll pane needs to be added
to show multiple projects.
Under the "Project spending" tab, a user can choose a project to
specify spending. There should be a JList containing all projects
created by Project creation panel and a user can choose a
project within it by clicking it. Below the JList, there should be
a JTextField where a user can enter some spending and a button
to add some spending.
The list of projects in the JList should be exactly same as the
list under "Project creation" tab. A user can choose a project
and specify its spending, then push " Submit Budget " button.
After pushing the button, it should update the spending and
current balance of the project as follows. Note that a scroll pane
needs to be added to show the entire project information.
Another user can add spending for other projects as well:
A user should be able to go back and forth between "Project
creation" tab and "Project spending" tab, and these two panels
need to have consistent information, i.e., the same list of
projects. Note that the list of projects created in
the CreatePanel needs to be consistent in the list
in ProjectSpendingPanel, but the spending and current balance
updated in the ProjectSpendingPanel do not need to be reflected
in CreatePanel.
Class description
ProjectSpendingPanel
ProjectSpendingPanel class extends JPanel defined
in javax.swing package. It should contain at least the following
instance variable:
Attribute name
Attribute type
Description
projectList
Vector
a list of project objects.
This class should have a constructor:
public ProjectSpendingPanel(Vector projectList)
where the parameter "projectList" is passed from the
Assignment6 class. The constructor layouts and organizes
components in this panel. You will be adding more variables
(components) than what is listed here, including JList, labels, a
textfield, and a button. The JList should be instantiated using
the "projectList" vector. Then whenever the vector is updated,
the JList will be updated as well by calling its updateUI()
method. They will utilize the toString( ) method of the Project
class to display each item.
public void updateProjectList()
This method calls updateUI() method for the JList that you will
be creating. You need to instantiate your JList using
the projectList in the constructor. The projectList will be
constantly updated under the "Project creation" tab and when it
is updated, this method should be called from
the actionPerformed method in the ButtonListener of
theCreatePanel class so that the JList under the "Project
spending" will have the same update project list in them.
This class contains a nested class
called ButtonListener class that
implements ActionListener interface. Thus you need to define
its actionPerformed method that is supposed to update the
spending and current balance, and display them when the "Add
Spending" button is pushed.
CreatePanel
CreatePanel extends JPanel defined in the javax.swing package.
It should contain at least the following instance variable:
Attribute name
Attribute type
Description
projectList
Vector
a list of Project objects.
spendingPanel
ProjectSpendingPanel
an object of ProjectSpendingPanel.
This class should have a constructor:
public CreatePanel(Vector projectList, ProjectSpendingPanel sp
endingPanel)
where the parameter "projectList" is passed from the
Assignment6 class and the second parameter is an object
of ProjectSpendingPanel. The constructor layouts and organizes
components in this panel. You will be adding more variables
(components) than what is listed here, including
labels, textfields, a button, and a text area.
This class contains a nested class
called ButtonListener class that
implements ActionListener interface. Thus
the ButtonListener needs to have a definition
foractionPerformed method that adds some project information
to the list and does error handling. See the UML class diagram
for the parameter and return type of this method. In
the actionPerformed, you need to extract the information from
the two textfields for the title and publisher. Then you can
instantiate an object of the Project class using the information.
You can use the toString( ) method of the Project object to
display the information on the textarea on the right hand side
and also add the Project object to the "projectList".
Assignment6 class
Assignment6 class extends JApplet defined
in javax.swing package. It contains at least init() method (see
UML diagram for its return type) to instantiate all instance
variables and adds its components to itself. It also sets its size.
It contains at least following instance variables:
Attribute name
Attribute type
Description
projectList
Vector
a list of project objects. It will be used in
both createPanel and spendingPanel.
spendingPanel
ProjectSpendingPanel
an object of ProjectSpendingPanel.
createPanel
CreatePanel
an object of CreatePanel.
tPane
JTabbedPane
an object of JTabbedPane. It will
contain createPanel and spendingPanel under each tab.
Grading Policy:
· submit assignment on time
· indicate assignment number, name, lecture number, and
description of each class clearly in each submitted java file
· your program minimally has the following functionalities:
1. 2 points: Appropriate components such as textfields, labels,
etc. are shown under the "Project creation" and "Project
spending" tabs. JScrollPane is added to display the entire
information on each Panel.
2. 1 point: When the "Create a project" button is pushed, the
project information from textfields is added on the right panel
in the correct order and the message of "project added" shows
up.
3. 1 point: Error handing in case some field is not filled.
4. 1 point: Error handing in case a non-numeric value is entered
for projNumber or funding.
5. 1 point: The same list of projects is shown under the "Project
creation" tab and under the "Project spending" tab.
6. 2 point: When the add spending button is pushed, the
spending and current balance are updated correctly.
Assignment6/Assignment6.javaAssignment6/Assignment6.java//
Assignment #: 6
// Name: your name
// StudentID: your id
// Lecture: your lecture days/time
// Description: The Assignment 6 class creates a Tabbed Pane
with
// two tabs, one for Project creation and one for
// Project spending. and adds it as its Applet content
// and also sets its size.
import javax.swing.*;
import java.util.*;
publicclassAssignment6extendsJApplet
{
privateint APPLET_WIDTH =900, APPLET_HEIGHT =350;
privateJTabbedPane tPane;
privateCreatePanel createPanel;
privateProjectSpendingPanel spendingPanel;
privateVector projectList;
//The method init initializes the Applet with a Pane with two tab
s
publicvoid init()
{
//list of projects to be used in every panel
projectList =newVector();
//review panel uses the list of projects
spendingPanel =newProjectSpendingPanel(projectList);
createPanel =newCreatePanel(projectList, spendingPanel);
//create a tabbed pane with two tabs
tPane =newJTabbedPane();
tPane.addTab("Project creation", createPanel);
tPane.addTab("Project spending", spendingPanel);
getContentPane().add(tPane);
setSize (APPLET_WIDTH, APPLET_HEIGHT);//set Applet
size
}
}
Assignment6/Budget.javaAssignment6/Budget.java// Assignmen
t #:
// Name:
// StudentID:
// Lecture:
// Description: The class Budget represents a budget of a projec
t
import java.text.NumberFormat;
publicclassBudget
{
privatedouble initialFunding;
privatedouble spending;
privatedouble currentBalance;
//Constructor to initialize all member variables
publicBudget(double funding)
{
initialFunding = funding;
spending =0.0;
currentBalance = initialFunding - spending;
}
//add some additional spending
publicboolean addSpending(double additionalSpending)
{
if(additionalSpending >0&& additionalSpending <= currentBala
nce)
{
spending += additionalSpending;
currentBalance = initialFunding - spending;
returntrue;
}
else
returnfalse;
}
//toString() method returns a string containg its initial funding
//spending and current balance
publicString toString()
{
NumberFormat fmt =NumberFormat.getCurrencyInstance();
String result ="Budget:"
+"nInitial Fundingtt"+ fmt.format(initialFunding)
+"nSpendingtt"+ fmt.format(spending)
+"nCurrent Balancet"+ fmt.format(currentBalance);
return result;
}
}
Assignment6/CreatePanel.javaAssignment6/CreatePanel.java//
Assignment #: 6
// Name: your name
// StudentID: your id
// Lecture: your lecture days/time
// Description: It needs to be filled
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
publicclassCreatePanelextendsJPanel
{
privateVector projectList;
privateJButton button1;
privateProjectSpendingPanel spendingPanel;
//Constructor initializes components and organize them using ce
rtain layouts
publicCreatePanel(Vector projectList,ProjectSpendingPanel spe
ndingPanel)
{
this.projectList = projectList;
this.spendingPanel = spendingPanel;
//organize components here
button1 =newJButton("Create a project");
add(button1);
}
//ButtonListener is a listener class that listens to
//see if the buttont "Create a project" is pushed.
//When the event occurs, it adds a project information from
//the text fields to the text area. It also creates a Project object
//using theinformation and add it to the projectList.
//It also does error checking.
privateclassButtonListenerimplementsActionListener
{
publicvoid actionPerformed(ActionEvent event)
{
// if there is no error, add a project to project list
// otherwise, show an error message
}//end of actionPerformed method
}//end of ButtonListener class
}//end of CreatePanel class
Assignment6/Project.javaAssignment6/Project.java// Assignmen
t #:
// Name:
// StudentID:
// Lecture:
// Description: The class Project represents a project .
publicclassProject
{
privateString projName;
privateint projNumber;
privateString projLocation;
privateBudget projBudget;
//Constructor to initialize all member variables
publicProject(double funding)
{
projName ="?";
projNumber =0;
projLocation ="?";
projBudget =newBudget(funding);
}
//Accessor methods
publicString getName()
{
return projName;
}
publicint getNumber()
{
return projNumber;
}
publicString getLocation()
{
return projLocation;
}
publicBudget getBudget()
{
return projBudget;
}
//Mutator methods
publicvoid setName(String aName)
{
projName = aName;
}
publicvoid setNumber(int aNumber)
{
projNumber = aNumber;
}
publicvoid setLocation(String aLocation)
{
projLocation = aLocation;
}
//Add a new expenditure to the budget
publicboolean addExpenditure(double amount)
{
boolean success = projBudget.addSpending(amount);
return success;
}
//toString() method returns a string containg its name, number, l
ocation and budget
publicString toString()
{
String result ="nProject Name:tt"+ projName
+"nProject Number:t"+ projNumber
+"nProject Location:t"+ projLocation
+"n"
+ projBudget.toString()+"nn";
return result;
}
}
Assignment6/ProjectSpendingPanel.javaAssignment6/ProjectSp
endingPanel.java// Assignment #: 6
// Name: your name
// StudentID: your id
// Lecture: your lecture days/time
// Description: It needs to be filled
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.util.*;
publicclassProjectSpendingPanelextendsJPanel
{
privateVector projectList;
//Constructor initialize each component and arrange them using
//certain layouts
publicProjectSpendingPanel(Vector projectList)
{
this.projectList = projectList;
//organize components for spending panel
}
//This method refreshes the JList with
//updated vector information
publicvoid updateProjectList()
{
//call updateUI() for the JList object
}
//ButtonListener class listens to see the button "Add Spending" i
s pushed.
//A user can choose which project to add spending, and that will
update the
//spending and current balance of such project.
privateclassButtonListenerimplementsActionListener
{
publicvoid actionPerformed(ActionEvent event)
{
//get some additional spending from the textfield,
//update the spending and current balance
//for the chosen project in the JList.
}
}//end of ButtonListener class
}//end of ProjectSpendingPanel class
Similarities and Differences
Discuss the similarities and differences between organisms in
the domains Bacteria and Archaea.
Your assignment should be 250-500 words in length
Please include all references and site in paper

More Related Content

Similar to Assignment6~$signment6.docxAssignment6Assignment6.docxAs.docx

Implement a Javascript application that allows the user to enter strin.docx
Implement a Javascript application that allows the user to enter strin.docxImplement a Javascript application that allows the user to enter strin.docx
Implement a Javascript application that allows the user to enter strin.docxmckerliejonelle
 
Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lecturesmarwaeng
 
Program Specifications Develop an inventory management system for an e.docx
Program Specifications Develop an inventory management system for an e.docxProgram Specifications Develop an inventory management system for an e.docx
Program Specifications Develop an inventory management system for an e.docxVictormxrPiperc
 
Day 4: Android: UI Widgets
Day 4: Android: UI WidgetsDay 4: Android: UI Widgets
Day 4: Android: UI WidgetsAhsanul Karim
 
Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]Ahsanul Karim
 
I am having trouble writing the individual files for part 1, which i.pdf
I am having trouble writing the individual files for part 1, which i.pdfI am having trouble writing the individual files for part 1, which i.pdf
I am having trouble writing the individual files for part 1, which i.pdfmallik3000
 
INTRODUCTION The goal of this programming project is to entble studen.pdf
 INTRODUCTION The goal of this programming project is to entble studen.pdf INTRODUCTION The goal of this programming project is to entble studen.pdf
INTRODUCTION The goal of this programming project is to entble studen.pdfameancal
 
The visual studio start page is shown in the figure below
The visual studio start page is shown in the figure belowThe visual studio start page is shown in the figure below
The visual studio start page is shown in the figure belowTan Ps
 
Google calendar integration in iOS app
Google calendar integration in iOS appGoogle calendar integration in iOS app
Google calendar integration in iOS appKetan Raval
 
Cis 355 i lab 4 of 6
Cis 355 i lab 4 of 6Cis 355 i lab 4 of 6
Cis 355 i lab 4 of 6helpido9
 
show code and all classes with full implementation for these Program S.pdf
show code and all classes with full implementation for these Program S.pdfshow code and all classes with full implementation for these Program S.pdf
show code and all classes with full implementation for these Program S.pdfAlanSmDDyerl
 
I need help creating this flutter applicationPlease provide a com.pdf
I need help creating this flutter applicationPlease provide a com.pdfI need help creating this flutter applicationPlease provide a com.pdf
I need help creating this flutter applicationPlease provide a com.pdfaggarwalshoppe14
 
Program Specifications in c++ Develop an inventory management system f.docx
Program Specifications in c++ Develop an inventory management system f.docxProgram Specifications in c++ Develop an inventory management system f.docx
Program Specifications in c++ Develop an inventory management system f.docxsharold2
 
Program Specifications in c++ Develop an inventory management syste.docx
Program Specifications in c++    Develop an inventory management syste.docxProgram Specifications in c++    Develop an inventory management syste.docx
Program Specifications in c++ Develop an inventory management syste.docxsharold2
 
Creating a text editor in delphi, a tutorial
Creating a text editor in delphi, a tutorialCreating a text editor in delphi, a tutorial
Creating a text editor in delphi, a tutorialErwin Frias Martinez
 

Similar to Assignment6~$signment6.docxAssignment6Assignment6.docxAs.docx (20)

Implement a Javascript application that allows the user to enter strin.docx
Implement a Javascript application that allows the user to enter strin.docxImplement a Javascript application that allows the user to enter strin.docx
Implement a Javascript application that allows the user to enter strin.docx
 
Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lectures
 
Program Specifications Develop an inventory management system for an e.docx
Program Specifications Develop an inventory management system for an e.docxProgram Specifications Develop an inventory management system for an e.docx
Program Specifications Develop an inventory management system for an e.docx
 
Day 4: Android: UI Widgets
Day 4: Android: UI WidgetsDay 4: Android: UI Widgets
Day 4: Android: UI Widgets
 
Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]
 
I am having trouble writing the individual files for part 1, which i.pdf
I am having trouble writing the individual files for part 1, which i.pdfI am having trouble writing the individual files for part 1, which i.pdf
I am having trouble writing the individual files for part 1, which i.pdf
 
Visualbasic tutorial
Visualbasic tutorialVisualbasic tutorial
Visualbasic tutorial
 
Shiny in R
Shiny in RShiny in R
Shiny in R
 
INTRODUCTION The goal of this programming project is to entble studen.pdf
 INTRODUCTION The goal of this programming project is to entble studen.pdf INTRODUCTION The goal of this programming project is to entble studen.pdf
INTRODUCTION The goal of this programming project is to entble studen.pdf
 
The visual studio start page is shown in the figure below
The visual studio start page is shown in the figure belowThe visual studio start page is shown in the figure below
The visual studio start page is shown in the figure below
 
Google calendar integration in iOS app
Google calendar integration in iOS appGoogle calendar integration in iOS app
Google calendar integration in iOS app
 
Cis 355 i lab 4 of 6
Cis 355 i lab 4 of 6Cis 355 i lab 4 of 6
Cis 355 i lab 4 of 6
 
show code and all classes with full implementation for these Program S.pdf
show code and all classes with full implementation for these Program S.pdfshow code and all classes with full implementation for these Program S.pdf
show code and all classes with full implementation for these Program S.pdf
 
I need help creating this flutter applicationPlease provide a com.pdf
I need help creating this flutter applicationPlease provide a com.pdfI need help creating this flutter applicationPlease provide a com.pdf
I need help creating this flutter applicationPlease provide a com.pdf
 
Program Specifications in c++ Develop an inventory management system f.docx
Program Specifications in c++ Develop an inventory management system f.docxProgram Specifications in c++ Develop an inventory management system f.docx
Program Specifications in c++ Develop an inventory management system f.docx
 
Program Specifications in c++ Develop an inventory management syste.docx
Program Specifications in c++    Develop an inventory management syste.docxProgram Specifications in c++    Develop an inventory management syste.docx
Program Specifications in c++ Develop an inventory management syste.docx
 
Visual Logic Project - 1
Visual Logic Project - 1Visual Logic Project - 1
Visual Logic Project - 1
 
Vb introduction.
Vb introduction.Vb introduction.
Vb introduction.
 
Tutorials2
Tutorials2Tutorials2
Tutorials2
 
Creating a text editor in delphi, a tutorial
Creating a text editor in delphi, a tutorialCreating a text editor in delphi, a tutorial
Creating a text editor in delphi, a tutorial
 

More from ssuser562afc1

Pick an Apollo Mission that went to the Moon.  Some mission only orb.docx
Pick an Apollo Mission that went to the Moon.  Some mission only orb.docxPick an Apollo Mission that went to the Moon.  Some mission only orb.docx
Pick an Apollo Mission that went to the Moon.  Some mission only orb.docxssuser562afc1
 
Pick a topic from data.gov that has large number of data sets on wid.docx
Pick a topic from data.gov that has large number of data sets on wid.docxPick a topic from data.gov that has large number of data sets on wid.docx
Pick a topic from data.gov that has large number of data sets on wid.docxssuser562afc1
 
Pick an animal with sophisticated communication. Quickly find and re.docx
Pick an animal with sophisticated communication. Quickly find and re.docxPick an animal with sophisticated communication. Quickly find and re.docx
Pick an animal with sophisticated communication. Quickly find and re.docxssuser562afc1
 
Pick a real healthcare organization or create your own. Think about .docx
Pick a real healthcare organization or create your own. Think about .docxPick a real healthcare organization or create your own. Think about .docx
Pick a real healthcare organization or create your own. Think about .docxssuser562afc1
 
PHYS 102In the Real World” Discussion TopicsYou may choose yo.docx
PHYS 102In the Real World” Discussion TopicsYou may choose yo.docxPHYS 102In the Real World” Discussion TopicsYou may choose yo.docx
PHYS 102In the Real World” Discussion TopicsYou may choose yo.docxssuser562afc1
 
Photosynthesis and Cellular RespirationCellular respiration .docx
Photosynthesis and Cellular RespirationCellular respiration .docxPhotosynthesis and Cellular RespirationCellular respiration .docx
Photosynthesis and Cellular RespirationCellular respiration .docxssuser562afc1
 
Philosophy of Inclusion Research SupportIt is not enough to simp.docx
Philosophy of Inclusion Research SupportIt is not enough to simp.docxPhilosophy of Inclusion Research SupportIt is not enough to simp.docx
Philosophy of Inclusion Research SupportIt is not enough to simp.docxssuser562afc1
 
PHYSICS DATA SHEET.docx
PHYSICS DATA SHEET.docxPHYSICS DATA SHEET.docx
PHYSICS DATA SHEET.docxssuser562afc1
 
Physical Assessment Reflection Consider your learning and gr.docx
Physical Assessment Reflection Consider your learning and gr.docxPhysical Assessment Reflection Consider your learning and gr.docx
Physical Assessment Reflection Consider your learning and gr.docxssuser562afc1
 
Phonemic Awareness TableTaskScriptingDescription and.docx
Phonemic Awareness TableTaskScriptingDescription and.docxPhonemic Awareness TableTaskScriptingDescription and.docx
Phonemic Awareness TableTaskScriptingDescription and.docxssuser562afc1
 
Philosophy 2582 - Media Ethics Paper 1 (Noam Chomsky) 
.docx
Philosophy 2582 - Media Ethics Paper 1 (Noam Chomsky) 
.docxPhilosophy 2582 - Media Ethics Paper 1 (Noam Chomsky) 
.docx
Philosophy 2582 - Media Ethics Paper 1 (Noam Chomsky) 
.docxssuser562afc1
 
Pick a large company you like. Find their Statement of Cash Flow.docx
Pick a large company you like. Find their Statement of Cash Flow.docxPick a large company you like. Find their Statement of Cash Flow.docx
Pick a large company you like. Find their Statement of Cash Flow.docxssuser562afc1
 
Philosophy 7 Asian Philosophy (Fall 2019) Paper Guidelines .docx
Philosophy 7 Asian Philosophy (Fall 2019) Paper Guidelines .docxPhilosophy 7 Asian Philosophy (Fall 2019) Paper Guidelines .docx
Philosophy 7 Asian Philosophy (Fall 2019) Paper Guidelines .docxssuser562afc1
 
PIC.jpga.zipAPA.pptAPA Style--Review.docx
PIC.jpga.zipAPA.pptAPA Style--Review.docxPIC.jpga.zipAPA.pptAPA Style--Review.docx
PIC.jpga.zipAPA.pptAPA Style--Review.docxssuser562afc1
 
PHIL101 B008 Win 20 ! # AssignmentsAssignmentsAssignmen.docx
PHIL101 B008 Win 20  !  # AssignmentsAssignmentsAssignmen.docxPHIL101 B008 Win 20  !  # AssignmentsAssignmentsAssignmen.docx
PHIL101 B008 Win 20 ! # AssignmentsAssignmentsAssignmen.docxssuser562afc1
 
Phase 3 Structured Probl.docx
Phase 3 Structured Probl.docxPhase 3 Structured Probl.docx
Phase 3 Structured Probl.docxssuser562afc1
 
Phil 2101 Final PaperGuidelines Approximately 5 pages, doubl.docx
Phil 2101 Final PaperGuidelines Approximately 5 pages, doubl.docxPhil 2101 Final PaperGuidelines Approximately 5 pages, doubl.docx
Phil 2101 Final PaperGuidelines Approximately 5 pages, doubl.docxssuser562afc1
 
Perspectives on WarInstructionsAnalyze After watching .docx
Perspectives on WarInstructionsAnalyze After watching .docxPerspectives on WarInstructionsAnalyze After watching .docx
Perspectives on WarInstructionsAnalyze After watching .docxssuser562afc1
 
pestle research for chile bolivia paraguay uruguay .docx
pestle research for chile bolivia paraguay uruguay .docxpestle research for chile bolivia paraguay uruguay .docx
pestle research for chile bolivia paraguay uruguay .docxssuser562afc1
 
Pg. 04Question Four Assignment 2Deadline Saturd.docx
Pg. 04Question Four Assignment 2Deadline Saturd.docxPg. 04Question Four Assignment 2Deadline Saturd.docx
Pg. 04Question Four Assignment 2Deadline Saturd.docxssuser562afc1
 

More from ssuser562afc1 (20)

Pick an Apollo Mission that went to the Moon.  Some mission only orb.docx
Pick an Apollo Mission that went to the Moon.  Some mission only orb.docxPick an Apollo Mission that went to the Moon.  Some mission only orb.docx
Pick an Apollo Mission that went to the Moon.  Some mission only orb.docx
 
Pick a topic from data.gov that has large number of data sets on wid.docx
Pick a topic from data.gov that has large number of data sets on wid.docxPick a topic from data.gov that has large number of data sets on wid.docx
Pick a topic from data.gov that has large number of data sets on wid.docx
 
Pick an animal with sophisticated communication. Quickly find and re.docx
Pick an animal with sophisticated communication. Quickly find and re.docxPick an animal with sophisticated communication. Quickly find and re.docx
Pick an animal with sophisticated communication. Quickly find and re.docx
 
Pick a real healthcare organization or create your own. Think about .docx
Pick a real healthcare organization or create your own. Think about .docxPick a real healthcare organization or create your own. Think about .docx
Pick a real healthcare organization or create your own. Think about .docx
 
PHYS 102In the Real World” Discussion TopicsYou may choose yo.docx
PHYS 102In the Real World” Discussion TopicsYou may choose yo.docxPHYS 102In the Real World” Discussion TopicsYou may choose yo.docx
PHYS 102In the Real World” Discussion TopicsYou may choose yo.docx
 
Photosynthesis and Cellular RespirationCellular respiration .docx
Photosynthesis and Cellular RespirationCellular respiration .docxPhotosynthesis and Cellular RespirationCellular respiration .docx
Photosynthesis and Cellular RespirationCellular respiration .docx
 
Philosophy of Inclusion Research SupportIt is not enough to simp.docx
Philosophy of Inclusion Research SupportIt is not enough to simp.docxPhilosophy of Inclusion Research SupportIt is not enough to simp.docx
Philosophy of Inclusion Research SupportIt is not enough to simp.docx
 
PHYSICS DATA SHEET.docx
PHYSICS DATA SHEET.docxPHYSICS DATA SHEET.docx
PHYSICS DATA SHEET.docx
 
Physical Assessment Reflection Consider your learning and gr.docx
Physical Assessment Reflection Consider your learning and gr.docxPhysical Assessment Reflection Consider your learning and gr.docx
Physical Assessment Reflection Consider your learning and gr.docx
 
Phonemic Awareness TableTaskScriptingDescription and.docx
Phonemic Awareness TableTaskScriptingDescription and.docxPhonemic Awareness TableTaskScriptingDescription and.docx
Phonemic Awareness TableTaskScriptingDescription and.docx
 
Philosophy 2582 - Media Ethics Paper 1 (Noam Chomsky) 
.docx
Philosophy 2582 - Media Ethics Paper 1 (Noam Chomsky) 
.docxPhilosophy 2582 - Media Ethics Paper 1 (Noam Chomsky) 
.docx
Philosophy 2582 - Media Ethics Paper 1 (Noam Chomsky) 
.docx
 
Pick a large company you like. Find their Statement of Cash Flow.docx
Pick a large company you like. Find their Statement of Cash Flow.docxPick a large company you like. Find their Statement of Cash Flow.docx
Pick a large company you like. Find their Statement of Cash Flow.docx
 
Philosophy 7 Asian Philosophy (Fall 2019) Paper Guidelines .docx
Philosophy 7 Asian Philosophy (Fall 2019) Paper Guidelines .docxPhilosophy 7 Asian Philosophy (Fall 2019) Paper Guidelines .docx
Philosophy 7 Asian Philosophy (Fall 2019) Paper Guidelines .docx
 
PIC.jpga.zipAPA.pptAPA Style--Review.docx
PIC.jpga.zipAPA.pptAPA Style--Review.docxPIC.jpga.zipAPA.pptAPA Style--Review.docx
PIC.jpga.zipAPA.pptAPA Style--Review.docx
 
PHIL101 B008 Win 20 ! # AssignmentsAssignmentsAssignmen.docx
PHIL101 B008 Win 20  !  # AssignmentsAssignmentsAssignmen.docxPHIL101 B008 Win 20  !  # AssignmentsAssignmentsAssignmen.docx
PHIL101 B008 Win 20 ! # AssignmentsAssignmentsAssignmen.docx
 
Phase 3 Structured Probl.docx
Phase 3 Structured Probl.docxPhase 3 Structured Probl.docx
Phase 3 Structured Probl.docx
 
Phil 2101 Final PaperGuidelines Approximately 5 pages, doubl.docx
Phil 2101 Final PaperGuidelines Approximately 5 pages, doubl.docxPhil 2101 Final PaperGuidelines Approximately 5 pages, doubl.docx
Phil 2101 Final PaperGuidelines Approximately 5 pages, doubl.docx
 
Perspectives on WarInstructionsAnalyze After watching .docx
Perspectives on WarInstructionsAnalyze After watching .docxPerspectives on WarInstructionsAnalyze After watching .docx
Perspectives on WarInstructionsAnalyze After watching .docx
 
pestle research for chile bolivia paraguay uruguay .docx
pestle research for chile bolivia paraguay uruguay .docxpestle research for chile bolivia paraguay uruguay .docx
pestle research for chile bolivia paraguay uruguay .docx
 
Pg. 04Question Four Assignment 2Deadline Saturd.docx
Pg. 04Question Four Assignment 2Deadline Saturd.docxPg. 04Question Four Assignment 2Deadline Saturd.docx
Pg. 04Question Four Assignment 2Deadline Saturd.docx
 

Recently uploaded

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfSanaAli374401
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 

Recently uploaded (20)

Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
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
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 

Assignment6~$signment6.docxAssignment6Assignment6.docxAs.docx

  • 1. Assignment6/~$signment6.docx Assignment6/Assignment6.docx Assignment #6 Important: This is an individual assignment. Please do not collaborate. No late assignment will be accepted. Make sure that you write every line of your code. Using code written by someone else will be considered a violation of the academic integrity and will result in a report to the Dean's office. Requirements to get full credits in Documentation 1. The assignment number, your name, student ID, lecture number, and a class/file description need to be included at the top of each file/class. 2. A description of each method is also needed. 3. Some additional comments inside of methods to explain code that are hard to follow should be written. You can look at the Java programs in the text book to see how comments are added to programs. Minimal Submitted Files You are required, but not limited, to turn in the following source files: Assignment6.java (The Assignment6 class extends JApplet) Project.java Budget.javaCreatePanel.java - to be completed (it extends JPanel and contains ButtonListener nested class) ProjectSpendingPanel.java - to be completed (it extends JPanel and contains ButtonListener nested class) You can download the above files and use them to complete this assignment. You might need to add more methods than the
  • 2. specified ones. Skills to be Applied: Swing/AWT, Vector (very similar to ArrayList class) Classes may be needed: JApplet, JButton, JTextField, JTextArea, JLabel, Container, JPanel, JTabbedPane, JList, and ActionListener. You may use other classes. How to run an applet program: -Create an html file, say "hw6.html" with the following content: -------------------------------------------------------- <html> <head> <title>Assignment 6 Applet</title> </head> <body> <applet code="Assignment6.class" width=900 height=350> </applet> </body> </html> ------------------------------------------------------ -Compile your java program as usual. -In a console, type: appletviewer hw6.html (instead of typing "java Assignment6"). -In the TextPad, choose Tool->Run Java Applet or press Ctrl-3 (press control key and 3 at the same time).
  • 3. -In the jGrasp, choose Run->Run as Applet. To test to see if your machine is set to view an applet, please go to the following site: Click this page Program Description Suggested Class Diagram: Write a Java program that constructs an Applet. Your program should provide labels and textfields to a user to enter information regarding projects. The Applet (JApplet) of your program should contain two tabs. The first tab is labeled "Project creation" and the second tab is labeled "Project spending". (The size of the applet here is approximately 900 X 350). The section under the first tab should be divided into two parts: The left part contains labels, textfields, and a button for a user to enter some project information. The right part shows "No project" at the beginning (it is done usingJTextArea). A user can enter some project information, and push "Create a project" button. Then the project information should appear on the right hand side panel (note that the format of the project information can be using toString() method of the Project class). A message "Project added" should also appear with red color at the top of the panel. Error handling: 1. If a user forgets to enter some field and pushes "Create a project" button, show a message "Please fill all fields" with red color, and nothing should be added to the right hand side panel. 2. If a user enters a non-numeric value for project number or initial funding, and push "Create a project" button, show a
  • 4. message "Please enter a numeric value for project number and initial funding" with red color, and nothing should be added to the right hand side panel. After entering several projects, the applet will have the following appearance. Note that a scroll pane needs to be added to show multiple projects. Under the "Project spending" tab, a user can choose a project to specify spending. There should be a JList containing all projects created by Project creation panel and a user can choose a project within it by clicking it. Below the JList, there should be a JTextField where a user can enter some spending and a button to add some spending. The list of projects in the JList should be exactly same as the list under "Project creation" tab. A user can choose a project and specify its spending, then push " Submit Budget " button. After pushing the button, it should update the spending and current balance of the project as follows. Note that a scroll pane needs to be added to show the entire project information. Another user can add spending for other projects as well: A user should be able to go back and forth between "Project creation" tab and "Project spending" tab, and these two panels need to have consistent information, i.e., the same list of projects. Note that the list of projects created in the CreatePanel needs to be consistent in the list in ProjectSpendingPanel, but the spending and current balance updated in the ProjectSpendingPanel do not need to be reflected
  • 5. in CreatePanel. Class description ProjectSpendingPanel ProjectSpendingPanel class extends JPanel defined in javax.swing package. It should contain at least the following instance variable: Attribute name Attribute type Description projectList Vector a list of project objects. This class should have a constructor: public ProjectSpendingPanel(Vector projectList) where the parameter "projectList" is passed from the Assignment6 class. The constructor layouts and organizes components in this panel. You will be adding more variables (components) than what is listed here, including JList, labels, a textfield, and a button. The JList should be instantiated using the "projectList" vector. Then whenever the vector is updated, the JList will be updated as well by calling its updateUI() method. They will utilize the toString( ) method of the Project class to display each item. public void updateProjectList() This method calls updateUI() method for the JList that you will be creating. You need to instantiate your JList using the projectList in the constructor. The projectList will be constantly updated under the "Project creation" tab and when it is updated, this method should be called from the actionPerformed method in the ButtonListener of theCreatePanel class so that the JList under the "Project spending" will have the same update project list in them. This class contains a nested class called ButtonListener class that implements ActionListener interface. Thus you need to define its actionPerformed method that is supposed to update the
  • 6. spending and current balance, and display them when the "Add Spending" button is pushed. CreatePanel CreatePanel extends JPanel defined in the javax.swing package. It should contain at least the following instance variable: Attribute name Attribute type Description projectList Vector a list of Project objects. spendingPanel ProjectSpendingPanel an object of ProjectSpendingPanel. This class should have a constructor: public CreatePanel(Vector projectList, ProjectSpendingPanel sp endingPanel) where the parameter "projectList" is passed from the Assignment6 class and the second parameter is an object of ProjectSpendingPanel. The constructor layouts and organizes components in this panel. You will be adding more variables (components) than what is listed here, including labels, textfields, a button, and a text area. This class contains a nested class called ButtonListener class that implements ActionListener interface. Thus the ButtonListener needs to have a definition foractionPerformed method that adds some project information to the list and does error handling. See the UML class diagram for the parameter and return type of this method. In the actionPerformed, you need to extract the information from the two textfields for the title and publisher. Then you can instantiate an object of the Project class using the information. You can use the toString( ) method of the Project object to display the information on the textarea on the right hand side and also add the Project object to the "projectList".
  • 7. Assignment6 class Assignment6 class extends JApplet defined in javax.swing package. It contains at least init() method (see UML diagram for its return type) to instantiate all instance variables and adds its components to itself. It also sets its size. It contains at least following instance variables: Attribute name Attribute type Description projectList Vector a list of project objects. It will be used in both createPanel and spendingPanel. spendingPanel ProjectSpendingPanel an object of ProjectSpendingPanel. createPanel CreatePanel an object of CreatePanel. tPane JTabbedPane an object of JTabbedPane. It will contain createPanel and spendingPanel under each tab. Grading Policy: · submit assignment on time · indicate assignment number, name, lecture number, and description of each class clearly in each submitted java file · your program minimally has the following functionalities: 1. 2 points: Appropriate components such as textfields, labels, etc. are shown under the "Project creation" and "Project spending" tabs. JScrollPane is added to display the entire information on each Panel. 2. 1 point: When the "Create a project" button is pushed, the project information from textfields is added on the right panel in the correct order and the message of "project added" shows up.
  • 8. 3. 1 point: Error handing in case some field is not filled. 4. 1 point: Error handing in case a non-numeric value is entered for projNumber or funding. 5. 1 point: The same list of projects is shown under the "Project creation" tab and under the "Project spending" tab. 6. 2 point: When the add spending button is pushed, the spending and current balance are updated correctly. Assignment6/Assignment6.javaAssignment6/Assignment6.java// Assignment #: 6 // Name: your name // StudentID: your id // Lecture: your lecture days/time // Description: The Assignment 6 class creates a Tabbed Pane with // two tabs, one for Project creation and one for // Project spending. and adds it as its Applet content // and also sets its size. import javax.swing.*; import java.util.*; publicclassAssignment6extendsJApplet { privateint APPLET_WIDTH =900, APPLET_HEIGHT =350; privateJTabbedPane tPane; privateCreatePanel createPanel; privateProjectSpendingPanel spendingPanel; privateVector projectList; //The method init initializes the Applet with a Pane with two tab s publicvoid init() {
  • 9. //list of projects to be used in every panel projectList =newVector(); //review panel uses the list of projects spendingPanel =newProjectSpendingPanel(projectList); createPanel =newCreatePanel(projectList, spendingPanel); //create a tabbed pane with two tabs tPane =newJTabbedPane(); tPane.addTab("Project creation", createPanel); tPane.addTab("Project spending", spendingPanel); getContentPane().add(tPane); setSize (APPLET_WIDTH, APPLET_HEIGHT);//set Applet size } } Assignment6/Budget.javaAssignment6/Budget.java// Assignmen t #: // Name: // StudentID: // Lecture: // Description: The class Budget represents a budget of a projec t import java.text.NumberFormat; publicclassBudget { privatedouble initialFunding; privatedouble spending;
  • 10. privatedouble currentBalance; //Constructor to initialize all member variables publicBudget(double funding) { initialFunding = funding; spending =0.0; currentBalance = initialFunding - spending; } //add some additional spending publicboolean addSpending(double additionalSpending) { if(additionalSpending >0&& additionalSpending <= currentBala nce) { spending += additionalSpending; currentBalance = initialFunding - spending; returntrue; } else returnfalse; } //toString() method returns a string containg its initial funding //spending and current balance publicString toString() { NumberFormat fmt =NumberFormat.getCurrencyInstance(); String result ="Budget:" +"nInitial Fundingtt"+ fmt.format(initialFunding) +"nSpendingtt"+ fmt.format(spending) +"nCurrent Balancet"+ fmt.format(currentBalance); return result; } }
  • 11. Assignment6/CreatePanel.javaAssignment6/CreatePanel.java// Assignment #: 6 // Name: your name // StudentID: your id // Lecture: your lecture days/time // Description: It needs to be filled import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; publicclassCreatePanelextendsJPanel { privateVector projectList; privateJButton button1; privateProjectSpendingPanel spendingPanel; //Constructor initializes components and organize them using ce rtain layouts publicCreatePanel(Vector projectList,ProjectSpendingPanel spe ndingPanel) { this.projectList = projectList; this.spendingPanel = spendingPanel; //organize components here button1 =newJButton("Create a project"); add(button1); }
  • 12. //ButtonListener is a listener class that listens to //see if the buttont "Create a project" is pushed. //When the event occurs, it adds a project information from //the text fields to the text area. It also creates a Project object //using theinformation and add it to the projectList. //It also does error checking. privateclassButtonListenerimplementsActionListener { publicvoid actionPerformed(ActionEvent event) { // if there is no error, add a project to project list // otherwise, show an error message }//end of actionPerformed method }//end of ButtonListener class }//end of CreatePanel class Assignment6/Project.javaAssignment6/Project.java// Assignmen t #: // Name: // StudentID: // Lecture: // Description: The class Project represents a project . publicclassProject { privateString projName; privateint projNumber; privateString projLocation; privateBudget projBudget; //Constructor to initialize all member variables publicProject(double funding) {
  • 13. projName ="?"; projNumber =0; projLocation ="?"; projBudget =newBudget(funding); } //Accessor methods publicString getName() { return projName; } publicint getNumber() { return projNumber; } publicString getLocation() { return projLocation; } publicBudget getBudget() { return projBudget; } //Mutator methods publicvoid setName(String aName) { projName = aName; } publicvoid setNumber(int aNumber) { projNumber = aNumber;
  • 14. } publicvoid setLocation(String aLocation) { projLocation = aLocation; } //Add a new expenditure to the budget publicboolean addExpenditure(double amount) { boolean success = projBudget.addSpending(amount); return success; } //toString() method returns a string containg its name, number, l ocation and budget publicString toString() { String result ="nProject Name:tt"+ projName +"nProject Number:t"+ projNumber +"nProject Location:t"+ projLocation +"n" + projBudget.toString()+"nn"; return result; } } Assignment6/ProjectSpendingPanel.javaAssignment6/ProjectSp endingPanel.java// Assignment #: 6 // Name: your name // StudentID: your id // Lecture: your lecture days/time
  • 15. // Description: It needs to be filled import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.util.*; publicclassProjectSpendingPanelextendsJPanel { privateVector projectList; //Constructor initialize each component and arrange them using //certain layouts publicProjectSpendingPanel(Vector projectList) { this.projectList = projectList; //organize components for spending panel } //This method refreshes the JList with //updated vector information publicvoid updateProjectList() { //call updateUI() for the JList object } //ButtonListener class listens to see the button "Add Spending" i s pushed. //A user can choose which project to add spending, and that will update the //spending and current balance of such project. privateclassButtonListenerimplementsActionListener {
  • 16. publicvoid actionPerformed(ActionEvent event) { //get some additional spending from the textfield, //update the spending and current balance //for the chosen project in the JList. } }//end of ButtonListener class }//end of ProjectSpendingPanel class Similarities and Differences Discuss the similarities and differences between organisms in the domains Bacteria and Archaea. Your assignment should be 250-500 words in length Please include all references and site in paper