Answer the
questions related to the following code:
Class
B
{
Public:
Void
b1();
Protected:
Void
b2();
};
Class
A : public B
{
Public:
Void a1();
Protected:
Void a2();
};
Class
C: public A
{
Public:
Void
c1();
};
Void main ()
{
B temp1; A temp2; C
temp3;
}
Name all member functions of all classes visible
through temp1 in the main function?
Name all member functions of all classes visible
through temp2 in the main function?
Name all...
public class SinglyLikedList {
private class Node{
public int item;
public Node next;
public Node(int item, Node next)
{
this.item =
item;
this.next =
next;
}
}
private Node first;
public void addFirst(int a) {
first = new Node(a, first);
}
}
1. Write the method add(int item, int position), which takes an
item and a position, and...
255.255.255.248 is a legal Class C
netmask
True
False
192.168.2.255 is a likely IP address for a
host
True
False
If we use 4 bits from the last octet for the network, we would
have 16 networks, with 16 hosts
each
True
False
[Show your work – no calculators of any sorts]
We have a subnetted network with netmask 255.255.255.128 - What
is the broadcast address for the first network? (Just the last
octet is fine.)
class A
{
public:
//constructors //
other members private:
int a;
int b;
};
Give declatations of operator functions for each of the
following ways to overload operator + You must state where the
declatation goes, whether within the class in the public or private
section or outside the class. The operator + may be overloaded. a)
as friend function b) as member function c) as non-friend,
non-member function
Class Employee (All IN JAVA)
public class Employee
{public String strName, strSalary;
public Employee(){strName = " ";strSalary = "$0";}
public Employee(String Name, String Salary){strName =
Name;strSalary = Salary;}
public void setName(String Name){strName = Name;}
public void setSalary(String Salary){strSalary = Salary;}public
String getName(){return strName;}
public String getSalary(){return strSalary;}
public String toString(){return(strName + " has a salary of " +
strSalary);
Create another method to return the name and salary
nicely formatted as a string (hint – research the toString
method).
You...
public class Mammal extends SeaCreature {
public void method1() {
System.out.println("warm-blooded");
}
}
public class SeaCreature {
public void method1() {
System.out.println("creature 1");
}
public void method2() {
System.out.println("creature 2");
}
public String toString() {
return "ocean-dwelling";
}
}
public class Whale extends Mammal {
public void method1() {
System.out.println("spout");
}
public String toString() {
return "BIG!";
}
}
public class Squid extends SeaCreature {
public void method2() {
System.out.println("tentacles");
}
public String toString() {
return "squid";
}
}
What...
public class MyLinked {
static class Node {
public Node (double item, Node
next) { this.item = item; this.next = next; }
public double item;
public Node next;
}
int N;
Node first;
// remove all occurrences of item from the
list
public void remove (double item) {
// TODO
}
Write the remove function. Do NOT add any fields to the
node/list classes, do...
JAVA
Implement a public class method named comparison on a public
class Compare that accepts two Object arguments.
It should return 0 if both references are equal.
1 if both objects are equal.
and -1 otherwise.
(SUPER IMPORTANT) Either reference can be null, so you'll need
to handle those cases carefully!
Here is what I have so far:
public class Compare {
public static int comparison(Object a, Object b) {
if (a == null || b == null) {
return...
public class StringNode {
private String item;
private StringNode next;
}
public class StringLL {
private StringNode head;
private int size;
public StringLL(){
head = null;
size = 0;
}
public void add(String s){
add(size,s);
}
public boolean add(int index, String s){
...
}
public String remove(int index){
...
}
}
In the above code add(int index, String s) creates a StringNode
and adds it to the linked list at position index, and remove(int
index) removes the StringNode at position...
how
to sorted the list from another class!!!
example i have a class
public meso
public meso(string id)
public hashmap<string, integer> neou{
this class print out
b
d
e
c
a
now create another class
public mesono
public mesono(hashmap<string, integer> nei)
//want to sorted meso class print list to this class!!
// print out
a
b
c
d
e
}
( -------Java------)