Professional Documents
Culture Documents
1) Given three arrays A, B initialized with some non sorted integers, and C
with a size equal to the sizes of A and B put together, write a Java program to combine
array A and B elements into the array C and print all the elements in C.
}
}
Create an AutoTrip class that will allow the Journey class to work correctly.
Group B assignment due 2 November 2010
1) Write a complete Java method that will count the number of occurrences of two
integers, x and y, in a given one-dimensional array of integers, N. The variables N and n
and y should be parameters to the method. The method should print the final count of
each integer and return the total count of both
The controller gets two inputs: sampled values of temperature and pressure
coming from the boiler. The controller checks these values against some set
maximum and minimum threshold values. If any read signal values are outside the
threshold values the controller prints warning messages on computer display for
operators .
If both read signal values are outside the threshold values the controller prints
warning messages on computer display for operators and starts an alarm .
Group C assignment due 2 November 2010
1) Given two equal sized double arrays : X, Y initialized with some non sorted numbers,
and a third equal sized boolean array Z . Write a Java method to check the
equality of corresponding elements of array X and Y elements , and put the result into
the corresponding index element of boolean array Z .
2)Given the following classes
class myQuestion {
class myProblem extends myQuestion {
protected int a; protected int c;
protected int b; public myProblem() {
public myQuestion() { c = 0;
a = 0; }
b = 0; public myProblem(int x, int y, int z) {
} super(y,z);
public myQuestion(int x, int y) { c = x;
a = x; }
b = y; public myProblem(int x, int y) {
} this();
public myQuestion(int x) { super(x,y);
this(); }
a = x; public myProblem(int x){
} c = x;
public int enquire() { }
return a + b; public int enquire() {
} c = a * b;
public int interrogate(int x) { return c;
return (a + b)* x; }
} public void display() {
public void display() { System.out.println(a + “ “ +b + “ “
System.out.println(a + “ “ + b); +c);
} }
} }
2) Create Vehicle and TopDriver classes that will make the following CarDriver
program compile and run properly.
driver.drive(v1);
driver.drive(v2);
System.out.println(v1.getModel() +” has ” +v1.getFueLevel() + “ litres remaining”);
//litres
System.out.println(driver.getID() +” has travelled ” + driver.getLog() ); //km
}
}