1 / 1100%
String name;
int numQuestions;
public Geek(String name, int numQuestions){
this.name = name;
this.numQuestions = numQuestions;
}
public String getName(){
return name;
}
public int getNumberOfQuestions(){
return numQuestions;
}
public boolean isEven (int num1, int num2){
numQuestions++;
if((num1+num2)%2 ==0){
return true;
}else{
return false;
}
}
public int sum (int num1, int num2){
int big,small,sum= 0;
numQuestions++;
if(num2>num1){
big = num2;
small = num1;
}else{
big = num1;
small = num2;
}
while(big>=small){
sum +=big;
big--;
}
return sum;
}
public boolean leapYear(int year){
numQuestions++;
if(year<1582){
if(year%4 == 0){
return true;
}
}else{
if(year%400 == 0){
return true;
}else if(year%4 == 0 && year%100 != 0){
return true;
}else{
return false;
}
}return false;
}
}
Powered by TCPDF (www.tcpdf.org)
//***********************************************************
Geek.java
// Name: Michael Lewandowski
// Title:
// Description: Class file for a geek
// Time spent: 30 minutes
// Date: October 20,2014
//**********************************************************
public class Geek {
Students also viewed