We have been working very hard since 2009 to facilitate in your learning Read More. We can't keep up without your support. Donate Now.

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More

Assignment No. 01
Semester: Fall 2016
Web Design and Development -CS506
Total Marks: 20
Due Date: November 21,
2016
Instructions:
Please read the following instructions carefully before submitting assignment:
 You should submit your assignment before or on due date on VULMS.
 Your assignment should be your own work. It should not be copied from internet,
handouts or books.
 You are suggested to use Netbeans IDE for developing your assignment.
 You should import java swing and math packages in your classes.
 You should create project with your Roll No. in Netbean IDE and create required
classes.
 You should zip your complete project (along with .java,.class and .jar files etc.) and
upload on VULMS as a single file.
 Your zipped file should be in .zip or .rar file format only. Any compressed format
other than .zip or .rar of your programs will be considered the incorrect files and
rewarded by zero.
 Assignment sent via Email will not be replied and accepted in any case.
 If the submitted assignment does not open or file is corrupt, it will not be marked and
awarded Zero marks.
Objectives:
To build understanding towards building classes along with its related methods
To know how to write default and parameterized constructors
To write user-defined methods in classes and invoke them
To take user input using Graphical User Interface (GUI)
For any query about the assignment, contact at CS506@vu.edu.pk
Question: Marks 20
Write a java program to prompt the user to take the input in a double variable for the radius of a
sphere, and call method sphereVolume() to calculate the volume of the sphere.
Use the following statement to calculate the sphere volume:
Double volume = (4.0 /3.0) * Math.PI * Math.pow(radius, 3)
Note:
You should define two public classes Sphere and SphereTest. The Sphere class will contain the
calculation procedure of sphere along with data members and getter / seyter methods. SphereTest
class will contain the main method and use the object of first class to call its method.
Your program should have a separate print() method for displaying the volume of the sphere.
You should ensure that input value for radius should not be negative nor 0. In such cases, re-prompt
user to input again.
You should parse the input into related primitive data type using Wrapper classes, if required.
You should pass the user input to parameterized constructor.
You should write a default constructor that would set the value for radius to 1.0 for Sphere class.
BEST OF LUCK


+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)


Views: 11911

Replies to This Discussion

mujhe b help chaye kindly guide kr den

To convert userInput string to double value you can use Double.parseDouble() method. 1.declare two classes 2. declare two private variables and there geters and seters in Sphere class 3. create a decault constructor and set value of radius to 1.0 with this constructor 4. create anOther constructor which takes input in type double and assigns it using geters seters of our radius. 5. then make a calculation method which takes a parameter 6. user our geter of radius to pass value of radius to calculation method and use the formula mentioned in the assignment file 7. then simple make a print method with void return type 8. go to main function declare a variable to take use input 9. use Double.parseDouble() method to convert it to double 10. then use while loop to ask i

Thankss alot..

Sorry main me hum ne kis k liye double and parse use krna hai??

Finally I have done it.Thank God

code share kr sakty?

Dear Student to complete CS506 Assignment First you need to Install JDK and Set path for Java. watch this video for installation and Path Setting

https://www.youtube.com/watch?v=qofS-4r1mxQ&t=7s

After JDK Installation and Path Setting. Follow this Video for complete solution of Assignment (console based) with line by line explanation of Code.

https://www.youtube.com/watch?v=8dDqKB8BU4k

Dear Student if you complete you assignment in console base as already video provided for solution now you can follow this video to complete your assignment in Graphical User Interface GUI.

https://www.youtube.com/watch?v=JAZF3kYs2xM

nhi smjh arha is ka kuch bi .... 

Getting Errors in the code can't understand too flushed. :(

RSS

© 2020   Created by +M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service

.