Hello I am taking java class and I have this program as an assignment. I am trying to figure out who to set the value and return the calculation using Scanner class. I am a total beginner in java ( in any comp. language). if you can help me figure out the issue. I have look everywhere but I can't find the solution.
/**
* Write a description of class BookclubTester here.
*
* @author (your name)
* @version (a version number or a date)
*/
import java.util.Scanner;
public class BookclubTester {
public BookclubTester() {
String studentName;
}
public static void main (String [] args) {
int books;
int count = 0;
while (count < 5) {
Scanner input = new Scanner(System.in);
System.out.println("Please provided your name :" );
String studentName = input.nextLine();
Bookclub rewardsProgram = new Bookclub();
System.out.println("Please provide the numbers of books purchase for the month " );
books = input.nextInt();
rewardsProgram.setBooks(books);
System.out.println(rewardsProgram.getRewardPoints());
count++;
}
}
}
This is the class
/**
*
* @author
*/
public class Bookclub {
private String studentName;
private int books = 0;
private int rewardPoints;
public Bookclub () {
}
public int getBooks() {
return books;
}
public void setBooks(int books) {
this.books = books;
}
public int getCalculateRewardPoints (){
return rewardPoints;
}
public int getRewardPoints() {
return rewardPoints;
}
public void setCalculateRewardPoints (int rewardPoints) {
this.rewardPoints = rewardPoints;
if (books == 0) {
rewardPoints = 0;
System.out.println("Your points are:" + rewardPoints);
} else if (books == 1) {
rewardPoints = 5;
}else if (books == 2) {
rewardPoints = 15;//
}else if(books == 3) {
rewardPoints = 30;
}else if(books == 4) {
rewardPoints = 60;
}
}
public void setRewardPoints(int rewardPoints) {
this.rewardPoints = rewardPoints;
if(rewardPoints == 0) {
rewardPoints = 0;
}else if(rewardPoints ==5) {
System.out.println("Your points are : " + rewardPoints);
}else if(rewardPoints == 15) {
System.out.println("Your points are:" + rewardPoints);
}else if(rewardPoints == 30) {
System.out.println("Your points are:" + rewardPoints);
}else if(rewardPoints == 60) {
System.out.println("Your points are:" + rewardPoints);
}
}
}