Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java related questions You need to create a Java application that stores information about recipes and their nutritional information. Each recipe has a list of
Java related questions
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? A Java program has a class called Enrolment that stores information about a particular student's enrolment details. The class has a Student object as one of its fields. The program designer has chosen to store the student ID as a field in both the Enrolment class and the Student class. This is... a. b. c. d. The program should have a Recipe class and an Ingredient class. The Ingredient class should have a Recipe object, a name, and kilojoules as fields. The program should have an Ingredient class only, which should have fields for ingredientName, kilojoule, and recipeName. The program should have a Recipe class only, which should hold a list of ingredient names and of ingredient kilojoules. The program should have a Recipe class and an Ingredient class. The Recipe class should hold a list of Ingredient objects, and the Ingredient class should have name and kilojoules as fields. a. b. c. d. Necessary, as both the Enrolment and Student classes need to access this information. Bad program design - it is an example of code duplication, which should be avoided. Bad program design - it will cause a syntax error, as you can't declare the same field in two different classes. Good program design, as having the variable in two different places ensures it will be correct. Which of the following attributes would be best represented by an enum type in Java? 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... a. b. c. d. A variable dayOff which holds the day of the month (O to 31) when an employee is rostered off. A variable dayOff which holds the single day of the week (one of Mon-Sun) when an employee is rostered off. A variable daysOff which holds the (possibly multiple) days of the week (Mon- Sun) when an employee is rostered off. A variable isDayOff which is true if an employee has the day off, and false otherwise. a. b. c. d. Low method cohesion. Explicit coupling. Implicit coupling. Low class cohesion. 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.. You need to develop a Java application that keeps track of the membership information of a particular club. Your application needs to store each member's name and membership ID. What would be the best class design for the program? a. b. c. d. Implicit coupling. Low class cohesion. Low method cohesion. Explicit coupling. a. b. c. d. The program should have two classes called Club and Member. The Member class should have fields holding the name and memberlD of each member, and the Club class should hold a list of Member objects. The program should have a single class called Member. This class should have fields storing the name, memberlD, and club of the member. The program should have four classes called Club, Member, Name, and MemberlD. The Club class should hold a list of Member objects, and the Member class should contain references to the Name and MemberlD objects. The program should have a single class called Club. This class should have fields storing the name and memberlD of each member.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started