0% found this document useful (0 votes)
26 views

Department of Computer Science: Assignment 3

The document provides instructions for an assignment to create a GUI for a salon service using Java Swing. Students are to write code for a StartFrame with login functionality and a MainFrame with buttons to add new customers, generate bills, and logout. The MainFrame should dynamically change panels when its buttons are clicked to either enter customer details or display bills using separate CustomerPanel and BillPanel classes.

Uploaded by

aqsa ismail
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Department of Computer Science: Assignment 3

The document provides instructions for an assignment to create a GUI for a salon service using Java Swing. Students are to write code for a StartFrame with login functionality and a MainFrame with buttons to add new customers, generate bills, and logout. The MainFrame should dynamically change panels when its buttons are clicked to either enter customer details or display bills using separate CustomerPanel and BillPanel classes.

Uploaded by

aqsa ismail
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

DEPARTMENT OF COMPUTER SCIENCE

UW
Assigned Date: 10-12–19
ASSIGNMENT 3

Discipline/Semester: BSCS 3RD


Course Code: CS-212 Due Date: 23- 12 - 19
Course : Advanced Object Oriented Programming
Total Marks: 10
Note: Plagiarized assignments will be marked zero. Continuous plagiarism will result in negative
marking.

You need to create a GUI for a Salon Service. We will only consider the ordinary customers for now.
You will be provided with the Customer class that you will use at the back-end of this GUI.

Note: It is not mandatory to follow the given layout. You can come up with even better GUI. Keep
in mind additional marks will be given for a good looking GUI.

1. Write code for StartFrame with a similar layout given below:

 When you enter correct username and password and click login.
o The current frame becomes invisible
o An instance of MainFrame becomes visible
 When you enter incorrect username or password and click login.
o Displays message incorrect username and password

2. Write code for MainFrame with a similar layout given below:

Hint: You will need a JToolbar

JToolBar toolbar = new JToolBar();


toolbar.setRollover(true);
JButton buttonNew = new JButton( new ImageIcon(("C:\\ newCustomer.png")));
toolbar.add(buttonNew);

 If you click newCustomer button


o You are shown a panel to enter customer details

Hint: Create a different class BillPanel and CustomerPanel for your ease. Both class extends
JPanel.
You will need to dynamically add and remove panel from the final panel p1.

try{
p1.remove(bp);}
catch(Exception e2){
}
cp=new CustomerPanel();
p1.add(cp, BorderLayout.CENTER);
validate();

}
o The application should get current date automatically and display it as label.
o If you click Create button, a Customer class object should be initialized, with the data
present in the JComponents.
 Customer class object requires; customer name and Visit class object.
Obtain name from JTextField.
 A Visit class object requires; current date, service charges and product charges.
Get currentDate from System. Get service charges from JTextField. Get product
charges from text of currently selected JRadioButton.
Note: Adding pictures with RadioButton is compulsory, it carries marks
 If you click generateBill button
o The panel in center of MainFrame changes to a different Panel.

Hint: Create a different class BillPanel and CustomerPanel for your ease. Both class extends
JPanel. You will need to dynamically add and remove panel from the final panel p1.
try{
p1.remove(cp);}
catch(Exception e2){
}
bp=new BillPanel();
p1.add(bp, BorderLayout.CENTER);
validate();
}

o Call the printBill() function over the Customer class object and get the bill in String form.
Display it using any JComponent.
 If Customer has not been created display, “No Customer Found” on any
JComponent.
 If you click logout button
o Make the MainFrame invisible
o Make the StartFrame visible

You might also like