1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ICE Princess25 [194]
3 years ago
15

Design a class named largeIntegers such that an object of this class can store an integer of any number of digits. Add operation

s to add, subtract, multiply, and compare integers stored in two objects. Also add constructors to properly initialize objects and functions to set, retrieve, and print the values of objects. Write a program to test your class. g
Computers and Technology
1 answer:
SpyIntel [72]3 years ago
6 0

Answer:

Here the code is given as follows,

Explanation:

Code:

import java.util.Scanner;

//created class named largeintegers

class largeintegers{

   //class can hold a long number

   long number;

   //constructor to set number

  largeintegers(long number){

      this.number=number;

  }

  //getNumber method to get number

  long getNumber(){

      return number;

  }

  //below are some basic operations

  long addition(long num1,long num2){

       return num1+num2;

   }

   long subtract(long num1,long num2){

       return num1-num2;

   }

   long multiply(long num1,long num2){

       return num1*num2;

   }

   boolean compare(long num1,long num2)

   {

       return num1>num2;

   }

  public static void main(String[] args) {

      //declared to long numbers

      long number1,number2;

      //scanner class to take user input

      Scanner sc= new Scanner(System.in);

      //taking input numbers

      System.out.println("Enter a Number ");

      number1=sc.nextLong();

      System.out.println("Enter 2nd Number :");

      number2=sc.nextLong();

      //created two objects

      largeintegers object=new largeintegers(number1);

      largeintegers object2=new largeintegers(number2);

      //displaying two numbers

      System.out.println("Entered Numbers ");

      System.out.println(object.getNumber());

      System.out.println(object2.getNumber());

      //calling basic methods using created objects

      System.out.println("Some Operations on Given two Numbers ");

      System.out.println("Addition:"+object.addition(object.getNumber(), object2.getNumber()));

      System.out.println("Subtraction:"+object.subtract(object.getNumber(), object2.getNumber()));

      System.out.println("Multiplication:"+object.multiply(object.getNumber(), object2.getNumber()));

      System.out.println("Comparison:");

      if(object.compare(object.getNumber(), object2.getNumber())==true)

      {

          System.out.println("First Number is Greater than Second Number ");

      }

      else

      {

          System.out.println("Second Number is Greater than First Number ");

      }

      sc.close();

  }

}

Output:-

You might be interested in
When can you access the BIOS setup utility?
Burka [1]
During the boot process. You hold down a certain key (usually F2 or F8 (Function keys)), the beginning of the boot process checks for the keypress, and if it's detected, launches the utility.
6 0
3 years ago
Read 2 more answers
What is the relationship between a tcp and udp packet?
rusak2 [61]

They are both IP packets; both TCP and UDP use IP as their basis. TCP is used to create a channel with flow control, UDP just sends single packets that may get lost.

3 0
4 years ago
15
valina [46]

Answer:

B.

shutter priority mode

Explanation:

Shutter Priority, which is mentioned as S on the mode dial, and the mode is  the time value, and is demoted as Tv, that points out to the setting in different forms of cameras that allows all to select a particular shutter speed, and as meanwhile the camera balances the aperture to ensure correct exposure in the image.

7 0
4 years ago
Read 2 more answers
What type of file is MyFile.dll?
vampirchik [111]

Answer:

The answer to this question is given below in the explanation section

Explanation:

A DLL  (Dynamic Link Library ) file is a compiled library that contains a set of procedures and/or drivers that are referenced and executed by a Windows program. It allows multiple programs to access shared functions through common libraries. DLL file has .dll extension at the end of file name.

When a program is launched, links to the necessary .dll files are created. If a static link is created, the .dll files will be in use as long as the program is active. If a dynamic link is created, the .dll files will only be used when needed. Dynamic links help programs use resources, such as memory and hard drive space, more efficiently. These files can be used in more than one program and in multiple programs at the same time. Some .dll files come with windows operating system while others are added as a new program is installed on system.

7 0
3 years ago
Read 2 more answers
Using a Microsoft Windows system, open Internet Explorer. Click Internet Options on the Tools menu. Examine the contents of the
Novay_Z [31]

Answer:

You can restrict a user’s Internet Explorer web access by modifying the "Family" settings.

A) Content filtering tab in the Microsoft Windows Tab

From the left-hand navigation menu, select Settings > General > Advanced Features. Scroll down until you see the entry for Web content filtering. Switch the toggle to On and Save preferences.

B) to activate protection from unwanted items like cookies?

Open Internet Options | Privacy, click on the Advanced button. Place a check in "Override automatic cookie handling". Set "First Party Cookies" to Block, set "Third Party Cookies" to Block.

Cheers!

3 0
4 years ago
Other questions:
  • HELP ASAP!!!! PLEASE !!! What information does the Media Access Control (MAC) on a network card provide?
    9·2 answers
  • A(n) ____ network uses a central cable to which all network devices connect.
    13·1 answer
  • Rachel wants to post content from digital cameras on the web. Which online tool will help Rachel to post and edit content on a w
    5·1 answer
  • Explain 5 service provided by Internet​
    6·1 answer
  • Rafael needs to add a title row to a table that he has inserted in Word. What should he do? Use the alignment options. Use the M
    14·2 answers
  • Finish the code where it says //YOUR CODE HERE
    11·1 answer
  • PLEASE HELP FAST
    5·1 answer
  • PLEASE HURRY! Match terms in the first column with the order descriptions in column two.
    12·1 answer
  • When creating a storyboard, in which section do you mention how you move from one shot to the next?
    8·1 answer
  • How is unqualified assumptions a disadvantage of communication​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!