free geoip

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cs504 assignment no 2 fall 2011 on 15th November, 2011
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support
#1
[FONT=&quot]Instructions[/FONT]
[FONT=&quot]Please read the following instructions carefully before solving & submitting assignment:[/FONT]
[FONT=&quot]It should be clear that your assignment will not get any credit (zero marks) if:[/FONT]
[FONT=&quot]o [/FONT][FONT=&quot]The assignment is submitted after due date.[/FONT]
[FONT=&quot]o [/FONT][FONT=&quot]The submitted assignment does not open or file corrupt.[/FONT]
[FONT=&quot]o [/FONT][FONT=&quot]The assignment is copied (from other student or ditto copy from handouts or internet).[/FONT]
[FONT=&quot]o [/FONT][FONT=&quot]Student ID is not mentioned in the assignment File or name of file is other than student ID.[/FONT]

[FONT=&quot]Uploading instructions[/FONT]

[FONT=&quot]Your Submission must include:[/FONT]

  1. All the Source Code (.java files) and other if necessary files to compile and run your program.
  2. If and only if there are multiple files to submit place all the files in a Zip file and Upload it on VULMS else only source code file is required to be submitted.

Note: Use Notepad for coding and JDK package for java source code compilation and running (JDK is also available on download section of VULMS)
[FONT=&quot]Objective[/FONT]

The objective of this assignment is

[FONT=&quot]o [/FONT]To give you some practice exercise of GUI and understanding use of it.



[FONT=&quot][EMAIL="cs506@vu.edu.pk"]
[/EMAIL][/FONT]

[FONT=&quot]GOOD LUCK[/FONT]
[FONT=&quot]Marks: 15 [/FONT]
Question:
Write the ideal weight calculator so that height in inches is entered by using a slider. Use the approximate formula:

W = H2 / 30 , for female[Image: cs504.jpg]

W = H2 / 28 , for male


where W is the ideal weight in pounds,

H is the height in inches
Set an action command for each radio button using [FONT=&quot]setActionCommand(String)[/FONT].
Add an
action listener for each button using [FONT=&quot]addActionListener()[/FONT].
Add a
change listener for the slider using [FONT=&quot]addChangeListener()[/FONT].
The ideal weight should be displayed in a text field when the user changes either a radio button or the slider.
Pick initial settings for the buttons and slider. When the program starts up display the ideal weight for those settings.

Note: Your code must justify enough for 15 marks.


[FONT=&quot]Lectures Covered: This assignment covers Lecture # 10-13[/FONT]
[FONT=&quot]Deadline[/FONT]
[FONT=&quot]Your assignment must be uploaded/submitted at or before 15/11/2011. [/FONT]


Attached Files
.doc   Fall 2011_CS506_2.doc (Size: 162 KB / Downloads: 127)
Reply
#2
Code:
import java.awt.*; import javax.swing.*; public class Slider { public void initGUI() { frame = new JFrame("Your Ideal Weight"); l1 = new JLabel("Your Gender"); l2 = new JLabel("Your Height in inches"); l3 = new JLabel("Ideal Weight"); male = new JRadioButton("Male", true); female = new JRadioButton("Female", false); tfwt = new JTextField(15); slider = new JSlider(1, 40, 80, 70); slider.setPaintTicks(true); slider.setSnapToTicks(true); slider.setMajorTickSpacing(10); slider.setMinorTickSpacing(1); slider.setPaintLabels(true); p1 = new JPanel(new GridLayout(1, 2, 0, 75)); p1.add(l1); p1.add(l2); p2 = new JPanel(new GridLayout(1, 2, 0, 75)); p2.add(l3); p2.add(tfwt); p3 = new JPanel(new GridLayout(2, 1, 20, 0)); p3.add(male); p3.add(female); Container container = frame.getContentPane(); container.setLayout(new BorderLayout()); container.add(p1, "North"); container.add(slider, "Center"); container.add(p3, "West"); container.add(p2, "South"); frame.setDefaultCloseOperation(3); frame.setSize(250, 400); frame.setVisible(true); } public Slider() { initGUI(); } public static void main(String args[]) { Slider slide = new Slider(); } JFrame frame; JLabel l1; JLabel l2; JLabel l3; JRadioButton male; JRadioButton female; JTextField tfwt; JSlider slider; JPanel p1; JPanel p2; JPanel p3; }
Reply
#3
What is this?????????
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  CS301 Assignment # 4 Due Date: 02-Feb-2016 Vuhelper 0 2,356 02-03-2016, 05:38 PM
Last Post: Vuhelper
  CS703 – Advanced Operating Systems Assignment No.3 solution January 2016 Vuhelper 0 5,943 01-23-2016, 09:58 PM
Last Post: Vuhelper
  CS601 Data Communication Assignment No. 03 Solution 23rd January 2016 Vuhelper 1 1,971 01-23-2016, 06:09 PM
Last Post: Vuhelper
  CS403 Assignment No. 03 Solution 23rd January 2016 Vuhelper 2 1,212 01-23-2016, 03:18 PM
Last Post: Vuhelper
  CS506 Web Design and Development Assignment no 3 Solution 3rd January 2016 Vuhelper 0 2,280 01-23-2016, 03:16 PM
Last Post: Vuhelper
  CS724 Software Process Improvement Assignment No 01 Solution 20th January 2016 Vuhelper 0 2,007 01-20-2016, 06:26 PM
Last Post: Vuhelper
  CS711 Software Design Assignment No 01 Solution Due Date Feb 12, 2016 Vuhelper 0 1,702 01-20-2016, 06:24 PM
Last Post: Vuhelper
  CS709 Formal Methods for Software Engineering Assignment No 01 Solution January 2016 Vuhelper 0 1,838 01-20-2016, 06:22 PM
Last Post: Vuhelper
  cs703 assignment no 3 Solution 20th January 2016 Vuhelper 0 1,739 01-20-2016, 06:20 PM
Last Post: Vuhelper
  CS704 Assignment No. 01 Solution January 2016 Vuhelper 0 4,835 01-20-2016, 06:19 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support