This site requires JavaScript, please enable it in your browser!
Greenfoot back
Astralman
Astralman wrote ...

2018/5/5

How do I design a class?

Astralman Astralman

2018/5/5

#
Design a class that stores the balance and the number of checks that has been written and return fees? I thought I was done, but my teacher said I forgot a small part in the homework.
import java.util.Scanner;

public class BankDemo{


	public static void main (String []args){

		final double baseFee = 10;

		int numberOfChecks = 0;

		double Charge = 0;

		double balance = 0;

		Scanner keyboard = new Scanner(System.in);

		System.out.print("Please enter the number of checks: ");
		numberOfChecks = keyboard.nextInt();

		if (numberOfChecks < 10) {
			Charge = baseFee + (numberOfChecks * 0.10);

		}
		else if (numberOfChecks > 10) {
			Charge = baseFee + (numberOfChecks * 0.05);


		System.out.println("Charge for the month: " + Charge + ".");

}
}
Yehuda Yehuda

2018/5/6

#
You "forgot a small part in the homework". How is anybody supposed to know what your homework is?
Astralman Astralman

2018/5/6

#
I just said it there. That was the small part.
You need to login to post a reply.