The Bone Jour Dog Day Care Centre charges clients a daily rate that is based on both the size of the dog and number of days per month in a client’s contract. The following tableshows the daily rates.Prompt the user to enter a dog’s weight and number of days per month needing care, then calculate and display the daily rate and the total for the month (days times the daily rate). Save the file as DogDayCare.java
import java.util.Scanner;
public class DogDayCare {
public static void main(String[] args) {
int dogsWeight = 0;
int days = 0;
double dailyRateCount = 0;
double dailyRate = 1.5;
Scanner input = new Scanner(System.in);
System.out.println("Please provide your dogs weight (in pounds) and press Enter: ");
dogsWeight = input.nextInt();
dailyRateCount = dogsWeight * 1.5;
System.out.println("Thank you.For dog with weight: " + dogsWeight + " pounds, daily rate is: " + dailyRate
+ " one day care cost: $" + dailyRateCount);
System.out.println("Please provide days for your dogs staing on care and press Enter: ");
days = input.nextInt();
dailyRateCount = dailyRateCount * days;
System.out.println("Thank you.For dog with weight: " + dogsWeight + " daily rate is: " + dailyRate + " and"
+ days + " day care cost: $" + dailyRateCount);
input.close();
}
}
Comments
Leave a comment