• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Java Assignment

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Frendz

I am posting a Java assignment. I am doing MBA(IT) from Symbiosis and I have to submit an assignment on Thursday. Im trying few questions, If anyone has solution to any of the programs, Please forward the same.

Here is the list of questions

Assignment for Java



Note: 1. Solve any 10 programmes

2. Each Programme carries 10 marks

3. The weight of these programmes is 40% (other 60% is for Online assignment submission)

Q. 1. Write a program that converts a decimal number to Roman number. Decimal Number is accepted as command line input at the time of execution

Q. 2. Write a program that prints prime numbers between 1 to n. Number n should be accepted as command line input.

Q. 3. Write a program that prints first n Fibonacci numbers. Number n should be accepted as command line input. Any Fibonacci number is calculated as, sum of its previous 2 numbers,

e.g. 0 , 1 , 1 , 2, 3 , 5 , 8 , 13 , ����..

First 2 Fibonacci numbers are 0 and 1.

Q. 4. Write a program to print out multiplication tables from 9 to 17 using (I) for loops (II) while loops (III) do loops.

Q. 5. Write a program to print the following triangle of numbers.

1

1 2

1 2 3

1 2 3 4

1 2 3 4 5



Q. 6. Write a program to convert Fahrenheit temperature to the Centigrade equivalent. Fahrenheit temperature should be accepted from the user.

Centigrade = (Fahrenheit � 32) * 5.0/9.0

Q . 7. Define a class called Circle with the attributes radius, circumference, and area of the circle. Write a program to display all attributes of the circle for 5 Circles. Radius for all 5 circles should be accepted as command line input at the beginning. e.g. java Circlejava 5 10 12 25 36

Q . 8. Write a program to find the Factorial of a number using Recursion. Factorial can be defined as Factorial(n) = 1 * 2 * 3 �.* (n-1) * n.

Q . 9. Write a program to get the input values Principal, rate of interest and number of Years from the keyboard and find the simple interest.

Q. 10. Write a program to create an applet with yellow back ground and display the Message WELCOME TO THE JAVA WORLD. Write its HTML document also.

Q. 11. Write a java program to create a Frame with three buttons Morning, Afternoon and Evening. When we click Morning button, the message �Good Morning to you� must be displayed. Similar messages must be displayed for the other buttons also.

Q. 12. Write a Java program to create a List box with some colors in the items. When the color is selected, the background color must change accordingly. Write a program which creates and displays the details in the List box on the window.

Q13. Write a program to show demonstration of CardLayout and Flowlayout. Create 2 panel, Top & Main. Top panel contains 3 buttons Button 1 , Button 2 & Button 3 in Flowlayout. Main panel contains 3 panels First Panel, Second Panel and Third Panel. On selection of any panel display appropriate message. Here Applet is to be used by implementing ActionListener.

Q . 14. Write a Java program to create a Frame which responds to the mouse click. For each event with mouse ( such as mouse up, mouse down etc.) the corresponding message must be displayed.

Q . 15 . Write a program to explain the multithreading with the use of multiplication tables. Three threads must be defined. Each one must create one multiplication table, they are 5 table, 7 table and 13 table. And assign priority 1 to 5 Table, priority 5 to 7 Table and priority 8 to 13 Table. And then run the threads.

Q . 16 . Write a Java program to create simple Calculator for 4 basic Math operations, Addition, Subtraction, Multiplication and Division. In the window there are four radio buttons called Add, Sub, Mul and Div at the Top. This group is called Operation. There are two textfield objects to input first and second number.We must type the numbers and select one of the operations. When we click the perform button, the result is displayed. For example if the first number is 10 and second number is 72 And operation selected is Mul then the result is displayed as,
The result is 720.

Thnks & Regards

Perry
 
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
DoYourOwnHomework
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How are you going to be worth your MBA diploma if you let other people do the work for you?
 
perry ellis
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
MBA is about learning art of delegation
So stop the chit chat and start solving the questions
 
Bartender
Posts: 612
7
Mac OS X Python
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, are you suggesting that Symbiosis supports and encourages you to solicit others to do your work and granting credit to you for such?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


So stop the chit chat and start solving the questions


As light-hearted as that comment may be intended to be, it is not likely to illicit too many useful responses. At JavaRanch, simply supplying someone with the answers to assignments is strongly discouraged. Most people are more than happy to help if you demonstrate some attempt to do your own work first.

With that in mind, perhaps you could post the questions you are stuck on, and what you have tried/what you think the answer might be. People will almost certainly help nudge you in the right direction.
[ May 30, 2006: Message edited by: Paul Sturrock ]
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, finished all 16.

where do I send them, so my work can be marked?
 
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Michael Dunn:
OK, finished all 16.

