This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Java Assignment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java Assignment" Watch "Java Assignment" New topic
Author

Java Assignment

perry ellis
Greenhorn

Joined: May 30, 2006
Posts: 5
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
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
DoYourOwnHomework


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

How are you going to be worth your MBA diploma if you let other people do the work for you?


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
perry ellis
Greenhorn

Joined: May 30, 2006
Posts: 5
MBA is about learning art of delegation
So stop the chit chat and start solving the questions
Steve Fahlbusch
Bartender

Joined: Sep 18, 2000
Posts: 557
    
    7

So, are you suggesting that Symbiosis supports and encourages you to solicit others to do your work and granting credit to you for such?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


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 ]

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
OK, finished all 16.

where do I send them, so my work can be marked?
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
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!
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
he also forgot to mention his creditcard number so we can automatically debit him for the hours spent...


42
Jan Groth
Ranch Hand

Joined: Feb 03, 2004
Posts: 456
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
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

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.


[Jess in Action][AskingGoodQuestions]
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
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

Joined: May 30, 2006
Posts: 5
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

Joined: Jun 09, 2003
Posts: 4632
you came, you saw, we conquered
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

So did you learn how delegating works now?

I hope I won't meet people like you in my professional life.
perry ellis
Greenhorn

Joined: May 30, 2006
Posts: 5
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
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

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 ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> Had circulated assignment in my team...
> The assignment was done in 1 hr

an hour? - must be a team of one
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37907
    
  22
. . . and did you take an hour to work out that no 7 is mathematically unsound?
perry ellis
Greenhorn

Joined: May 30, 2006
Posts: 5
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
Sheriff

Joined: Oct 13, 2005
Posts: 37907
    
  22
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

Joined: Feb 03, 2004
Posts: 456
@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

Joined: Sep 16, 2005
Posts: 1780
Stick to fashion, Perry.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37907
    
  22
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

Joined: Sep 16, 2005
Posts: 1780
... you say attribute, I say property ...
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

"perry,"

Please check your Private Messages. Thanks!
 
Don't get me started about those stupid light bulbs.
 
subject: Java Assignment
 
Similar Threads
help in solving recursive problems??
how can i solve it
help me to solve this assignments..
Online Java Editor/Compiler?
how to soloving this problem?