Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

container of structures, returns a double representing the sum of the amounts in those structures. 4. Create main program a) Create ppropriate container of data


container of structures, returns a double representing the sum of the amounts in those structures. 4. Create main program a) Create ppropriate container of data structures b) Open the accounts file (costfile.txt) c) While you can read a line from the file without error Call parse_account, which returns a data structure. Add the returned data structure to the container (using, pushToV) d) Call sum_accounts to determine the amount of money represented e) Print a message and the result.

Try this with some sample data, such as the following lines in costfile.dat You may add or create your own data file to test the program with: You can start with the data in a text file and then write the data in a binary file, this way you practice with both file types.



I have the code that goes with this question just need a flowchart diagram?

Consider the following learning problem in which we wish to classify inputs, each consisting of a single real number, into one of two possible classes C1 and C2. There are three potential hypotheses where Pr(h1) =are the following functions hi(x) = x ? i ? 1 5 and the likelihood for any hypothesis h. You have seen three examples: (0.9, C1), (0.95, C2) and (1.3, C2), and you now wish to classify the new point x = 1.1. (a) Explain how in general the maximum a posteriori (MAP) classifier works. [3 marks] (b) Compute the class that the MAP classifier would predict in this case. [10 marks] (c) The preferred alternative to the MAP classifier is the Bayesian classifier, computing Pr(x ? C1|x, s). where s is the vector of examples. Show that Pr(x ? C1|x, s) = X hi Pr(x ? C1|hi , x) Pr(hi |s) What are you assuming about independence in deriving this result? [3 marks] (d) Compute the class that the Bayesian classifier would predict in this case. [4 marks

Write class called Course _xxx that represents a course taken at a school. Represent each student using the Student class from the Chapter 7 source files, Student.java. Use an ArraylList in the Course to store the students taking that course. The constructor of the Course class should accept only the name of the course. Provide a method called addStudent that accepts one Student parameter. Provide a method called roll that prints all students in the course. Create a driver class School xxx with a main method that creates a course, adds several students, and prints a rol. Submit School_xxxjava and Course ooxjava where xxox are your initials. Student.java public class Student private String firstName, lastName; private Address homeAddress. schoolAddress:

Explain the following Java words. For each write sentence giving an overview of what the word is about, then either write second sentence that shows how it fits in with related concepts or write a small code-fragment to illustrate its purpose: (a) abstract; (b) assert; (c) boolean; (d) break; (e) byte; (f ) case; (g) catch; (h) extends; (i) new; (j) null. [2 marks each] Please keep your explanations of each word brief so that your whole answer to this question remains a reasonable size: you are not expected to produce a detailed explanation or comprehensive illustration.

Consider the design of a Java application for the automated marking of exam questions on Java. The answer to each question consists of Java source code. Your application should read the text of each answer from a file, and check that actual lines of code expected by the examiner are included at any point in the answer. The examiners will want to calculate the average mark (out of 20) for each question, and also the total mark (out of 100) achieved by each candidate in a paper consisting of 5 questions. Model answers should take the form of an executable Java class, for example a class called question1model might contain the following method: protected void defineAnswer() { expectedLines.add("import java.io.*;"); expectedLines.add("public class helloWorld"); expectedLines.add("system.out.println(\"hello world\");"); } Provide a UML diagram showing the classes in the application, and write the basic code for each class, in order to achieve the above functionality. You may ignore error processing, and indicate repetitive passages of code by an ellipsis ". . .". [20 marks]

(a) Describe the four access regimes from public to private that may be applied to Java fields and methods. Why are they useful? [4 marks] (b) When you extend a class, the constructor for your new class will reference the constructor of the parent class, and this latter constructor may have any of the four possible access regimes. Comment on the consequences of each of the four possibilities. [4 marks] (c) If the only constructor for a class is marked as private, is it ever possible to have an instance of that class or any subclass of it? Explain why or why not. [2 marks]

T). At each time step all cells transform simultaneously. If a cell is dead, it becomes alive if it had (just before this time step) exactly three live neighbours. If it is alive, it becomes dead unless it has two or three live neighbours. In this question, locations beyond a 1000 1000 board are to be treated as permanently dead. (a) Show how to set up a simple Java 2-dimensional array of boolean values to represent a Life Board, with all cells initially "dead". [2 marks] (b) For a location (i, j) on the board, give code that will decide whether the next state of that cell should be alive or dead. Make it clear how your code copes if the cell is at the boundary of the board. [4 marks] (c) Referring to part (b), write code that takes one board representing the current state of the game and fills in a second board-array with the state arrived at after one time step. What would happen if instead of using two arrays you wrote the new cell state directly back, using just a single copy of the board? [3 marks] (d) Re-work your solution to part (c) so that you can perform a time step using just one board. You may need to use a 1000-element vector to store information in a way that makes the update safe. [7 marks] (e) All the code you have written so far uses an array of boolean values. Some programmers would instead use an array of int values and treat each of the 32 bits in each int as giving the status of a cell. Suppose you have a 2-dimensional array of integers of size 1024 by 32 (that size is chosen so the array of integers may be viewed as a 1024 by 1024 array of bits): give code to retrieve a bit from a given position (i, j). [4 marks]

A company has fired one of its senior staff after an incident that they claimed was an accident, but where the directors suspected malice. The company's auditors have suggested a review of the company's systems to mitigate 'the insider threat', and your advice has been sought. The directors want to be able to assure the shareholders that they are taking all reasonable steps to limit the damage that staff could do to affect the company's share price, whether accidentally or otherwise.

imageimage

TASK NO.2: A student has a home address. Create two classes Student and Address. The Student class has following data members: 1. Name 2. Roll_num 3. Address (object of Address class) And following member functions: 1. Setter() which sets all data members 2. Display() which prints all information of student The Address class has following data members: 1. City 2. State And following member functions: 1. Setter() which sets city and state 2. Display() which prints city and state Identity the type of relationship among the classes Write C++ program to implement the relationship Write proper default and overloaded constructor where necessary Write Destructor for both classes Test your program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Computer Network questions