where do I send them, so my work can be marked?



Perry, you forgot to include your prof's email address, so that we can send him your assignment!
 
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
he also forgot to mention his creditcard number so we can automatically debit him for the hours spent...
 
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
question #5 can be solved with this program:



no, seriously - we would be happy to help you, but first show us what you did... :-)

jan
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Besides asking people to do his mate's homework for him (!) Perry also stands in violation of our naming policy, which demands that your display name not be obviously fictitous. I won't bother telling him to change his name, however, since it doesn't look like he'll be back.
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ernest Friedman-Hill:
Perry also stands in violation of our naming policy, which demands that your display name not be obviously fictitous. I won't bother telling him to change his name, however, since it doesn't look like he'll be back.



Too bad. I'm going to miss his clean-cut yet casual style...
 
perry ellis
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thnx for all the prompt responses, I have sent my assignment already 
But itz good to know, ppl responded to this thread, I wsn�t expecting any�

Cheerios�

Perry ( it�s a sweet name though not mine)
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you came, you saw, we conquered
 
Jesper de Jong
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So did you learn how delegating works now?

I hope I won't meet people like you in my professional life.
 
perry ellis
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes very well
Had circulated assignment in my team and had created a shared folder on my machine (VSS...LOL)
The assignment was done in 1 hr
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ernest Friedman-Hill:
... Perry also stands in violation of our naming policy, which demands that your display name not be obviously fictitous. I won't bother telling him to change his name, however, since it doesn't look like he'll be back.


I will, since he is back and apparently missed your hint, and has admitted that "Perry" isn't his real name...


"perry ellis,"

Welcome to JavaRanch!

Please revise your display name to meet the JavaRanch Naming Policy. To maintain the friendly atmosphere here at the ranch, we like folks to use real (or at least real-looking) names. You can edit your name here.

Thank you for your prompt attention!

-Marc
[ June 07, 2006: Message edited by: marc weber ]
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> Had circulated assignment in my team...
> The assignment was done in 1 hr

an hour? - must be a team of one
 
Marshal
Posts: 80652
476
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
. . . and did you take an hour to work out that no 7 is mathematically unsound?
 
perry ellis
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No I solved this one... I have the program, Just in case you wanna have a look, Wot I did.. here it is

public class Circles
{
public static void main(String[] args)
{
double far = 0, cel = 0;
double[] rad = new double[5];

if(args.length < 5)
{
System.out.println("Enter 5 arguments.");
System.exit(0);
}
try
{
for(int i = 0;i<5;i++)
{
rad[i] = Double.parseDouble(args[i]);
}
for (int i = 0; i<5; i++)
{
System.out.println("Radius of "+(i+1)+"th circle : "+rad[i]);
System.out.println("Circumference of "+(i+1)+"th circle : "+(long)(2.0*Math.PI*rad[i]*100)/100.0);
System.out.println("Area of "+(i+1)+"th circle : "+(long)(Math.PI*rad[i]*rad[i]*100)/100.0);
System.out.println();
}

}
catch (NumberFormatException nfe)
{
System.out.println("Enter a valid number");
}
}
}


It gets compiled and runs fine, takes 5 arguments
javac Circles.java
java Circles 3 4 5 6 7 8


Tell me if you think, its wrong ?
 
Campbell Ritchie
Marshal
Posts: 80652
476
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have got too much in the main method. You really ought to have had an array of Circle objects.

But you haven't done what they said. You have not fallen into the trap your question falls into.

Q . 7. Define a class called Circle with the attributes radius, circumference, and area of the circle. Write a program to display all attributes of the circle for 5 Circles. Radius for all 5 circles should be accepted as command line input at the beginning. e.g. java Circlejava 5 10 12 25 36


You are told to have 5 circles with three attributes each. The mistake is in the question: A circle doesn't have three atrributes; it only has one (usually radius). If it had three attributes you could set its radius to 10, its circumference to 12 and its area to 20!

Do you see the error in the question specification?
[ June 08, 2006: Message edited by: Campbell Ritchie ]
 
Jan Groth
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@campbell

they are talking about attributes of the to-be-designed class "Circle". seems as if the posted solution is not taking this into account...

jan
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Stick to fashion, Perry.
 
Campbell Ritchie
Marshal
Posts: 80652
476
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But circles don't have three attributes. They only have one.
In real mathematics nobody tells you to draw a circle radius 10, circumference 62.8318, area 314.159, they tell you to draw a circle radius 10.
You have to calculate the other figures from the radius. Which Peery has done.
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
... you say attribute, I say property ...
 
marc weber
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"perry,"

Please check your Private Messages. Thanks!
 
reply
    Bookmark Topic Watch Topic
  • New Topic