There were a total of 43 points on this exam.
public double findAverage(int[] array) {
double sum = 0;
if (array.length == 0)
return 0.0;
for (int i=0;i<array.length;i++)
sum = sum + array[i];
return sum/(double)array.length;
Scanner scan = new Scanner(System.in):
int val;
do {
System.out.println("Enter an integer between 1 and 10");
val = scan.nextInt();
} while (val < 1 || val > 10);
char[][] board = new char[30][16];
public boolean equalRow(char[][] board) {
for (int i=0;i<board.length;i++)
if (equalRow(board[i])
return true;
return false;
}
public boolean equalRow(char[] row) {
if (row.length == 0)
return false;
for (int i=1;i<row.length;i++)
if (row[i] !+ row[0])
return false;
return true;
}
public class ComputerMouse {
private boolean wireless;
private boolean usb;
private int numButtons;
private double price;
public ComputerMouse(boolean wireless, boolean usb, int numButtons, double price) {
this.wireless = wireless;
this.usb = usb;
this.numButtons = numButtons;
this.price = price;
}
public boolean getWireless() {
return wireless;
}
public boolean getUsb() {
return usb;
}
public int getNumButtons() {
return numButtons;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
}
public Name(String fullName) {
int ind;
ind = fullName.indexOf(' ');
if (ind == -1) {
firstName = fullName;
lastName = "";
}
else {
firstName = fullName.substring(0,ind);
lastName = fullName.substring(ind).trim();
}
}