Have in mind that the following code is ofr C++ but I know that whatever the language you are using, you can use the same idea:
<span><iostream>
using namespace std;
int main()
{
int count=0;
string x;
while(1)
{
cout<<"Enter either goose or duck";
cin>>x;
if ( x=="Goose") break;
count++;
}
cout<<"Number of Ducks="<<count<<endl;
return 0;
}
</span>
Another one that is simplier but the language is python is:
counter = 0while True: line = input()if line == 'duck': counter += 1 elif line == 'goose':breakprint(counter)
Answer:
Flash document
Explanation:
While creating an animation, we need to find out the purpose and the type of the audience, the file size and various other features of the animation. And all these details are being mentioned in one document, and we know that as the flash document. The purpose and the target audience both are being mentioned in the flash document. And this flash document is being used as a reference while developing an animation. The purpose and target audience are important factors while designing an animation.
Answer:
Hello attached is the Java program written to solve the problem
The Pet.java and Dog.java files are unaltered
Explanation:
The input and output codes are attached as well i.e the second image is the input while the third image is the output code
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 advantage for the above condition is as follows:-
Explanation:
- If a user creates a defined constant variable and assigns a value on its and then uses that variable instead of the value, then it will a great advantage.
- It is because when there is a needs to change the value of that variable, then it can be done when the user changes the value in one place. There is no needs to change the vale in multiple places.
- But if there is a value in multiple places instead of a variable and there is no constant variable, then the user needs to change the value in multiple places.