You are given a specification for some Java classes as follows.
A building has a number of floors, and a number of windows.
A house is a building.
A garage is a building.
A room has a length, width, a floor covering, and a number of closets.
You can never create an instance of a building, but every object that is a building must have a
method that calculates the floor space, i.e., the Building class is abstract, and has an abstract
method.
A house has a number of bathrooms, and an array of Rooms.
A house has a method that returns the average size of the Rooms.
A Garage can hold some number of cars, and it may have a cement floor or a gravel floor. A
garage has a length and a width. (Don’t use the Room class as a member of the Garage class.)
Object
/ \\
Building Room
/ \\
House Garage
2. Implement the specification.
You must use the following mechanisms correctly:
· Inheritance – is a
· Composition – has a
· Constructor methods
· Accessor / mutator methods = getters, setters
· Arrays of objects
· Passing arrays of objects to methods
· Abstract classes and methods
· Access modifiers – public private
o might not need protected, a you should never use
· toString() methods
· the super keyword
· method overriding
· interfaces
· generics are introduced
· polymorphism using inheritance, and interfaces
Include a test class that has a main method. This test program will make instances of your classes
and output the text representation of the objects using the toString() methods. There should be
enough comments in the output so that it is easy to see which classes are being tested.
In your test class, create an ArrayList. Add a couple of houses and garages to your list. Loop
through the list, using the enhanced for loop. Print out the objects using the toString methods.
(The toString methods should return a String object containing all of the instance variables’
values.)
Additional Requirements:
Only methods used for testing will call the System.out.println() method. The purpose of the
classes is to store and manipulate data. Input and output is not included in the data storage and
manipulation classes.
A house will calculate its floor space by looping through the array of rooms, and accumulating
the floor space. Don\'t worry about the space used by a closet, you can assume that it is included
in the size of the room.
Work incrementally. Start by making a Room class, and testing it. Then make the Building and
Garage classes, test them. The make the house class, and test it.
The constructor for the house class has an array of rooms as a parameter.
The building class is the only class that stores and manipulates the number of windows, and
number of floors.
All garage objects have exactly one floor. Perhaps the Building class should have an overloaded
constructor to accommodate this.
Interface
Add an interface to your package. Call the interface MLSListable. That means that a class that
implements this interface is a property that can be listed for sale. T.
Getting StartedCreate a class called Lab8. Use the same setup for .pdfinfo309708
Getting Started
Create a class called Lab8. Use the same setup for setting up your class and main method as you
did for the previous assignments. Be sure to name your file Lab8.java. Additionally, make
another file called Arrays.java. This file will be an object, so simply start it off by declaring an
Arrays class. You can copy the following skeleton and fill in the appropriate code below each of
the comments:
public class Arrays {
/ Instance Variables
// Constructors
// findMin 1
// findMax
// calcSum
// calcAverage
// toString
}
Task Overview
Your task for this lab is to create a class called Arrays with some array processing methods. This
class will maintain an array and the number of elements present in it. Additionally, methods will
be available to display the current min and max elements along with the average of all of them.
Finally, a toString() method will be available to cleanly display all the array elements. Finally,
you will write a simple driver class to test out the above Arrays class.
Part 1: Instance Variables for Arrays
The first thing to do for the Arrays class is to set up its instance variables. Declare the following
(private) instance variables:
• An int array called array ? this will be the array we will be writing methods for.
• An int called count - this represents the number of valid elements in the array.
Part 2:
Constructors for Arrays The Arrays class will have two constructors. The first constructor takes
the maximum size of the array as input as a parameter and initializes the array instance variable
appropriately. It also sets count to size. Finally, it will initialize all of the array elements to some
values between 0 and 10, inclusive. To create this constructor, follow these steps:
• Import java.util.Random to make use of the random number generator.
• Create a constructor with the following header: public Arrays(int size)
• Initialize your array variable and set its size to size (see the chart on page 252 for reference on
initializing arrays). Be very careful that you are setting the value of your array instance variable,
as opposed to creating a new variable called array.
• Set the value of the count variable to size because we will be populating the entire array.
• Copy the following code to the constructor in order to generate random values between 0 and
10, inclusive:
Random rand = new Random();
for (int i = 0; i < count; i++)
{
array[i] = (rand.nextInt(10));
}
Next, create another constructor with the following header: public Arrays(int[] arr). This
constructor will initialize the class by using the passed arr argument in order to fill its instance
variables. The following things need to be done inside of this constructor:
• Set the array variable equal to arr.
• Set the count variable equal to the length of the array.
Part 3: Displaying the Output findMin()
The first method of this class will search the array for the minimum element. Copy the following
code for the findMin method. Note how the count i.
Rooms and MoreCan you please help me the JAVA programLabInherit.pdfmumnesh
Rooms and More
Can you please help me the JAVA program?
LabInheritStarter.zip file:
import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;
public class Building {
public static void main(String[] args) {
Scanner kybd = new Scanner(System.in);
// declare an ArrayList containing Room elements
Random rand = new Random();
System.out.println(\"Enter \ \\t1: create classroom\ \\t2: create create elevator\" + \"\ \\t3:
exit\");
int inp = kybd.nextInt();
while (inp != 3) {
if (inp == 1) {
System.out.println(\"How many chairs? \");
int ch = kybd.nextInt();
Room current = new Classroom(rand.nextInt(1000) + 100, ch);
// add current to the ArrayList
} else if (inp == 2) {
Elevator current = new Elevator(rand.nextInt(100) + 10);
if (rand.nextInt(2) == 0) {
current.up(rand.nextInt(10));
} else {
current.down(rand.nextInt(10));
}
// add current to the ArrayList
}
System.out.println(\"Enter \ \\t1: create classroom\ \\t2: create create elevator\" + \"\ \\t3:
exit\");
inp = kybd.nextInt();
}
kybd.close();
// create a for loop to walk through the ArrayList its elements, one per line
}
}
=================================================
I already asked someone here, but he hasn\'t completed the program. You can take a look of his
code here.
import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;
public class Building {
public static void main(String[] args) {
Scanner kybd = new Scanner(System.in);
// declare an ArrayList containing Room elements
ArrayList arrayList = new ArrayList();
Random rand = new Random();
System.out.println(\"Enter \ \\t1: create classroom\ \\t2: create create elevator\" + \"\ \\t3: exit\");
int inp = kybd.nextInt();
while (inp != 3) {
if (inp == 1) {
System.out.println(\"How many chairs? \");
int ch = kybd.nextInt();
Room current = new Classroom(rand.nextInt(1000) + 100, ch);
arrayList.add(current);
} else if (inp == 2) {
Elevator current = new Elevator(rand.nextInt(100) + 10);
if (rand.nextInt(2) == 0) {
current.up(rand.nextInt(10));
} else {
current.down(rand.nextInt(10));
}
arrayList.add(current);
}
System.out.println(\"Enter \ \\t1: create classroom\ \\t2: create create elevator\" + \"\ \\t3: exit\");
inp = kybd.nextInt();
}
kybd.close();
// create a for loop to walk through the ArrayList its elements, one per line
for(int i=0;i System.out.println(arrayList.get(i));
}
}
}
class Room {
private int area;
Room(){}
Room(int area){
this.area = area;
}
public int getSquareFeet(){
return area;
}
public int getCapacity(){
return this.getSquareFeet()/9;
}
public String toString(){
return this.getSquareFeet() + \" \" + this.getCapacity();
}
}
class Classroom extends Room{
private int noOfChairs;
private int area;
Classroom(int area){
this.area = area;
}
Classroom(int area,int noOfChairs){
this.area = area;
this.noOfChairs = noOfChairs;
}
public int getChairs(){
return this.noOfChairs;
}
public void setChiars(int chairsNumber){
this.noOfChairs = chairsNumber;
}
public int getCapacity(){
return getC.
Exercise
1
[5
points]:
Create the following classes shown in the UML diagram. Then, create PointTest.java class with main method to test all functionality of these classes.
Exercise
2
[10
points]:
The following figure shows a UML diagram in which the class Student is inherited from the class
Person
a. Implement a Person class. The person constructor takes two strings: a first name and a last name. The constructor initializes the email address to the first letter of the first name followed by first five letters of the last name followed by @tru.ca. If the last name has fewer than five letters, the e-mail address will be the first letter of the first name followed by the entire last name followed by a @tru.ca. Examples:
Name
Email Address
Jane Smith
[email protected]
Musfiq Rahman
[email protected]
John Morris
[email protected]
Mary Key
[email protected]
b. Override Object’s toString method for the Person class. The toString method should return the present state of the object.
c. Now, create a Student class that is a subclass of Person and implements Comparable interface.
d. The Student constructor will be called with two String parameters, the first name and last name of the student. When the student is constructed, the inherited fields lastName, firstName, and email will be properly initialized, the student’s gpa and number of credit will be set to 0. The variable lastIdAssigend will be properly incremented each time a Student object is constructed and the studentId will be set to the next available ID number as tracked by the class variable lastIdAssigend.
e. Override the object’s toString method for the Student class. The toString method should return the present state of the object.
Note that it should use the toString() method from its superclass.
f. The addCourse() method should update the credits completed, calculate, and update the gpa value.
Use the following values for grade:
Example GPA calculation:
GRADE CREDIT CALCULATION
(A) 4.0 x 4 = 16.00
(B) 3.0 x 4 = 12.00
(B) 3.0 x 4 = 12.00
(A) 4.0 x 1 = 4.00
(C) 2.0 x 3 = 6.00
GPA = 50.00 / 16 = 3.125; the getGPA() method should return this value.
g. Students are compared to each other by comparing GPAs. Override the compareTo() method for the student class. Note that to override the compareTo() method, the Student class must implement Comparable interface.
Now, test your code with the supplied client code (StudentClient.java). Note: You should not modify this client code. We will use the same client code to test your classes.
Exercise
3
[10
points]:
In this exercise, you need to implement a class that encapsulate a Grid. A grid is a useful concept in creating board-game applications. Later we will use this class to create a board game. A grid is a two-dimensional matrix (see example below) with the same number of rows and columns. You can create a grid o ...
Dont change the templates, and just fill out the TODO parts on .pdfdbrienmhompsonkath75
Don\'t change the templates, and just fill out the // TODO parts on below of templates, please.
Instruction
Reimplement a program using List and ArrayList . Recall that it is a
little tricky to merge arrays of window orders when the arrays may have dierent
sizes. Using List to represent arrays of window orders is more convenient since
we can add a new window order if its size is not found in the existing orders.
To this end, we have added a new class called TotalOrder , which represents
a list of window orders. It contains methods to add a single window order or
another total order. These methods will ensure that the orders are propertly
merged by window sizes.
What to implement?
You will use in the methods for classes described above. The provided code
template has instruction in the comments above the methods that you will
implement.
Output
20 apartments with (Living room: 5 (6 X 8 window))(Master bedroom: 3 (4 X 6 window))
15 apartments with (Living room: 5 (6 X 8 window))(Master bedroom: 3 (4 X 6 window))
(Guest room: 2 (5 X 6 window))
10 apartments with (Living room: 5 (6 X 8 window))(Master bedroom: 3 (4 X 6 window))
(Guest room: 2 (5 X 6 window))(Guest room: 2 (5 X 6 window))
Window orders are:
225 6 X 8 window
135 4 X 6 window
70 5 X 6 window
Note
TotalOrder:
o add(WindowOrder newOrder): To add the “newOrder” at first check if a similar order is
already stored in the array list. You should check this within a loop structure. If it already exists
you should merge it with the similar window order using a method call to “add” (which is a
method declared in WindowOrder to merge the orders). Otherwise, simply add the “newOrder”
to the end of the array list through calling the “add” method of the array list. The method returns
the current object.
o add(TotalOrder that): this method makes use of the previous one. You should iterate over all of
the window orders listed in “that” and add them to the array list by passing each one of its
elements them as the input argument to the above “add” method.
o times(int num): for every element stored in the arraylist of the class, call “times” method and
pass “num” as the input argument to it.
o toString(): for every element stored in the arraylist, call its toString() method +”\ ”. Store the
result in a String variable and then return it.
- Apartment:
o orderForOneUnit(): create a new “TotalOrder” object. Add the window orders of every room
to the total order. Return the total order.
o totalOrder(): call the previous method to get the total order for one unit. Call the “times”
method of the total order and use number of apartments as input.
- Building:
o order(): declare and create a TotalOrder object. Add the total order of each apartment into the
object you just created and return it after the loop.
Templates
TotalOrder.java
import java.util.ArrayList;
import java.util.List;
// This class represents a collection of window orders using an ArrayList
public class TotalOrder {
List orders = new ArrayList.
Getting StartedCreate a class called Lab8. Use the same setup for .pdfinfo309708
Getting Started
Create a class called Lab8. Use the same setup for setting up your class and main method as you
did for the previous assignments. Be sure to name your file Lab8.java. Additionally, make
another file called Arrays.java. This file will be an object, so simply start it off by declaring an
Arrays class. You can copy the following skeleton and fill in the appropriate code below each of
the comments:
public class Arrays {
/ Instance Variables
// Constructors
// findMin 1
// findMax
// calcSum
// calcAverage
// toString
}
Task Overview
Your task for this lab is to create a class called Arrays with some array processing methods. This
class will maintain an array and the number of elements present in it. Additionally, methods will
be available to display the current min and max elements along with the average of all of them.
Finally, a toString() method will be available to cleanly display all the array elements. Finally,
you will write a simple driver class to test out the above Arrays class.
Part 1: Instance Variables for Arrays
The first thing to do for the Arrays class is to set up its instance variables. Declare the following
(private) instance variables:
• An int array called array ? this will be the array we will be writing methods for.
• An int called count - this represents the number of valid elements in the array.
Part 2:
Constructors for Arrays The Arrays class will have two constructors. The first constructor takes
the maximum size of the array as input as a parameter and initializes the array instance variable
appropriately. It also sets count to size. Finally, it will initialize all of the array elements to some
values between 0 and 10, inclusive. To create this constructor, follow these steps:
• Import java.util.Random to make use of the random number generator.
• Create a constructor with the following header: public Arrays(int size)
• Initialize your array variable and set its size to size (see the chart on page 252 for reference on
initializing arrays). Be very careful that you are setting the value of your array instance variable,
as opposed to creating a new variable called array.
• Set the value of the count variable to size because we will be populating the entire array.
• Copy the following code to the constructor in order to generate random values between 0 and
10, inclusive:
Random rand = new Random();
for (int i = 0; i < count; i++)
{
array[i] = (rand.nextInt(10));
}
Next, create another constructor with the following header: public Arrays(int[] arr). This
constructor will initialize the class by using the passed arr argument in order to fill its instance
variables. The following things need to be done inside of this constructor:
• Set the array variable equal to arr.
• Set the count variable equal to the length of the array.
Part 3: Displaying the Output findMin()
The first method of this class will search the array for the minimum element. Copy the following
code for the findMin method. Note how the count i.
Rooms and MoreCan you please help me the JAVA programLabInherit.pdfmumnesh
Rooms and More
Can you please help me the JAVA program?
LabInheritStarter.zip file:
import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;
public class Building {
public static void main(String[] args) {
Scanner kybd = new Scanner(System.in);
// declare an ArrayList containing Room elements
Random rand = new Random();
System.out.println(\"Enter \ \\t1: create classroom\ \\t2: create create elevator\" + \"\ \\t3:
exit\");
int inp = kybd.nextInt();
while (inp != 3) {
if (inp == 1) {
System.out.println(\"How many chairs? \");
int ch = kybd.nextInt();
Room current = new Classroom(rand.nextInt(1000) + 100, ch);
// add current to the ArrayList
} else if (inp == 2) {
Elevator current = new Elevator(rand.nextInt(100) + 10);
if (rand.nextInt(2) == 0) {
current.up(rand.nextInt(10));
} else {
current.down(rand.nextInt(10));
}
// add current to the ArrayList
}
System.out.println(\"Enter \ \\t1: create classroom\ \\t2: create create elevator\" + \"\ \\t3:
exit\");
inp = kybd.nextInt();
}
kybd.close();
// create a for loop to walk through the ArrayList its elements, one per line
}
}
=================================================
I already asked someone here, but he hasn\'t completed the program. You can take a look of his
code here.
import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;
public class Building {
public static void main(String[] args) {
Scanner kybd = new Scanner(System.in);
// declare an ArrayList containing Room elements
ArrayList arrayList = new ArrayList();
Random rand = new Random();
System.out.println(\"Enter \ \\t1: create classroom\ \\t2: create create elevator\" + \"\ \\t3: exit\");
int inp = kybd.nextInt();
while (inp != 3) {
if (inp == 1) {
System.out.println(\"How many chairs? \");
int ch = kybd.nextInt();
Room current = new Classroom(rand.nextInt(1000) + 100, ch);
arrayList.add(current);
} else if (inp == 2) {
Elevator current = new Elevator(rand.nextInt(100) + 10);
if (rand.nextInt(2) == 0) {
current.up(rand.nextInt(10));
} else {
current.down(rand.nextInt(10));
}
arrayList.add(current);
}
System.out.println(\"Enter \ \\t1: create classroom\ \\t2: create create elevator\" + \"\ \\t3: exit\");
inp = kybd.nextInt();
}
kybd.close();
// create a for loop to walk through the ArrayList its elements, one per line
for(int i=0;i System.out.println(arrayList.get(i));
}
}
}
class Room {
private int area;
Room(){}
Room(int area){
this.area = area;
}
public int getSquareFeet(){
return area;
}
public int getCapacity(){
return this.getSquareFeet()/9;
}
public String toString(){
return this.getSquareFeet() + \" \" + this.getCapacity();
}
}
class Classroom extends Room{
private int noOfChairs;
private int area;
Classroom(int area){
this.area = area;
}
Classroom(int area,int noOfChairs){
this.area = area;
this.noOfChairs = noOfChairs;
}
public int getChairs(){
return this.noOfChairs;
}
public void setChiars(int chairsNumber){
this.noOfChairs = chairsNumber;
}
public int getCapacity(){
return getC.
Exercise
1
[5
points]:
Create the following classes shown in the UML diagram. Then, create PointTest.java class with main method to test all functionality of these classes.
Exercise
2
[10
points]:
The following figure shows a UML diagram in which the class Student is inherited from the class
Person
a. Implement a Person class. The person constructor takes two strings: a first name and a last name. The constructor initializes the email address to the first letter of the first name followed by first five letters of the last name followed by @tru.ca. If the last name has fewer than five letters, the e-mail address will be the first letter of the first name followed by the entire last name followed by a @tru.ca. Examples:
Name
Email Address
Jane Smith
[email protected]
Musfiq Rahman
[email protected]
John Morris
[email protected]
Mary Key
[email protected]
b. Override Object’s toString method for the Person class. The toString method should return the present state of the object.
c. Now, create a Student class that is a subclass of Person and implements Comparable interface.
d. The Student constructor will be called with two String parameters, the first name and last name of the student. When the student is constructed, the inherited fields lastName, firstName, and email will be properly initialized, the student’s gpa and number of credit will be set to 0. The variable lastIdAssigend will be properly incremented each time a Student object is constructed and the studentId will be set to the next available ID number as tracked by the class variable lastIdAssigend.
e. Override the object’s toString method for the Student class. The toString method should return the present state of the object.
Note that it should use the toString() method from its superclass.
f. The addCourse() method should update the credits completed, calculate, and update the gpa value.
Use the following values for grade:
Example GPA calculation:
GRADE CREDIT CALCULATION
(A) 4.0 x 4 = 16.00
(B) 3.0 x 4 = 12.00
(B) 3.0 x 4 = 12.00
(A) 4.0 x 1 = 4.00
(C) 2.0 x 3 = 6.00
GPA = 50.00 / 16 = 3.125; the getGPA() method should return this value.
g. Students are compared to each other by comparing GPAs. Override the compareTo() method for the student class. Note that to override the compareTo() method, the Student class must implement Comparable interface.
Now, test your code with the supplied client code (StudentClient.java). Note: You should not modify this client code. We will use the same client code to test your classes.
Exercise
3
[10
points]:
In this exercise, you need to implement a class that encapsulate a Grid. A grid is a useful concept in creating board-game applications. Later we will use this class to create a board game. A grid is a two-dimensional matrix (see example below) with the same number of rows and columns. You can create a grid o ...
Dont change the templates, and just fill out the TODO parts on .pdfdbrienmhompsonkath75
Don\'t change the templates, and just fill out the // TODO parts on below of templates, please.
Instruction
Reimplement a program using List and ArrayList . Recall that it is a
little tricky to merge arrays of window orders when the arrays may have dierent
sizes. Using List to represent arrays of window orders is more convenient since
we can add a new window order if its size is not found in the existing orders.
To this end, we have added a new class called TotalOrder , which represents
a list of window orders. It contains methods to add a single window order or
another total order. These methods will ensure that the orders are propertly
merged by window sizes.
What to implement?
You will use in the methods for classes described above. The provided code
template has instruction in the comments above the methods that you will
implement.
Output
20 apartments with (Living room: 5 (6 X 8 window))(Master bedroom: 3 (4 X 6 window))
15 apartments with (Living room: 5 (6 X 8 window))(Master bedroom: 3 (4 X 6 window))
(Guest room: 2 (5 X 6 window))
10 apartments with (Living room: 5 (6 X 8 window))(Master bedroom: 3 (4 X 6 window))
(Guest room: 2 (5 X 6 window))(Guest room: 2 (5 X 6 window))
Window orders are:
225 6 X 8 window
135 4 X 6 window
70 5 X 6 window
Note
TotalOrder:
o add(WindowOrder newOrder): To add the “newOrder” at first check if a similar order is
already stored in the array list. You should check this within a loop structure. If it already exists
you should merge it with the similar window order using a method call to “add” (which is a
method declared in WindowOrder to merge the orders). Otherwise, simply add the “newOrder”
to the end of the array list through calling the “add” method of the array list. The method returns
the current object.
o add(TotalOrder that): this method makes use of the previous one. You should iterate over all of
the window orders listed in “that” and add them to the array list by passing each one of its
elements them as the input argument to the above “add” method.
o times(int num): for every element stored in the arraylist of the class, call “times” method and
pass “num” as the input argument to it.
o toString(): for every element stored in the arraylist, call its toString() method +”\ ”. Store the
result in a String variable and then return it.
- Apartment:
o orderForOneUnit(): create a new “TotalOrder” object. Add the window orders of every room
to the total order. Return the total order.
o totalOrder(): call the previous method to get the total order for one unit. Call the “times”
method of the total order and use number of apartments as input.
- Building:
o order(): declare and create a TotalOrder object. Add the total order of each apartment into the
object you just created and return it after the loop.
Templates
TotalOrder.java
import java.util.ArrayList;
import java.util.List;
// This class represents a collection of window orders using an ArrayList
public class TotalOrder {
List orders = new ArrayList.
Should be in JavaInterface Worker should extend Serializable from .pdffashionscollect
Should be in Java
Interface Worker should extend Serializable from java.io.*
In addition to shown data fields, each Worker object should have a name field, a workerID field,
and a Department field.The classes and/or interfaces where these fields belong are not indicated,
so you need to decide where they best belong in order to reduce code redundancy as much as
possible; it may not be possible to put them in only one place.
Write get and set methods for every data field. You may use the automatic generator of your
IDE, but all data should be validated. I should not be able to set invalid data such a negative
hours. The program should not terminate when receiving bad data but should recover, whether
input is coming from a file or interactively.
All appropriate classes must override the equals method so that it compares workers by
workerID; two workers should be considered equal if they have the same workerID, even if they
are not the same kind of Worker; when comparing a WorkerObject to an object of another type,
the equals method should return false.
Class HourlyWorker should be an abstract class because it contains an abstract toString method
that will be implemented in the subclasses; in the subclasses, it should return the type of subclass
along with all data field values in a user-friendly understandable format.
Data field hours in the HourlyWorker class represents the number of hours worked so far during
the current month
Decide if any of the methods requires a precondition; if so, they should throw an appropriate
exception when the precondition is not met
Supply appropriate constructors for all concrete and abstract classes. Each should have a no-arg
constructor and a fully qualified constructor.
Create an application class named WorkerTest to demonstrate the hierarchy.
The application should create Volunteer, HourlyEmployee, and SalariedEmployee objects with
initial field values specified interactively. Invalid data should produce a message and a re-
prompt.
The application should then create a series of objects by reading initial field values from a file.
The file format is up to you. The input should test both the no-arg constructors and the fully
qualified constructors. If the file contains invalid data, the program send a message to err.out,
ignore the invalid data and proceed to the next valid data. The file input data should test all
caught exceptions. I should not be able to crash your program, regardless of the input data I
provide.
Check each object against abstract class HourlyWorker and each interface by using the
instanceof operator. Output results indicating whether each object is or is not of the checked
type.
Create an ArrayList containing the objects and polymorphically traverse the array, writing the
output of each objects\' toString() method to a file.
I know I need to do a department class and also an employee class.
Here is the code i have so far.
public abstract class Worker
{
private final String lastName;
private .
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdfaromanets
Creat Shape classes from scratch DETAILS You will create 3 shape classes (Circle, Rectangle,
Triangle) that all inherit from a single abstract class called AbstractShape which implements
Shape (also created by you). You are also responsible for creating the driver class
\"Assignment7.java\" (program that tests your classes and described on page 3) which does the
following reads input data from a file instantiates various objects of the three shapes based on the
input data stores each in a LinkedList outputs this list to an output file sorts a \"copy\" of this
LinkedList of objects outputs the sorted version of the list to the output file outputs the original
list to the output file This driver program also needs to \"ignore errors in the input file that breach
the specified input format as described in the Assianment7,java details (see page 3 1. Shape.java
This is an interface that has 2 abstract methods, and passes the responsibility of implementing the
compareTo method to the class that implements Shape (you may note, nomally Comparable is
\"implemented\" by a class. However, an interface cannot implement because interfaces can only
contain abstract methods. That said, an interface can only extend other interfaces and the
responsibility of actually \"implementing\" the abstract method(s) of the super class interface is
passed on to the sub-classes) public interface Shape extends Comparable public double
calculateAreal) Il This abstract method is implemented at the concrete level public Shape
copyShape); Il also implemented at the concrete level 2. AbstractShape.java public abstract class
AbstractShape implements Shape This class should contain an instance field to store the name of
each obiect. The constructor which sets this field should receive the name and a number to be
concatenated to the name and then stored in the name field Recall, when the super class has a
parameterized constructor, the sub-classes will need to call it AND the sub- classes will need to
also provide a constructor without parameters This abstract class will implement the compareTo
method passed on from the Shape interface and will pass on the responsibility of implementing
calculateArea to the extending sub-classes (compare To will use the calculateArea method when
comparing 2 Shape objects). Along with compare To, one more concrete method should be
included. The following will be used by the sub-classes\' toString method: public String
getName) II Simply returns the name field data
Solution
in7.txt
4.4
2.5 3
8.1 3.0 5.0
2.5 3 4
2.5
tuesday
-7
1.0
3 three
3 -9
3 5
1.0
Assignment7.java
import java.io.*;
import java.util.*;
public class Assignment7 {
/**
* This is the test driver class that will include main.
* This program MUST read a file named in7.txt and
* generate an output file named out7.txt. The in7.txt
* file must be created by you based on formatting
* described shortly.
*
* @param theArgs
*/
public static void main(String[] theArgs) {
List myList = new Arra.
Suggestion- Use Netbeans to copy your last lab (Lab 07) to a new proje.pdfssuser58be4b1
Suggestion:
Use Netbeans to copy your last lab (Lab 07) to a new project called Lab08.
Close Lab07.
Work on the new Lab08 project then.
The Student class
A Student is a Person with 3 extra attributes, major, academic year and gpa.
Attributes
String major
String academicYear
double GPA
Constructorsone constructor with no input parameterssince it doesn't have input parameters, use
the default data below
major - IST
academicYear - Sr.
GPA - 3.0
remember to call the constructor of the superclass with no parameters
one constructor with all the parameters
all three parameters from Student, one for each attribute
since this is a subclass, remember to include also the parameters for the superclass
Methods
Get and Set methods (a requirement from encapsulation)
public String toString()
returns this object as a String, i.e., make each attribute a String, concatenate all strings and return
as one String.
toString() is a special method, you will learn more about it in the next lessons
it needs to be public
it needs to have @override notation (on the line above the method itself). Netbeans will suggest
you do it.
important : in the subclass toString, remember to make a call to the superclass toString so that
the resulting String includes
data from the subclass Student
data from the superclass Person
The Person Class
Attributes
String firstName
String lastName
String hometown
String state
Height height
Constructorsone constructor with no input parameterssince it doesn't receive any input values,
you need to use the default values below:
firstName - No
lastName - Name
hometown - N/A
state - N/A
height - use the Height class no parameter constructor
one constructor with three parameters
firstName using the input parameter
lastName using the input parameter
height using the input parameter
use the default values for
hometown - N/A
state - N/A
one constructor with all (five) parameters
one input parameter for each attribute
Methods
Get and Set methods (a requirement from encapsulation)
important:
You should start generating the default get and set methods using NetBeans automatic generator
Then you will change getFirstName and setLastName as specified. getFirstName
returns firstName with the first letter in upper case and the remaining of the String in lower case
getLastName
getHometown
getState
getHeight
setFirstName
setLastName
updates lastName to be all caps (all upper case)
remember to use setLastName in all constructors so the data (the updated lastName) is stored
correctly
setHometown
setState
setHeight
public String toString()
returns this object as a String, i.e., make each attribute a String, concatenate all strings and return
as one String.
toString() is a special method, you will learn more about it in the next lessons
it needs to be public
it needs to have @override notation (on the line above the method itself). Netbeans will suggest
you do it.
regarding state , the toString method will have a similar functionality as App had in the first lab.
if t.
How does law enforcement, courts and corrections work to complemen.pdfeyebolloptics
How does law enforcement, courts and corrections work to complement each other ? What
would happen if one branch of the system were Brocken?
How does law enforcement, courts and corrections work to complement each other ? What
would happen if one branch of the system were Brocken?
Solution
There are three branches of justice system
Let us talk about these.
Law Enforcement- It includes the first investigation done by police. The police investigate first
and arrest to the suspects. Then after they approach court for further procedures. Here police
force cannot punish the suspect as per their understandings. They have to maintain the peace and
harmony in the country.
Courts- Now when the matter has moved to court now court will ask for clues and proofs and
witness for the matter. After analyzing the witness, proofs and other things the court defines the
guilty and punish as per the crime.
3. Corrections:- Now when the court has given it’s judgment, next step is followed by the
correctness. It means the guilty will be enforced. This may includes jail, probation, fine, etc,
Earlier there was capital punishment for brutal cases but now a days it is closed in some
countries because of human rights organizations.
The benefit of this is this removes the criminal from the society and society is safe from those
criminals. Other people have fear about the punishment so they stop the wrong doings.
So I have described you how the procedures are connected with each other. If one branch is
broken whole the system will be failed. If law enforcement is failed the suspects will not under
arrest and further procedures will not take place. If there is no court then there will be no
punishment. All the punishment will be given by police so there may be injustice in the society.
And if correction is failed then the guilty will remain in society and society will have probability
of occurrence of crime again..
Check all that apply to different sets of genes that are homologous..pdfeyebolloptics
Check all that apply to different sets of genes that are homologous.
A.have similar biochemical activities (ex. bind to DNA, synthesize polypeptides)
B.exist in the same species
C. exist in the same individual
D.have different cellular functions (ex. cell division, transport to membranes)
E.have different biochemical activities (ex. bind to DNA, synthesize polypeptides)
F. have similar cellular functions (ex. cell division, transport to membranes)
G. exist in different species
******I have already tried: similar biochemical activities, have similar cell function, and exist in
different species I got half credit for this so i must be missing something.
Solution
Answer
Homologous chromosomes are chromosome pairs, one from each parent that is similar in length,
gene position and centromere location. The position of genes on each homologous chromosome
is the same, however the genes may contain different alleles.
A. have similar biochemical activities.
B. exist in same species.
F. have similar cellular functions like cell division and transport to membranes.
G. Homologous chromosomes may exist in different species. For example, drosophila genes are
homologous with genes of human beings.
So the answer would be A, B, F, and G..
More Related Content
Similar to You are given a specification for some Java classes as follows. A.pdf
Should be in JavaInterface Worker should extend Serializable from .pdffashionscollect
Should be in Java
Interface Worker should extend Serializable from java.io.*
In addition to shown data fields, each Worker object should have a name field, a workerID field,
and a Department field.The classes and/or interfaces where these fields belong are not indicated,
so you need to decide where they best belong in order to reduce code redundancy as much as
possible; it may not be possible to put them in only one place.
Write get and set methods for every data field. You may use the automatic generator of your
IDE, but all data should be validated. I should not be able to set invalid data such a negative
hours. The program should not terminate when receiving bad data but should recover, whether
input is coming from a file or interactively.
All appropriate classes must override the equals method so that it compares workers by
workerID; two workers should be considered equal if they have the same workerID, even if they
are not the same kind of Worker; when comparing a WorkerObject to an object of another type,
the equals method should return false.
Class HourlyWorker should be an abstract class because it contains an abstract toString method
that will be implemented in the subclasses; in the subclasses, it should return the type of subclass
along with all data field values in a user-friendly understandable format.
Data field hours in the HourlyWorker class represents the number of hours worked so far during
the current month
Decide if any of the methods requires a precondition; if so, they should throw an appropriate
exception when the precondition is not met
Supply appropriate constructors for all concrete and abstract classes. Each should have a no-arg
constructor and a fully qualified constructor.
Create an application class named WorkerTest to demonstrate the hierarchy.
The application should create Volunteer, HourlyEmployee, and SalariedEmployee objects with
initial field values specified interactively. Invalid data should produce a message and a re-
prompt.
The application should then create a series of objects by reading initial field values from a file.
The file format is up to you. The input should test both the no-arg constructors and the fully
qualified constructors. If the file contains invalid data, the program send a message to err.out,
ignore the invalid data and proceed to the next valid data. The file input data should test all
caught exceptions. I should not be able to crash your program, regardless of the input data I
provide.
Check each object against abstract class HourlyWorker and each interface by using the
instanceof operator. Output results indicating whether each object is or is not of the checked
type.
Create an ArrayList containing the objects and polymorphically traverse the array, writing the
output of each objects\' toString() method to a file.
I know I need to do a department class and also an employee class.
Here is the code i have so far.
public abstract class Worker
{
private final String lastName;
private .
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdfaromanets
Creat Shape classes from scratch DETAILS You will create 3 shape classes (Circle, Rectangle,
Triangle) that all inherit from a single abstract class called AbstractShape which implements
Shape (also created by you). You are also responsible for creating the driver class
\"Assignment7.java\" (program that tests your classes and described on page 3) which does the
following reads input data from a file instantiates various objects of the three shapes based on the
input data stores each in a LinkedList outputs this list to an output file sorts a \"copy\" of this
LinkedList of objects outputs the sorted version of the list to the output file outputs the original
list to the output file This driver program also needs to \"ignore errors in the input file that breach
the specified input format as described in the Assianment7,java details (see page 3 1. Shape.java
This is an interface that has 2 abstract methods, and passes the responsibility of implementing the
compareTo method to the class that implements Shape (you may note, nomally Comparable is
\"implemented\" by a class. However, an interface cannot implement because interfaces can only
contain abstract methods. That said, an interface can only extend other interfaces and the
responsibility of actually \"implementing\" the abstract method(s) of the super class interface is
passed on to the sub-classes) public interface Shape extends Comparable public double
calculateAreal) Il This abstract method is implemented at the concrete level public Shape
copyShape); Il also implemented at the concrete level 2. AbstractShape.java public abstract class
AbstractShape implements Shape This class should contain an instance field to store the name of
each obiect. The constructor which sets this field should receive the name and a number to be
concatenated to the name and then stored in the name field Recall, when the super class has a
parameterized constructor, the sub-classes will need to call it AND the sub- classes will need to
also provide a constructor without parameters This abstract class will implement the compareTo
method passed on from the Shape interface and will pass on the responsibility of implementing
calculateArea to the extending sub-classes (compare To will use the calculateArea method when
comparing 2 Shape objects). Along with compare To, one more concrete method should be
included. The following will be used by the sub-classes\' toString method: public String
getName) II Simply returns the name field data
Solution
in7.txt
4.4
2.5 3
8.1 3.0 5.0
2.5 3 4
2.5
tuesday
-7
1.0
3 three
3 -9
3 5
1.0
Assignment7.java
import java.io.*;
import java.util.*;
public class Assignment7 {
/**
* This is the test driver class that will include main.
* This program MUST read a file named in7.txt and
* generate an output file named out7.txt. The in7.txt
* file must be created by you based on formatting
* described shortly.
*
* @param theArgs
*/
public static void main(String[] theArgs) {
List myList = new Arra.
Suggestion- Use Netbeans to copy your last lab (Lab 07) to a new proje.pdfssuser58be4b1
Suggestion:
Use Netbeans to copy your last lab (Lab 07) to a new project called Lab08.
Close Lab07.
Work on the new Lab08 project then.
The Student class
A Student is a Person with 3 extra attributes, major, academic year and gpa.
Attributes
String major
String academicYear
double GPA
Constructorsone constructor with no input parameterssince it doesn't have input parameters, use
the default data below
major - IST
academicYear - Sr.
GPA - 3.0
remember to call the constructor of the superclass with no parameters
one constructor with all the parameters
all three parameters from Student, one for each attribute
since this is a subclass, remember to include also the parameters for the superclass
Methods
Get and Set methods (a requirement from encapsulation)
public String toString()
returns this object as a String, i.e., make each attribute a String, concatenate all strings and return
as one String.
toString() is a special method, you will learn more about it in the next lessons
it needs to be public
it needs to have @override notation (on the line above the method itself). Netbeans will suggest
you do it.
important : in the subclass toString, remember to make a call to the superclass toString so that
the resulting String includes
data from the subclass Student
data from the superclass Person
The Person Class
Attributes
String firstName
String lastName
String hometown
String state
Height height
Constructorsone constructor with no input parameterssince it doesn't receive any input values,
you need to use the default values below:
firstName - No
lastName - Name
hometown - N/A
state - N/A
height - use the Height class no parameter constructor
one constructor with three parameters
firstName using the input parameter
lastName using the input parameter
height using the input parameter
use the default values for
hometown - N/A
state - N/A
one constructor with all (five) parameters
one input parameter for each attribute
Methods
Get and Set methods (a requirement from encapsulation)
important:
You should start generating the default get and set methods using NetBeans automatic generator
Then you will change getFirstName and setLastName as specified. getFirstName
returns firstName with the first letter in upper case and the remaining of the String in lower case
getLastName
getHometown
getState
getHeight
setFirstName
setLastName
updates lastName to be all caps (all upper case)
remember to use setLastName in all constructors so the data (the updated lastName) is stored
correctly
setHometown
setState
setHeight
public String toString()
returns this object as a String, i.e., make each attribute a String, concatenate all strings and return
as one String.
toString() is a special method, you will learn more about it in the next lessons
it needs to be public
it needs to have @override notation (on the line above the method itself). Netbeans will suggest
you do it.
regarding state , the toString method will have a similar functionality as App had in the first lab.
if t.
How does law enforcement, courts and corrections work to complemen.pdfeyebolloptics
How does law enforcement, courts and corrections work to complement each other ? What
would happen if one branch of the system were Brocken?
How does law enforcement, courts and corrections work to complement each other ? What
would happen if one branch of the system were Brocken?
Solution
There are three branches of justice system
Let us talk about these.
Law Enforcement- It includes the first investigation done by police. The police investigate first
and arrest to the suspects. Then after they approach court for further procedures. Here police
force cannot punish the suspect as per their understandings. They have to maintain the peace and
harmony in the country.
Courts- Now when the matter has moved to court now court will ask for clues and proofs and
witness for the matter. After analyzing the witness, proofs and other things the court defines the
guilty and punish as per the crime.
3. Corrections:- Now when the court has given it’s judgment, next step is followed by the
correctness. It means the guilty will be enforced. This may includes jail, probation, fine, etc,
Earlier there was capital punishment for brutal cases but now a days it is closed in some
countries because of human rights organizations.
The benefit of this is this removes the criminal from the society and society is safe from those
criminals. Other people have fear about the punishment so they stop the wrong doings.
So I have described you how the procedures are connected with each other. If one branch is
broken whole the system will be failed. If law enforcement is failed the suspects will not under
arrest and further procedures will not take place. If there is no court then there will be no
punishment. All the punishment will be given by police so there may be injustice in the society.
And if correction is failed then the guilty will remain in society and society will have probability
of occurrence of crime again..
Check all that apply to different sets of genes that are homologous..pdfeyebolloptics
Check all that apply to different sets of genes that are homologous.
A.have similar biochemical activities (ex. bind to DNA, synthesize polypeptides)
B.exist in the same species
C. exist in the same individual
D.have different cellular functions (ex. cell division, transport to membranes)
E.have different biochemical activities (ex. bind to DNA, synthesize polypeptides)
F. have similar cellular functions (ex. cell division, transport to membranes)
G. exist in different species
******I have already tried: similar biochemical activities, have similar cell function, and exist in
different species I got half credit for this so i must be missing something.
Solution
Answer
Homologous chromosomes are chromosome pairs, one from each parent that is similar in length,
gene position and centromere location. The position of genes on each homologous chromosome
is the same, however the genes may contain different alleles.
A. have similar biochemical activities.
B. exist in same species.
F. have similar cellular functions like cell division and transport to membranes.
G. Homologous chromosomes may exist in different species. For example, drosophila genes are
homologous with genes of human beings.
So the answer would be A, B, F, and G..
For the following matrices, determine a cot of basis vectors for the.pdfeyebolloptics
For the following matrices, determine a cot of basis vectors for the null spaces the column
spaces. A = [3 2 -1 5] A = [2 1 -3 4 0 2 0 -2 8] Let P_n denote the set of all polynomial
functions of degree at most n Let a_o be a feed constant. Explain why H = [p(t) = a_0 + b_x| b
R} is not necessarily a vector subspace of P_x, Are there any values of a_o for which H will be a
subspace? If instead H = {p(t) = a + bt| a, b R}, (i.e., the constant term is allowed to vary over
all real numbers), show that H is a vector subspace of P_n.
Solution
Ans-
A matrix, in general sense, represents a
collection of information stored or arranged
in an orderly fashion. The mathematical
concept of a matrix refers to a set of numbers,
variables or functions ordered in rows and
columns. Such a set then can be defined as a
distinct entity, the matrix, and it can be
manipulated as a whole according to some
basic mathematical rules.
A matrix with 9 elements is shown below.
[
[[
[ ]
]]
]
=
==
=
aaa
=
==
=
253
A
131211
aaa
aaa
232221
333231
819
647
Matrix [A] has 3 rows and 3 columns. Each
element of matrix [A] can be referred to by its
row and column number. For example,
=
==
=a
23
6
A computer monitor with 800 horizontal
pixels and 600 vertical pixels can be viewed as
a matrix of 600 rows and 800 columns.
In order to create an image, each pixel is
filled with an appropriate colour.
ORDER OF A MATRIX
The order of a matrix is defined in terms of
its number of rows and columns.
Order of a matrix = No. of rows
×
××
×
No. of
columns
Matrix [A], therefore, is a matrix of order 3
×
××
×
3.
COLUMN MATRIX
A matrix with only one column is called a
column matrix or column vector.
ROW MATRIX
3
6
4
A matrix with only one row is called a row
matrix or row vector.
[
[[
[ ]
]]
]
653
SQUARE MATRIX
A matrix having the same number of rows
and columns is called a square matrix.
742
942
435
RECTANGULAR MATRIX
A matrix having unequal number of rows and
columns is called a rectangular matrix.
1735
13145
8292
REAL MATRIX
A matrix with all real elements is called a real
matrix
PRINCIPAL DIAGONAL and TRACE
OF A MATRIX
In a square matrix, the diagonal containing
the elements a
11
, a
22
, a
33
, a
44
, ……, a
is called
the principal or main diagonal.
The sum of all elements in the principal
diagonal is called the trace of the matrix.
The principal diagonal of the matrix
742
942
435
nn
is indicated by the dashed box. The trace of
the matrix is 2 + 3 + 9 = 14.
UNIT MATRIX
A square matrix in which all elements of the
principal diagonal are equal to 1 while all
other elements are zero is called the unit
matrix.
001
100
010
ZERO or NULL MATRIX
A matrix whose elements are all equal to zero
is called the null or zero matrix.
000
000
000
DIAGONAL MATRIX
If all elements except the elements of the
principal diagonal of a square matrix are
zero, the matrix is called a diagonal matrix.
002
900
030
RANK OF A MATRIX
The maximum number of linearly
independent rows of a matrix [A] is called
the rank of [A] and i.
Exploring Organizational Culture Research the ITT Tech Virtual Lib.pdfeyebolloptics
Exploring Organizational Culture
Research the ITT Tech Virtual Library to find an article each on the following types of
organizational culture:
Constructive
Passive/Defensive
Aggressive/Defensive
Now, answer the following questions:
What were the norms of each culture, and how were they determined?
What were the behaviors in each culture, and how did those behaviors impact the organization
and why?
Of the three organizational cultures, which one would you prefer to be a part of and why
2 pages
Solution
in constructive approach people are encouraged to interact with others, with the co-employees,
understand each other, make a strong group and work to achieve organizational goals. this
culture are focus in which members are encouraged to interact withpeople and approach tasks in
ways that will help them meet their higher order satisfaction needs. in positions where people do
a complex job, rather than something simple like a mechanic one, this culture is efficient.
here employees are become more friendly in nature and builds strong relationships among them.
aggressive/defensive organizational culture:tThis style is characterized with more emphasis on
task than people. because of the very nature of this style, people tend to focus on their own
individual needs at the expense of the success of the group. the aggressive/defensive style is very
stressful, and people using this style tend to make decisions based on status as opposed to
expertise.
the people who are workholics they will be benefited in this kind of cultures. people will be
selfish and only task oriented here. they wont consider the feelings and emotions of employees.
passive and defensive culture: in organizations with Passive/Defensive cultures, members feel
pressured to think and behave in ways that are inconsistent with the way they believe they should
in order to be effective. People are expected to please others (particularly superiors) and avoid
interpersonal conflict. Rules, procedures, and orders are more important than personal beliefs,
ideas, and judgment. Passive/Defensive cultures experience a lot of unresolved conflict and
turnover, and organizational members report lower levels of motivation and satisfaction.
based on the nature of work and importance, one can choose an organizational culture. for me the
constructive approach is more better and gives positive results..
Can you help me write these functions in C I do not need the main f.pdfeyebolloptics
Can you help me write these functions in C? I do not need the main function. Thank you. The
language is C, NOT C++ in vertBits Description: Accepts a pointer of size uint32 tand inverts
eachbit of the input data passed Preconditions: Input argument is passed as a pointer Post-
conditions: The number of 1s returned Calls: N/A Called by: main int countNumberofones
(uint32 t intData) Write a function that counts numberof ls in an integerpassed setBit
Description: The functionsets the bit in the specified bit position in an to the specifid value. ue
can be a or 0. bitPosition will be between U an Postconditions: The bit of inData at position
biPosition will be set to walue Calls: N/A Called by main void setBit(uint32 t inData, uint32
tbitPosition.uint32 t alue hammingDistance Description: Function hammingDistance calculates
total number of bits that need to be inverted in order to change inData1 into inData2 orvice versa.
Preconditions: The function accepts two unsigned integers as input Postconditions: Thefunction
returns the hamming distance Calls N/A Called by: main int hammi tinDatal, unint32 tinData2)
Solution
int countNumberofOnes(uint32_t *intData)
{
*intData = ~(*intData); // inverts each bit in input
uint32_t num = *intData;
int count =0;
while(number)
{
number &= (number-1);
count ++;
}
return count;
// return number of 1s in the number
}
void setBit(uint32_t *intData, uint32_t bitPosition,uint32_t value)
{
(*intData) ^= (-value ^ ((*intData)) & (1 << bitPosition);
return (*intData);
}
int hammingDistance(uint32_t inData1,uint32_t inData2)
{
char * d1 =(char *)intData1;
char * d2 =(char *)intData2;
int count =0;
// considering both of same length
for (int i=0;i.
Drag the term or statement to the correct column SolutionC.pdfeyebolloptics
Drag the term or statement to the correct column
Solution
Covalent addition to DNA - Methylation on C - trans
Chromatin remodeling - Nucleosomes moved to new location - cis
Covalent addition to histone - Acetylation, phosphorylation, methylation - trans
Localization of histone variant - Histone variants localized to specific locations - cis
Feedback loop - Transcription factor stimulates own product - cis.
Define the labor relations processSolutionThe labor relations.pdfeyebolloptics
Define the labor relations process?
Solution
The labor relations process involves managers (representing the ownership interests) and a labor
organizations (union), selected by employees as their exclusive bargaining agent to represent
their interests and engaging in the joint determination and administration of work rules.
Three basic phases of the labor relations process are as follows:
1) Recognition of the legitimate rights and responsibilities of union and management
representatives.
2) Negotiation of the labor agreement, including appropriate strategies, tactics, and impasse
resolution techniques.
3) Administration of the negotiated labor agreement — the interpretation and application of labor
contract terms on a daily basis..
Accounting 5205Solution Depreciation aims to recognize in the.pdfeyebolloptics
Accounting 5205
Solution
? Depreciation aims to recognize in the income statement the wear suffered by an asset on
account of its use for the generation of income.
The objective of depreciation is not to recover the investment that the company has made for its
construction or acquisition. The investment is recovered through the profitability generated by
the use of said asset.
? Long-term assets, also known as non-current assets, although they are durable, are not always
eternal. Therefore, accounting forces depreciate assets as their normal lives pass, with the
accepted general accounting principle of time period, equity, valuation at cost, accrued,
objectivity, because they do so naturally by the passing of time, due to its use, due to the wear
and tear of the time this asset is used, in order to reflect its best possible value, or to amortize
long-term expenses (deferred assets). For this there are tables and methods for accounting
treatment..
Aiom for the ADT List. C++ Explain what this pseudocode is doing.a.pdfeyebolloptics
Aiom for the ADT List. C++ Explain what this pseudocode is doing.
aList.getEntry(i) = (aList.insert(i, item)).getEntry(i+1)
Solution
You have a list
and we know list has index starting from
0, 1,2,3,4,5,6,.....
So
(aList.insert(i, item)): Inserts item at index i
(aList.insert(i, item)).getEntry(i+1) : Inserts item at index i and fetches and returns the element
at index i+1
aList.getEntry(i) = (aList.insert(i, item)).getEntry(i+1)
So, it means (aList.insert(i, item)).getEntry(i+1) Inserts item at index i and fetches and returns
the element at index i+1 and assigns it to element at index i..
an encryption scheme distributes randomly over the Ascii characters .pdfeyebolloptics
an encryption scheme distributes randomly over the Ascii characters 32-127
What is the 8-bit entropy??
Solution
An encryption scheme we use must convert plain text to human readable cipher.
We here convert 32 ASCI to 127 character.
The transmitter send the message through the channel.The channel modifies the message in some
way.Then the receiver then finds which message is send.The probability expected value of the
information contained in each message is called entropy .The 8 -bit entropy is mostly used for
finding the value..
A class has 40 students aged 17 to 34. What is the probabilty that a.pdfeyebolloptics
A class has 40 students aged 17 to 34. What is the probabilty that at least two students are the
same age? Why?
Solution
Here we have that P(atleast two same ages )= 1- P(no same age)
Now total favorable cases for no same age are 34-17= 18 ( as all will be of different ages)
Thus Probability ( different ages ) = Total favorable case/total case =18/40
And accordingly Probability (atleast two same ages ) =1-18/40 = 22/40 = 11/20
So last required answer is 11/20..
A microbial geneticist isolates a new mutation in E. coli and wishes.pdfeyebolloptics
A microbial geneticist isolates a new mutation in E. coli and wishes to map its chromosomal
location. She uses interrupted-mating experiments with Hfr strains and generalized-transduction
experiments with phage P1. Explain why each technique, by itself, is insufficient for accurate
mapping.
Solution
Hfr cells undergoing conjugation transfer host genes in a linear fashion. The genes transferred
depend on both the Hfr strain and the length of time during which the transfer occurred.
F factors arise from improper excision of an Hfr from bacterial chromosome. They can have only
specific bacterial genes on them because the integration site is fixed for each strain.
P1 does not recognize pseudo-pac sites on the chromosome. P1 seems to begin packaging from
random double-stranded breaks on the chromosome that are generated during phage infection.
Generalized transduction is the process by which any bacterial gene may be transferred to
another bacterium via a bacteriophage, and very rarely a small number of phages carry the donor.
A restricted set of genes will not be able to transfer by this method. She wanted to transfer a
specific gene to a specific located which is not doen by generalized transduction, so accurate
gene mapping will be difficult by these methods..
30. The vouching of recorded payables to supporting documentation wil.pdfeyebolloptics
30. The vouching of recorded payables to supporting documentation will do little or nothing to
verity for accounts payable, the a. existence assertion. b. completeness assertion. c. valuation
assertion. d. rights and obligations assertion.
Solution
Existence Assertion cannot be verified with the supporting documentation for recoreded
payables as existence can be verified by confirmation with the creditor.
Completeness, Valuation and rights & Obligations assertion can be verified with the supporting
documents like agreement, invoice, bank statement etc...
So the answer is Option A..
3. Observe that every cation was initially part of a nitrate compound.pdfeyebolloptics
3. Observe that every cation was initially part of a nitrate compound. Most anions were initially
part of a sodium compound. Would you guess nitrate compounds and sodium compounds to be
soluble or insoluble? Why? 4. A precipitation reaction for copper and carbonate ions would look
like this: Cu2+ (aq) + CO 2 (aq) CuC03 (s) A precipitation reaction for copper and hydroxide
ions would look like this: Cu2+ (aq) + 2 OH\' (aq) Cu(OH)2 (s) a. Write the precipitation
reaction for one of the phosphate compounds. 5. If nitrates (NOs) are soluble and most sulfates
(SO4) are soluble (except Pb2, Ca2*, Sr2\" Hg:2, and Ba2), will an ionic compound precipitate
from the following: Co(NO3)2 (aq) + Na:SO4(aq) ?
Solution.
1)Please explain the commands ifconfig, ping, traceroute, netstat, d.pdfeyebolloptics
1)Please explain the commands ifconfig, ping, traceroute, netstat, dig, nslookup, route, host,
hostname.
2). Explain briefly about TCP/IP and its Protocol Architecture.
3) Explain the difference between TCP/IP Protocol stack and OSI model.
Solution
Answer:
1) Ipconfig
Ipconfig is an MS-DOS utility that can be used from MS-DOS and an MS-DOS shell to display
the network settings currently assigned and given by a network. This command can be utilized to
verify a network connection as well as to verify your network settings.
Ping
Ping is one of the most commonly used network commands that allows you to ping another
network IP address. Pinging another address helps determine if the network card can
communicate within the local network or outside network.
Netstat
The netstat command is used to display the TCP/IP network protocol statistics and information.
Nslookup
The nslookup MS-DOS utility that enables a user to do a reverse lookup on an IP address of a
domain or host on a network.
Route
The route MS-DOS utility enables computers to view and modify the computer\'s route table.
traceroute
The tracert command in MS-DOS and Windows (known as traceroute in Unix-like operating
systems) is a useful tool for diagnosing network issues. It allows you to view a listing of how a
network packet travels through the network and where it may fail or slow down. Using this
information you can determine the computer, router, switch or other network device possibly
causing your network issues.
host
solves a host name into an Internet Protocol (IP) address or an IP address into a host name.
the hostname command is used to show or set a computer\'s host name and domain name. It is
one of the most basic of the network administrative utilities.
A host name is a name that is assigned to a host (i.e., a computer connected to the network) that
uniquely identifies it on a network and thus allows it to be addressed without using its full IP
address. Domain names are user-friendly substitutes for numeric IP addresses.
The basic syntax for the hostname command is
hostname [options] [new_host_name]
2)TCP/IP protocols map to a four-layer conceptual model known as the DARPA model , named
after the U.S. government agency that initially developed TCP/IP. The four layers of the DARPA
model are: Application, Transport, Internet, and Network Interface. Each layer in the DARPA
model corresponds to one or more layers of the seven-layer Open Systems Interconnection (OSI)
model.
Network Interface Layer
The Network Interface layer (also called the Network Access layer) is responsible for placing
TCP/IP packets on the network medium and receiving TCP/IP packets off the network medium.
TCP/IP was designed to be independent of the network access method, frame format, and
medium. In this way, TCP/IP can be used to connect differing network types. These include
LAN technologies such as Ethernet and Token Ring and WAN technologies such as X.25 and
Frame Relay. Independence from any specific ne.
At what point does commercialization start to create inequality Ple.pdfeyebolloptics
At what point does commercialization start to create inequality? Please provide examples.
Solution
Markets and commerce change the character of the goods they touch.Such deliberations touch,
unavoidably, on competing conceptions of the good life.For fear of disagreement, we hesitate to
bring our moral and spiritual convictions into the public square.It simply means that markets will
decide them for us.At a time of rising inequality, the commercialization of everything means that
people of affluence and people of modest means lead increasingly separate lives. We live and
work and shop and play in different places. Children go to different schools. It’s not good for
democracy, nor is it a satisfying way to live.Democracy does not require perfect equality, but it
does require that citizens share a common life. What matters is that people of different
backgrounds and social positions encounter one another, and bump up against one another, in the
course of everyday life. For this is how we learn to negotiate and abide by our differences, and
how we come to care for the common good.
The public schools are an integral part of the institutions of democracy. By schools, Human
Capital forms which eventually helps a country to faster its growth and substantially move
forward.If we are to achieve the democratic ideal of equity, there must be a commons, and it
must be accessible for all to participate effectively. Public education is an important part of that
commons. But this common education is not fee, and only those can grab this oppurtunity who
are able to pay for it.Commercialization encloses the commons and puts up fences, with
admission only to those who can pay. It privatizes public space. It makes the dollar, not
citizenship, the entry point to educational experiences and social and political influence in a
democratic society..
A benefit of an activity received by people not participating in the.pdfeyebolloptics
A benefit of an activity received by people not participating in the activity is called a(n)
Solution
Assuming the question is in terms of economics, the answer is
Positive Externality
Externality is a phenomena in which a proportion of cost (negative externality) or benefit
(positive externality) an activity is received by someone who did\'t participate in the activity. In
case a cost is incurred it is termed as negative externality, while in case of benefit is received, it
is termed as positive externality.
Consider education - a learning activity, in an underdeveloped country. In poor area, if there is
an initiative of education, and children are educated by any welfare institution or government,
that education would not only affect the child individually, but also would affect his family in a
positive manner. The household people might learn somethings which they didn\'t knew before,
that can save them in many ways, such as importance of hygene like washing hands before
having food, or caring for mortals, etc. This is the case of positive externality, as even though the
adult didn\'t attend the education, they did received the benefit. Education also reduces crime,
and hence society as a whole benefits. Another examples of positive externality are low income
people who do not pay taxes does recieve state welfare, military-defence protention, and enjoy
many other public goods, like street light, roads, etc.
The opposite of positive externality is negative externality. Suppose a polluting industry is
placed in a poor agricultural area, and it will pollute the land and or water and or by dumping
wastes and smokes of byproducts. People who don\'t work and have no relation to the industry
would also be affected in an adverse manner. Yet some proportion of the population now have
more stable income, but many others who didn\'t participate in the activity are affected. Farmers
doing pisciculture and agriculture would be affected by dead fishes or bad crop, or general public
breathing polluted air would incur several health cost. All kinds of pollution which are not
natural (like pollution by volcanic eruption), are examples of negative externality..
8. Would the following cell have a spontaneous reaction Explain. .pdfeyebolloptics
8. Would the following cell have a spontaneous reaction? Explain.
Solution
A redox reaction is spontaneous if the standard electrode potential for the redox reaction,
Eo(redox reaction), is positive.
Eo(redox reaction) = Eo(reduction reaction) + Eo(oxidation reaction)
and Eo(redox reaction) > 0
that is, Eo(redox reaction) is positive
If Eo(redox reaction) is positive, the reaction will proceed in the forward direction
(spontaneous).
Spontaneous redox reactions can be used to produce electricity
(see galvanic cells (voltaic cells)).If Eo(redox reaction) is negative (Eo(redox reaction) < 0), the
reaction will not proceed in the forward direction (non-spontaneous).This reaction will be non
spontaneous redox reactions cannot be used to produce electricity.
E standard potential value is positive so reaction is non spontaneously.
Write a command to find out how many users in etcpasswd have the l.pdfeyebolloptics
Write a command to find out how many users in /etc/passwd have the last name “Harris” but not
“Harrison” or anything added to the end of “Harris”. (unix/linux)
Solution
By using erep command we can find out how many users in /etc/passwd. Here we are going to
check whether there exists any user having the last name “Harris” but not \"Harrison\"
egrep -i \"^Harris\" && ~\"^Harrison\" /etc/passwd.
Write a program that mimics the operations of several vending machin.pdfeyebolloptics
Write a program that mimics the operations of several vending machines. More specifically, the
program simulates what happens when the user chooses one of the vending machines, inputs
money and picks an item from the vending machine. Assume there are two vending machines:
one for drinks and one for snacks. Each vending machine contains several items. The name,
price, and quantity of each item is given in two text files; one named “drinks.txt” for the drinks
vending machine and the other named “snacks.txt” for the snacks vending machine.
The format of the input values is comma-separated. The items listed should be organized in the
file with the following order: name, price, quantity. Here are some example items:
The actual reading and parsing of the input file is already handled in the class supplied to you
(see code on BlackBoard). You are given the variables as individual values. You will need to
create the .txt files for creating and testing your vending machines.
You will need to create/complete three classes for this homework assignment: Item,
VendingMachine, and VendingMachineDriver.
Problem Description
Milk,2.00,1
Within your VendingMachine class, include these methods:
VendingMachineThisconstructormethodwilltakeinthenameoftheinputfileand create a vending
machine object. A vending machine object will contain an array of Item objects called stock and
an amount of revenue earned. This constructor method has been completed for you and should
work appropriately once you have completed the rest of this class and the other class definitions.
vendThismethodwillsimulatethevendingtransactionafteravalidamountofmoney and an item
selection are entered. This method will decide if the transaction is successful (enough money or
item) and update the vending machine appropriately.
outputMessage This method will print an appropriate message depending on the success of the
transaction. If the user does not have enough money to buy the chosen item, the vending machine
should prompt the user to enter more money or exit the machine. If the vending machine is out of
the chosen item, the program will print an apology message and prompt the user to choose
another item or exit the machine. If there is enough money for the item selected, then the
vending machine will give the user the item and return the change.
printMenuThismethodprintsthemenuofitemsforthechosenvendingmachine. The Item class needs
to include the following data variables:
• description as a String
• price as a double
• quantity as an int
Within your VendingMachineDriver class, include a main method as the starting point for your
solution that creates the vending machine objects appropriately and then use a loop that
continues interacting with the vending machines until the user enters “X” to exit. See the sample
session for details.
As you implement your solution, you might find that some methods contain some repeated
coding logic. To avoid unnecessary redundancies in your code, have these method.
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
This is a presentation by Dada Robert in a Your Skill Boost masterclass organised by the Excellence Foundation for South Sudan (EFSS) on Saturday, the 25th and Sunday, the 26th of May 2024.
He discussed the concept of quality improvement, emphasizing its applicability to various aspects of life, including personal, project, and program improvements. He defined quality as doing the right thing at the right time in the right way to achieve the best possible results and discussed the concept of the "gap" between what we know and what we do, and how this gap represents the areas we need to improve. He explained the scientific approach to quality improvement, which involves systematic performance analysis, testing and learning, and implementing change ideas. He also highlighted the importance of client focus and a team approach to quality improvement.
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
Andreas Schleicher presents at the OECD webinar ‘Digital devices in schools: detrimental distraction or secret to success?’ on 27 May 2024. The presentation was based on findings from PISA 2022 results and the webinar helped launch the PISA in Focus ‘Managing screen time: How to protect and equip students against distraction’ https://www.oecd-ilibrary.org/education/managing-screen-time_7c225af4-en and the OECD Education Policy Perspective ‘Students, digital devices and success’ can be found here - https://oe.cd/il/5yV
How libraries can support authors with open access requirements for UKRI fund...
You are given a specification for some Java classes as follows. A.pdf
1. You are given a specification for some Java classes as follows.
A building has a number of floors, and a number of windows.
A house is a building.
A garage is a building.
A room has a length, width, a floor covering, and a number of closets.
You can never create an instance of a building, but every object that is a building must have a
method that calculates the floor space, i.e., the Building class is abstract, and has an abstract
method.
A house has a number of bathrooms, and an array of Rooms.
A house has a method that returns the average size of the Rooms.
A Garage can hold some number of cars, and it may have a cement floor or a gravel floor. A
garage has a length and a width. (Don’t use the Room class as a member of the Garage class.)
Object
/
Building Room
/
House Garage
2. Implement the specification.
You must use the following mechanisms correctly:
· Inheritance – is a
· Composition – has a
· Constructor methods
· Accessor / mutator methods = getters, setters
· Arrays of objects
· Passing arrays of objects to methods
· Abstract classes and methods
· Access modifiers – public private
o might not need protected, a you should never use
· toString() methods
· the super keyword
· method overriding
· interfaces
· generics are introduced
· polymorphism using inheritance, and interfaces
Include a test class that has a main method. This test program will make instances of your classes
2. and output the text representation of the objects using the toString() methods. There should be
enough comments in the output so that it is easy to see which classes are being tested.
In your test class, create an ArrayList. Add a couple of houses and garages to your list. Loop
through the list, using the enhanced for loop. Print out the objects using the toString methods.
(The toString methods should return a String object containing all of the instance variables’
values.)
Additional Requirements:
Only methods used for testing will call the System.out.println() method. The purpose of the
classes is to store and manipulate data. Input and output is not included in the data storage and
manipulation classes.
A house will calculate its floor space by looping through the array of rooms, and accumulating
the floor space. Don't worry about the space used by a closet, you can assume that it is included
in the size of the room.
Work incrementally. Start by making a Room class, and testing it. Then make the Building and
Garage classes, test them. The make the house class, and test it.
The constructor for the house class has an array of rooms as a parameter.
The building class is the only class that stores and manipulates the number of windows, and
number of floors.
All garage objects have exactly one floor. Perhaps the Building class should have an overloaded
constructor to accommodate this.
Interface
Add an interface to your package. Call the interface MLSListable. That means that a class that
implements this interface is a property that can be listed for sale. This interface will have only
one method called getMLSListing, and it will return a nicely formatted string about the property
for sale.
- The House class will implement this interface.
- In the Test class add a static method that has one parameter with a data type of
3. MLSListable. Demonstrate that you can pass a house to that method, but a Garage, and a Room
is not MLSListable so it won’t compile.
==========================================================
- There are some interfaces already provided for you in the Java API. Implement the
Comparable interface for your Room class. compareTo returns the difference between 2 objects
as an int.
There are 2 flavors of the Comparable interface. One uses ‘generics’ and include the type of the
objects that can be compared
class Room implements Comparable
There is an advantage to using this version of Comparable. Look up the 2 versions of
Comparable, and describe why you would use this newer one.
- Override the equals method in the Room class.
- Notice the relationship between the equals method and the compareTo method. If your code
indicates that two room objects are equal, but compareTo returns a non-zero value, there is a
contradiction. Similarly, if compareTo indicates that two objects have a difference of 0, the
equals method must return true for those 2 objects.
Also notice that a.compareTo(b) == -b.compareTo(a) must always be true.
Solution
The Room Class:
public class Room implements Comparable {
private int length;
private int width;
private String floorCovering;
private int numberOfClosets;
public Room(int length, int width, String floorCovering, int numberOfClosets) {
this.length = length;
this.width = width;
4. this.floorCovering = floorCovering;
this.numberOfClosets = numberOfClosets;
}
public int getLength() {
return length;
}
public void setLength(int length) {
this.length = length;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public String getFloorCovering() {
return floorCovering;
}
public void setFloorCovering(String floorCovering) {
this.floorCovering = floorCovering;
}
public int getNumberOfClosets() {
return numberOfClosets;
}
public void setNumberOfClosets(int numberOfClosets) {
this.numberOfClosets = numberOfClosets;
}
public String toString() {
String result = " ttLength: " + this.getLength() + " Width: " + this.getWidth() + " Closets:
"
+ this.getNumberOfClosets() + " Floor Covering: " + this.getFloorCovering();
return result;
}
public int compareTo(Room arg0) {
if (this.getLength() * this.getWidth() < arg0.getLength() * arg0.getWidth()) {
return -1;
5. } else if (this.getLength() * this.getWidth() > arg0.getLength() * arg0.getWidth()) {
return 1;
} else {
return 0;
}
}
public boolean equals(Object obj) {
boolean result = false;
if (!(obj instanceof Room)) {
return false;
}
if (this.getLength() * this.getWidth() == ((Room) obj).getLength() * ((Room) obj).getWidth()) {
result = true;
}
return result;
}
}
Building Class:
// The class is abstract so that it can't be instantiated
public abstract class Building {
// Number of floors in the building
private int numberOfFloors;
// Number of Windows in the building
private int numberOfWindows;
// The required Abstract Method
public abstract int floor_space();
// Getter and Setters for the class
public int getNumberOfFloors() {
return numberOfFloors;
}
public void setNumberOfFloors(int numberOfFloors) {
this.numberOfFloors = numberOfFloors;
6. }
public int getNumberOfWindows() {
return numberOfWindows;
}
public void setNumberOfWindows(int numberOfWindows) {
this.numberOfWindows = numberOfWindows;
}
// String Representation for the class
public String toString() {
String result = "I am a Building!";
return result;
}
}
Garage Class:
public class Garage extends Building {
private int numberOfCars;
private String floorCovering;
private int length;
private int width;
public Garage(int numberOfWindows, int length, int width, int numberOfCars, String
floorCovering) {
super.setNumberOfFloors(1);
super.setNumberOfWindows(numberOfWindows);
this.length = length;
this.width = width;
this.numberOfCars = numberOfCars;
this.floorCovering = floorCovering;
}
public int floor_space(){
return this.length*this.width;
}
public int getNumberOfCars() {
return numberOfCars;
}
public void setNumberOfCars(int numberOfCars) {
7. this.numberOfCars = numberOfCars;
}
public String getFloorCovering() {
return floorCovering;
}
public void setFloorCovering(String floorCovering) {
this.floorCovering = floorCovering;
}
public int getLength() {
return length;
}
public void setLength(int length) {
this.length = length;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public String toString() {
String result = "I am a Garage!" + " tLength: " + this.getLength() + " tWidth: " +
this.getWidth()
+ " tFloor Covering: " + this.getFloorCovering() + " tNumber of Cars: " +
this.getNumberOfCars()
+ " ";
return result;
}
}
House Class:
public class House extends Building implements MLSListable {
private Room[] rooms;
private int numberOfBathrooms;
public House(Room[] rooms, int numberOfBathrooms, int numberOfWindows, int
numberOfFloors) {
8. super.setNumberOfFloors(numberOfFloors);
super.setNumberOfWindows(numberOfWindows);
this.numberOfBathrooms = numberOfBathrooms;
this.rooms = rooms;
}
public String genRoomInfo() {
String result = "";
for (int i = 0; i < rooms.length; i++) {
result += rooms[i].toString();
}
return result;
}
public Room[] getRooms() {
return rooms;
}
public void setRooms(Room[] rooms) {
this.rooms = rooms;
}
public int getNumberOfBathrooms() {
return numberOfBathrooms;
}
public void setNumberOfBathrooms(int numberOfBathrooms) {
this.numberOfBathrooms = numberOfBathrooms;
}
// Abstract MEthod from the Building Class
public int floor_space(){
int result;
int sum = 0;
for (int i = 0; i < this.rooms.length; i++) {
sum += rooms[i].getLength() * rooms[i].getWidth();
}
return sum;
}
public int getAvgRoomSize() {
int result;
9. int sum = 0;
for (int i = 0; i < this.rooms.length; i++) {
sum += rooms[i].getLength() * rooms[i].getWidth();
}
result = sum / this.rooms.length;
return result;
}
public String toString() {
String result = "I am a House!" + " tAverage Room Size: " + this.getAvgRoomSize() + "
tBathrooms: "
+ this.getNumberOfBathrooms() + " tFloors: " + this.getNumberOfFloors() + "
tWindows: "
+ this.getNumberOfWindows() + " tRooms: " + this.rooms.length + this.genRoomInfo() + "
";
return result;
}
public String getMLSListing() {
return "MLSListing - " + this.toString();
}
}
Then Finally the Test Class:
import java.util.ArrayList;
public class Test {
public static void main(String[] args) {
// TODO Auto-generated method stub
ArrayList buildingsArray = new ArrayList();
Room room1 = new Room(10, 30, "Marble", 1);
Room room2 = new Room(30, 50, "Marble", 1);
Room room3 = new Room(40, 20, "Wood", 2);
Room room4 = new Room(10, 50, "Wood", 4);
10. Room[] rooms11 = { room1, room2 };
Room[] rooms22 = { room3, room4 };
House house1 = new House(rooms1, 4, 3, 2);
House house2 = new House(rooms2, 1, 2, 1);
Garage garage1 = new Garage(1, 5, 5, 2, "Cement");
Garage garage2 = new Garage(1, 6, 6, 3, "Gravel");
buildingsArray.add(house1);
buildingsArray.add(house2);
buildingsArray.add(garage1);
buildingsArray.add(garage2);
for (Building aBuilding : buildingsArray) {
if (aBuilding instanceof House) {
housePassMethod((House)aBuilding);
} else {
System.out.println(aBuilding.toString());
}
}
System.out.println("Room1 compared to Room2: " + room1.compareTo(room2));
if (room1.equals(room2)) {
System.out.println("Room1 is equal to Room2 in size.");
} else {
System.out.println("Sizes differ.");
}
}
public static void housePassMethod(MLSListable house) {