Declare a package name such as mypackage In the package body

Declare a package name, such as \"my_package\". In the package body, perform the following steps. Write a function to convert a \"bit_vector\" into an \"integer\". The function should receive an input of \"bit_vector\" type and return an output of \"integer\" type. It is also necessary to perform the reverse operation. Write a function that converts an input of \"integer\" type to an output of \"bit_vector\" type. Overload the \"+\" operation for the following types of additions: bit_vector + bit_vector = bit_vector bit_vector + integer = bit_vector

Solution

o create a package, you choose a name for the package (naming conventions are discussed in the next section) and put a package statement with that name at the top of every source filethat contains the types (classes, interfaces, enumerations, and annotation types) that you want to include in the package.

The package statement (for example, package graphics;) must be the first line in the source file. There can be only one package statement in each source file, and it applies to all types in the file.

Note: If you put multiple types in a single source file, only one can be public, and it must have the same name as the source file. For example, you can define public class Circle in the file Circle.java, define public interface Draggable in the file Draggable.java, define public enum Day in the file Day.java, and so forth.

You can include non-public types in the same file as a public type (this is strongly discouraged, unless the non-public type

 Declare a package name, such as \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site