Answer:
JAVA program is as follows.
import java.util.Scanner;
import java.util.*;
public class Program{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int id;
String name, breed;
int age;
double weight;
int weekly_day_care_fee_15 =55;
int weekly_day_care_fee_30 =75;
int weekly_day_care_fee_80 = 105;
int weekly_day_care_fee_greater =125;
int weekly_day_care_fee=0;
System.out.print("Enter id of dog's owner: ");
id = sc.nextInt();
System.out.print("Enter name of the dog: ");
name = sc.next();
System.out.print("Enter breed of the dog: ");
breed = sc.nextLine();
System.out.print("Enter age of the dog: ");
age = sc.nextInt();
System.out.print("Enter weight of the dog: ");
weight = sc.nextDouble();
if(weight<15)
weekly_day_care_fee = weekly_day_care_fee_15;
if(weight>=15 && weight<30)
weekly_day_care_fee = weekly_day_care_fee_30;
if(weight>=30 && weight<80)
weekly_day_care_fee = weekly_day_care_fee_80;
if(weight>=80)
weekly_day_care_fee = weekly_day_care_fee_greater;
System.out.println("");
System.out.println("====== BILL FOR WEEKLY DAY CARE OF DOGS ======");
System.out.println("");
System.out.println("ID of dog's owner \t \t \t \t \t: "+id);
System.out.println("Enter name of the dog \t \t \t \t: "+name);
System.out.println("Enter breed of the dog \t \t \t \t: "+breed);
System.out.println("Enter age of the dog \t \t \t \t: "+age);
System.out.println("Enter weight of the dog \t \t \t: "+weight);
System.out.println("The weekly day care fee of the dog : $"+weekly_day_care_fee);
}
}
OUTPUT
Enter id of dog's owner: 123
Enter name of the dog: JOHN
Enter breed of the dog: BULLDOG
Enter age of the dog: 3
Enter weight of the dog: 70
====== BILL FOR WEEKLY DAY CARE OF DOGS ======
ID of dog's owner : 123
Enter name of the dog : JOHN
Enter breed of the dog : THERAPY
Enter age of the dog : 3
Enter weight of the dog : 70.0
The weekly day care fee of the dog : $105
Step-by-step explanation:
1. All the variables are declared inside main() hence, not declared as static.
2. Variables are declared to hold owner id, name and breed of the dog, age and weight of the dog.
3. Variables are declared and initialized for all values of day care fees.
4. Multiple if statements are used to determine the fees based on the weight.