Welcome to Dream.In.Code
Getting Java Help is Easy!

Join 86,383 Java Programmers. There are 1,377 online right now! Ask your question and get quick answers from Dream.In.Code experts. Join the #1 programming help community on the internet! Registration is fast and FREE... Join Now!

Chat LIVE With a Java Expert
Powered by LivePerson.com

Register to Make This Box Go Away!

Ned help on explaining stuff

 
Reply to this topicStart new topic

Ned help on explaining stuff, On loop and convertions

kill99
post 6 May, 2008 - 05:56 AM
Post #1


New D.I.C Head

*
Joined: 3 May, 2008
Posts: 9



here my first qns

Write a ConsoleProgTwo that reads in a list of integers, one per line, until a sentinel
value of 0 (which you should be able to change easily to some other value). When the
sentinel is read, your program should display

i.the sum of all values
ii.the average of all values.
iii.the highest value read
iv.the lowest value read

Your program should handle the following special cases:

• If the user enters only one value before the sentinel, the program should report that value as both the largest and smallest.

• If the user enters the sentinel on the very first input line, then no values have been
entered, and your program should display a message to that effect.

i knw i ned to write a infinite loop that calculate the sum, average, highest and lowest and it will stop when i hit 0

i just need sample of infinite loop and someone that is good wif it can explain more to me


here the second qns


Produce a java applet called BullsEyeApplet that draws an image of an archery target


The outer circle should have a radius of one inch (72 pixels), the white circle has a radius of 0.65 inches, and the inner red circle has a radius of 0.3 inches. However, the inner circles should only appear when the mouse is clicked. i.e. every click draws an inner circle. Once all three circles have been drawn, the mouse click action should have no more effect.


how do i convert the 72 pixels, the radius and 0.65 and i knw that i ned the code mouselistener and mouseclick cause i don't quite understand so much other than the code mouse click and mouselistener
User is offlineProfile CardPM
Go to the top of the page
+Quote Post


rgfirefly24
post 6 May, 2008 - 08:09 AM
Post #2


D.I.C Head

Group Icon
Joined: 7 Apr, 2008
Posts: 135

QUOTE(kill99 @ 6 May, 2008 - 05:56 AM) *

here my first qns

Write a ConsoleProgTwo that reads in a list of integers, one per line, until a sentinel
value of 0 (which you should be able to change easily to some other value). When the
sentinel is read, your program should display

i.the sum of all values
ii.the average of all values.
iii.the highest value read
iv.the lowest value read

Your program should handle the following special cases:

• If the user enters only one value before the sentinel, the program should report that value as both the largest and smallest.

• If the user enters the sentinel on the very first input line, then no values have been
entered, and your program should display a message to that effect.

i knw i ned to write a infinite loop that calculate the sum, average, highest and lowest and it will stop when i hit 0

i just need sample of infinite loop and someone that is good wif it can explain more to me


here the second qns


Produce a java applet called BullsEyeApplet that draws an image of an archery target


The outer circle should have a radius of one inch (72 pixels), the white circle has a radius of 0.65 inches, and the inner red circle has a radius of 0.3 inches. However, the inner circles should only appear when the mouse is clicked. i.e. every click draws an inner circle. Once all three circles have been drawn, the mouse click action should have no more effect.


how do i convert the 72 pixels, the radius and 0.65 and i knw that i ned the code mouselistener and mouseclick cause i don't quite understand so much other than the code mouse click and mouselistener


my suggestion to you is to read up on the tutorials supplied in the sticky threads above.

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Please post like this:

Thank you for helping us helping you.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

kill99
post 9 May, 2008 - 07:41 AM
Post #3


New D.I.C Head

*
Joined: 3 May, 2008
Posts: 9

Write a ConsoleProgTwo that reads in a list of integers, one per line, until a sentinel
value of 0 (which you should be able to change easily to some other value).

i still don't understand this part

this my code for the first qns

CODE


class Test12
{
public static void main(String[] arguments)
{
    int[] num1 = {1};
    int[] num2 = {2};
    int[] total = new int[num1.length];
    int sum = 0;

    for (int i = 0; i < num1.length; i++)
    {
        total[i] = num1[i] + num2[i];
        System.out.print((i + 1993) + " production: " + total[i]);
        sum += total[i];
    
    }

System.out.println("Average production: " + (sum / num1.length));
System.out.println("The highest value read: " + (sum > num1.length));// hw come it display true ?? an1 can explain to me

// hw to do compare wif number to see which is higher ??
}

}

User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 5/17/08 03:49AM

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month