Return to iWEBTOOL

Go Back   iWEBTOOL Talk > The Web and your Website > Programming > HTML > JavaScript
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
 
Welcome to iWEBTOOL Talk, where you talk about webmaster-related stuff.
 
Discuss topics which interest you.
With over thousands of threads (topics), we're sure you'll find something that'll interest you.
Ask for help whenever you need it.
We have thousands of members who are available to help you if you need it.
It's absolutely FREE!

 1  Register           2  Browse the board           3  Discuss whatever may interest you!
 


Closed Thread
 
Thread Tools Search this Thread Display Modes
Old 05-12-2007, 07:30 AM   #1
batman13
Newcomer
 
batman13's Avatar
 
Join Date: May 2007
Posts: 2
batman13 is on a distinguished road
Default have 2 little programs that im stuck on : (

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  
 
This is an Ad Revenue Sharing forum Place your advert here
SEO Checklist
Get yourself better ranking with
our "Do-it-Yourself" SEO Checklist.
Click Here
Old 05-12-2007, 07:51 AM   #2
jo_cstd
Member
 
jo_cstd's Avatar
 
Join Date: Mar 2007
Posts: 148
jo_cstd is on a distinguished road
Default Re: have 2 little programs that im stuck on : (

this part of the code is wrong.. the logic of your conditional statements is wrong.

Code:
if (number > number2 && number > number3) { System.out.println (number); } if (number2 > number3 && number2 > number ) { System.out.println (number2); } else System.out.println (number3); } }

and so is this..
you have to put the process you want repeated inside the do-while loop and there is no need for these lines (if(quit != "y")if(quit != "Y")if(quit != "n")if(quit != "N")).

Code:
do if(quit != "y") if(quit != "Y") if(quit != "n") if(quit != "N") System.out.println("try again"); while (!(quit == "y"));
jo_cstd is offline  
Old 05-12-2007, 06:41 PM   #3
batman13
Newcomer
 
batman13's Avatar
 
Join Date: May 2007
Posts: 2
batman13 is on a distinguished road
Default Re: have 2 little programs that im stuck on : (

thx for the reply.

so my logic is messed up then : ( what can i say, im no vulcan. what should the logic be then?
batman13 is offline  
 
This is an Ad Revenue Sharing forum Place your advert here
Webmaster Tools Webmaster Tools Click Here
Closed Thread

(Threads which have no activity for more than 30 days are automatically closed.)



Quick Reply
Message:

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
If you stuck in sandbox ,watch this ,will help you kijakarn General Talk 3 04-03-2007 03:30 PM
Affiliate Programs - I need some good advice. ev8321 Marketing and Promotion 19 02-09-2007 10:57 PM
*Majorly STUCK!* Professional NEEDED!!! lip9000 PHP 3 10-11-2006 04:29 PM
Suggested Cpc programs? MrAlan Marketing and Promotion 2 10-02-2006 05:00 AM
Paltalk Programs webmasterran Advertise your website 0 08-23-2006 04:06 PM


All times are GMT. The time now is 09:46 PM.


Powered by vBulletin v3.6.7 © 2008, Jelsoft Enterprises Ltd. SEO by vBSEO © 2006, Crawlability, Inc.