Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2016 AP COMPUTER SCIENCE A FREE-RESPONSE QUESTIONS 2. This question involves two classes that are used to process log messages. A list of sample log

image text in transcribed

2016 AP COMPUTER SCIENCE A FREE-RESPONSE QUESTIONS 2. This question involves two classes that are used to process log messages. A list of sample log messages is given below CLIENT3 :security alert - repeated 1ogin failures Webserver: disk offline SERVERl:file not found SERVER2: read error on disk DSK1 SERVER1:write error on disk DSK2 Webserver:error on /dev/disk Log messages have the format machineld description, where machineld identifies the computer and description describes the event being logged. Exactly one colon (":" appears in a log message. There are no blanks either immediately before or immediately after the colon. The following LogMessage class is used to represent a log message. public class LogMessage private String machineld private String description: /Precondition: message is a valid log message. public LogMessage (String message) to be implemented in part (a) Returns true if the description in this log message properly contains keyword; false otherwise public boolean containsWord (string keyword) to be implemented in part (b) *) public String getMachineld) return machineId) public String getDescription() return description; // There may be instance variables, constructors, and methods that are not shown. c 2016 The College Board. Visit the College Board on the Web: www.collegeboard.org. GO ON TO THE NEXT PAGE 2016 AP COMPUTER SCIENCE A FREE-RESPONSE QUESTIONS (a) Write the constructor for the LogMessage class. It must initialize the private data of the object so that getMachineld returns the machineld part of the message and getDescription returns the description part of the message Complete the LogMessage constructor below /Precondition: message is a valid log message. / public LogMessage(String message)

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

Database Theory Icdt 99 7th International Conference Jerusalem Israel January 10 12 1999 Proceedings Lncs 1540

Authors: Catriel Beeri ,Peter Buneman

1st Edition

3540654526, 978-3540654520

More Books

Students also viewed these Databases questions