Answer:
The Java class is given below with appropriate tags for better understanding
Explanation:
public class Cat extends Pet{
private String breed;
public Cat(String name, String owner, String breed){
/* implementation not shown */
super(name, owner);
this.breed = breed;
}
public String getBreed() {
return breed;
}
public void setBreed(String breed) {
this.breed = breed;
}
public String speak(){ /* implementation not shown */
return "Purring…";
}
}
Answer:
The code is given below
Explanation:
The correct syntax would be to place appropriate parenthesis.
(month==1?"jan":(month==2?"feb":(month==3?"mar":(month==4?"apr":(month==5?"may":(month==6?"jun":(month==7?"jul":(month==8?"aug":(month==9?"sep":(month==10?"oct":(month==11?"nov":"dec")))))))))));
Similarly, you can also use the following code:
String[] months = { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec" };
int month = 1;
String monthDescription = months[month - 1];
The database planner would most likely create a table that contains customer contact information since these would be the individuals who placed an order for Sarah's products after visiting her blog.
Answer:
Explanation:
We can use for-loop in python to calculate the tuition amount in the next 5 years. If the tuition is increasing 3% each year, in each loop we can multiply the amount by 1.03
tuition = 8000
for year in range(1,6):
tuition *= 1.03
print("The tuition amount after " + str(year) + " year(s) is $" + str(tuition))
Answer:
b) objects are resuable
Explanation:
In OOP there's code reuse where a method or any other body of code is defined once and called or reused severally.