Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Fee Calculator

$
0
0
This is not a homework assignment anymore, just one that I am doing so that I can try to learn how to do this.
I would like create an application for an animal-fur trimming service. The business is open 15 weeks of the year, from April through July. The fee for a small animal (under 6 pounds) is $100, a medium animal (under 100 pounds) is $200, and a large animal (101 pounds and above) is $300.
What I would like to do is create a program using the Scanner class that will eventually allow me to come up with a total fee for each year, but I am stuck on the language that would calculate the fee.
import java.util.Scanner;
public class AnimalTrim
{
	public static void main(String[] args)
	{
		double animalFeeTotal;
		int animalWeight;
		int numberOfTrims;
		int year;
		final double SMALL_ANIMAL_FEE = 100;
		final double MED_ANIMAL_FEE = 200;
		final double LRG_ANIMAL_FEE = 300;
		Scanner keyboard = new Scanner(System.in);
		System.out.print("Enter the weight of the animal");
		animalWeight = keyboard.nextInt();
		if(animalWeight < 6)
			fee = SMALL_ANIMAL_FEE;
		else
			if(animalWeight > 6 && animalWeight < 101);
				fee = MED_ANIMAL_FEE;
			else
				if(animalWeight > 101)
					fee = LRG_ANIMAL_FEE;
		
	}
}
		



What I would like for my code to do is use the weight input to decide the fee, then calculate the total based on the number of animals input, while adding the fee altogether. But I am fairly new and cannot find the resources or a similar problem that can help me figure out how to write the code correctly. I have been working on this for weeks and tried looking so many places, which is why I am now asking for guidance.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>