• 0
  • مالي خلق
  • أتهاوش
  • متضايق
  • مريض
  • مستانس
  • مستغرب
  • مشتط
  • أسولف
  • مغرم
  • معصب
  • منحرج
  • آكل
  • ابكي
  • ارقص
  • اصلي
  • استهبل
  • اضحك
  • اضحك  2
  • تعجبني
  • بضبطلك
  • رايق
  • زعلان
  • عبقري
  • نايم
  • طبيعي
  • كشخة
  • النتائج 1 إلى 2 من 2

    الموضوع: plaaaaaaa help in supid java

    1. #1
      التسجيل
      09-11-2002
      الدولة
      Canada
      المشاركات
      5
      المواضيع
      2
      شكر / اعجاب مشاركة

      Unhappy plaaaaaaa help in supid java

      hey can i get ur help guys plz i really need u
      i dunno how to use the hell java thing
      so i can i get ur help i have to make a calculator
      here u r my assignment
      ____________

      1.Create a class Calculator in VisualAge with the following members:

      Private Fields:
      int number1;
      int number2;

      Public methods:
      int add()
      int sub()
      int mul()
      float div()

      Constructor:
      Calculator( ) //default constructor
      Calculator(int x, int y)

      2. Implement the above methods and constructors. In the default constructor, set number1 and number2 to zero.

      3. Handle the ArithmeticException in div ( ) method


      4. Create a driver class to test the Calculator class.

      _______________________

      package Calculator;

      public class Calculator{

      private int num1, num2; //private field

      public Calculator(int x, int y) { //constructor
      this.num1=x; this.num2=y;
      }
      public int add(){
      return num1+num2;
      }

      public int sub(){
      return num1-num2;
      }

      public int mul(){
      return num1*num2;
      }

      public float div(){
      return num1/num2;
      /* if (num2==0) {
      System.out.println("Undefined");}*/ //if it is divied by 0 the result is undefined
      }

      }
      package Calculator;

      import java.io.*;
      import java.math.*;

      public class driver {


      public static void main(String[] args) {
      System.out.println("Enter the 1st #");
      String n1="";
      int num1=0;
      System.out.println("Enter the 2nd #");
      String n2="";
      int num2=0;


      try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      n1=br.readLine();
      }catch(IOException e){
      System.out.println("Input Error ");

      try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      n2=br.readLine();
      }catch(IOException e){
      System.out.println("Input Error ");
      }

      num1=Integer.parseInt(n1);
      Calculator Calc =new Calculator(num1); // Create an object.

      num2=Integer.parseInt(n2);
      Calculator Calc =new Calculator(num2); // Create an object.

      int a = Calc.add();
      int s = Calc.sub();
      int m = Calc.mul();
      float d = Calc.div();

      System.out.println("add \t" + a);
      System.out.println("sub \t" + s);
      System.out.println("mul \t" + m);
      System.out.println("div \t" + d);
      }

      }

    2. #2
      التسجيل
      24-04-2003
      الدولة
      i can be anywhere in : SAUDI ARABIA
      المشاركات
      104
      المواضيع
      10
      شكر / اعجاب مشاركة
      i'm taking java now, what is the problem with ur program ??

      the home work is EASY

      i think it is 102 ICS

      itroduction in java , right ??

      any way they will give a project soon if u want any help just ask;-)
      لشراء اي انميشن داخل او خارج السعوديه الرجاء عمل التالي :
      1- الاتصال على جوال : 055227054
      او
      2- ارسال رساله على الخاص

    ضوابط المشاركة

    • لا تستطيع إضافة مواضيع جديدة
    • لا تستطيع الرد على المواضيع
    • لا تستطيع إرفاق ملفات
    • لا تستطيع تعديل مشاركاتك
    •