Reply
Please Help
Old 10-29-2002, 08:17 PM Please Help
Junior Talker

Posts: 1
ok.. i have to write this program that does and shows all the steps for long multiplication.. this is what i have for my program.. i just need someone to tell me if i'm completely wrong or ok...

/*
longMulti.java
Task: program to output the product of two integers in "long" multiplication format.
*/

import java.io.*;

public class longMulti {

public static void main (String[] args) throws Exception {
public long longValue () {
return left.num() * right.num();

BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in),1);


int num1;
int num2;
int sum1=0;
int sum2=0;

System.out.println("Enter a two-digit number.");
num1 = Integer.parseInt(keyboard.readLine());

System.out.println("Enter another two-digit number.");
num2 = Integer.parseInt(keyboard.readLine());

if (-100<num1<100 && -100<num2<100) do {
System.out.println(" " + num1);
System.out.println("x" + num2);
System.out.println("__________");
sum1=(right.num2 * right.num1) + (right.num2 * left.num1 * 10)
System.out.println(sum1);
sum2=(left.num2 * 10 * right.num1) + (left.num2 * 10 * left.num1 * 10)
System.out.println(sum2);
System.out.println("__________")
System.out.println(sum1 + sum2);
else System.out.println("Invalid Input");
}
}
}
}

thanks
muskn24 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Reply     « Reply to Please Help
 

Thread Tools

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
Refbacks are Off




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

 


Page generated in 0.11701 seconds with 12 queries