Question: Java programming question (Object oriented programming) Answer FULL question properly for thumbs up: Question 2 (a) A programmer decides to use Java instead of C

Java programming question (Object oriented programming)

Answer FULL question properly for thumbs up:

Java programming question (Object oriented programming) Answer FULL question properly for thumbs

Question 2 (a) A programmer decides to use Java instead of C in a project, partly because "errors are handled better and debugging is easier". With reference to the features and the programming environments of both languages, explain why the programmer might have arrived at this conclusion (b) The programmer in (a) notes that her main reason for choosing Java over C has to do with "the cleaner structure and improved reusability of the code, and the way it better models the problem domain". Explain carefully what she means by this statement (c) The questions that follow concern this statement from a Java program List data new ArrayList(); (i) The author of this code has made a typing error that will prevent it from compiling Why does the problem occur? What change is needed to fix it? (ii) The statement refers to a List on the left hand side of the assignment, rather than an ArrayList. Why is this not a problem? What, in general, is the benefit of doing this? (iii) What are the circumstances under which ArrayList is an appropriate choice of implementation for this particular list? (d) A computer science student is given the task of writing Java software to tally votes in a Student Union election. He decides to represent candidate names as a list of strings and the corresponding total votes for each candidate as a list of integers. Explain the drawbacks of this approach. Propose a better Java data structure for the task, explaining clearly why it is superior. Give an example of the code needed to create an instance of this data structure Question 2 (a) A programmer decides to use Java instead of C in a project, partly because "errors are handled better and debugging is easier". With reference to the features and the programming environments of both languages, explain why the programmer might have arrived at this conclusion (b) The programmer in (a) notes that her main reason for choosing Java over C has to do with "the cleaner structure and improved reusability of the code, and the way it better models the problem domain". Explain carefully what she means by this statement (c) The questions that follow concern this statement from a Java program List data new ArrayList(); (i) The author of this code has made a typing error that will prevent it from compiling Why does the problem occur? What change is needed to fix it? (ii) The statement refers to a List on the left hand side of the assignment, rather than an ArrayList. Why is this not a problem? What, in general, is the benefit of doing this? (iii) What are the circumstances under which ArrayList is an appropriate choice of implementation for this particular list? (d) A computer science student is given the task of writing Java software to tally votes in a Student Union election. He decides to represent candidate names as a list of strings and the corresponding total votes for each candidate as a list of integers. Explain the drawbacks of this approach. Propose a better Java data structure for the task, explaining clearly why it is superior. Give an example of the code needed to create an instance of this data structure

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!