Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

.NET Forum


You are currently viewing our .NET Forum as a guest. Please register to participate.
Login



Reply
Old 05-12-2007, 04:23 AM im stuck : (
Junior Talker

Posts: 1
Trades: 0
i have 2 little programs that im stuck on.
the first, i need to out put all three numbers from highest to lowest but i can only get it to out put the one largest number and not the other two as well.

the other program im stuck on is trying to get "quit" to exit when equal to
"y" and loop back if not "y" "Y" "n" "N". it dosen't even have to loop really.
any help would be greatly appreciated

import cs1.Keyboard;
public class order
{
public static void main (String[] args)
{
int number, number2, number3;
System.out.println("Enter number 1");
number = cs1.Keyboard.readInt();
System.out.println("Enter number 2");
number2 = cs1.Keyboard.readInt();
System.out.println("Enter number 3");
number3 = cs1.Keyboard.readInt();
if (number > number2 && number > number3)
{
System.out.println (number);
}
if (number2 > number3 && number2 > number )
{
System.out.println (number2);
}
else

System.out.println (number3);
}
}



import cs1.Keyboard;
public class converter
{
public static void main (String[] args)
{
int option;
double Pound, Currency;
String quit;

do
{
System.out.println("Please enter GBP amount:");
Pound = cs1.Keyboard.readInt();
System.out.println("Please pick one of the four options:");

System.out.println("1 = Euro");
System.out.println("2 = USD ");
System.out.println("3 = AUD ");
System.out.println("0 = Quit");
option = Keyboard.readInt();

if (option == 1)
{
Currency = Pound * 1.48;
System.out.println("Answer =" +Currency);

System.out.println("Do you wish to quit the programme? ");
System.out.println("Y or N ");
quit = cs1.Keyboard.readString();

do
if(quit != "y")
if(quit != "Y")
if(quit != "n")
if(quit != "N")

System.out.println("try again");
while (!(quit == "y"));


System.out.println("You have quit the programme");


}

else if (option == 2)
{
Currency = Pound * 1.97;
System.out.println("Answer =" +Currency);
}
else if (option == 3)
{
Currency = Pound * 2.43;
System.out.println("Answer =" +Currency);
}
}
while (!(option == 0));
System.out.println("You have quit the programme");

}
}
batman13 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-14-2007, 02:40 AM Re: im stuck : (
jito's Avatar
MY LIFE IS 'i' LIFE

Posts: 565
Name: surajit ray
Location: inside the heart of my friends
Trades: 0
why don't you put the three number in an array and sort them?
__________________
I am not smart, that's why i don't act smart


Please login or register to view this content. Registration is FREE
jito is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to im stuck : (
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.22795 seconds with 12 queries