A Java class, Database, contains a public method called printStatistics, which outputs statistical information related to that database. The printStatistics method calls another helper method, calculateMean, which is only ever used in this context - it is never called from outside the Database class.
Declaring the calculateMean method with the public access modifier would be bad program design, as it is an example of...
Which of the following attributes would be best represented by an enum type in Java?
A particular Java program has an Enrolment class which holds information about a student's enrolment details. This is contained in a separate StudentAndUnits class.
This is poor program design, as it is an example of...
This question is related to the Monster-Zoo multi-class example provided in Week 10 pre-reading materials.
Which of the following Zoo methods would not be adversely affected if the variable numberOfMonsters was public and its integrity was compromised by driver code?
This question is related to the Monster-Zoo multi-class example provided in Week 10 pre-reading materials.
Does the variable numMonstersInstantiated in the Monster class have to be static to perform its function?
This question is related to the Monster-Zoo multi-class example provided in Week 10 pre-reading materials.
Should the method getNumMonstersInstantiated in the Monster class be static in order to perform its function?
You need to create a Java application that stores information about recipes and their nutritional information. Each recipe has a list of ingredients that must be stored by the program, and each ingredient has a name and a number of kilojoules associated with it.
What would be the best class design for the program?
This question is related to the Monster Zoo multi-class example provided in Week 10 pre-reading materials.
Why are the Date and Food objects immutable?
Envie sua solução da Questão 2 na caixa abaixo.