Search the Community

Showing results for tags 'oop'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General Discussions
    • Announcements and Updates
    • Off-topic Lounge
    • Member Introductions
  • Campus Zone
    • Coding and Programming
    • Job Discussion
  • Information Technology
    • Tech News Updates
    • Internet of Things (IoT)
    • Machine Learning
    • Networking and Hardware
    • Trips and Tricks
  • Gamers Corner
    • Games Discussion
  • 2019 - 2nd Years's OOP
  • 2019 - 2nd Years's OSSA
  • 2019 - 2nd Years's CN
  • 2019 - 2nd Years's DMS
  • 2019 - 2nd Years's ITP
  • 2019 - 2nd Years's PS
  • 2019 - 2nd Years's ESD
  • 2019 - 2nd Years's P&S
  • 2019 - 2nd Years's DSA
  • 2019 - 2nd Years's MAD
  • 2019 - 2nd Years's General

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 2 results

  1. Nisuga Jayawardana

    OOP Mock Exam Paper & Answers

    Mock Exam.pdf OOP Mock Exam Answers.pdf
  2. Find the answer in below PDF. Any suggestion regarding the answer is strongly appreciated. OOP_11b(NumberCalculation)_ANSWER.pdf OOP_11b Number Calculation import java.util.InputMismatchException; import java.util.Scanner; public class Computation { private int number1; private int number2; private int result; public Computation(int number1, int number2) { super(); this.number1 = number1; this.number2 = number2; } public void read(){ try { Scanner sc = new Scanner(System.in); System.out.println("Enter Number 1: "); number1 = sc.nextInt(); if(number1 < 30 || number1 > 80) { throw new NumberNotIn30AND80Exception(); } System.out.println("Enter Number 2: "); number2 = sc.nextInt(); if(number2 < 30 || number2 > 80) { throw new NumberNotIn30AND80Exception(); } } catch (InputMismatchException e) { System.out.println("Please enter only Numbers!!"); read(); } catch (NumberNotIn30AND80Exception e) { System.out.println("Please Enter a number between 30 AND 80 !!!"); read(); } } public void Substract() { result = number1 - number2; } public void Divide() { try { result = number1 / number2; } catch ( ArithmeticException e ) { System.out.println("Nothing can be divided by 0 !!!"); } } public int getResult() { return result; } } public class NumberNotIn30AND80Exception extends Exception{ public NumberNotIn30AND80Exception() { super(); } } ------------------------------------------------------------------------------------------------------------------------------------------------ public class CalcApp { public static void main(String[] args) { Computation comp1 = new Computation(42, 32); comp1.read();//Inserting 65 and 35 comp1.Substract(); // Result = 30 Computation comp2 = new Computation(comp1.getResult(), 2); comp2.Divide();// Result = 15 System.out.println("Result is: "+ comp2.getResult() ); } }